-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yml
More file actions
90 lines (85 loc) · 2.65 KB
/
template.yml
File metadata and controls
90 lines (85 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: Lambda Ephemeral Storage Tester
Parameters:
FileName:
Description: The name of the file that function downloads from S3
Type: String
Default: 'data-file'
StorageSize:
Description: Size of the ephemeral storage
Type: Number
Default: 512
Resources:
FileStorage:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Sub '${AWS::StackName}-${AWS::Region}-${AWS::AccountId}-ephstorage'
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: 'AES256'
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: 'development'
MethodSettings:
- ResourcePath: '/*'
HttpMethod: '*'
ThrottlingBurstLimit: '20'
ThrottlingRateLimit: '40.0'
ephemeralStorageTesterFunction:
Type: AWS::Serverless::Function
Properties:
Handler: com.slalom.TempStorageCalculator
Description: Function returning the size of the ephemeral storage after downloading an object from S3
Runtime: java11
CodeUri: build/distributions/lambdaEphemeral.zip
Timeout: 900
MemorySize: 10240
Environment:
Variables:
S3_FILE_NAME: !Ref FileName
S3_BUCKET_NAME: !Sub '${AWS::StackName}-${AWS::Region}-${AWS::AccountId}-ephstorage'
Policies:
- AWSXrayWriteOnlyAccess
- AWSLambdaBasicExecutionRole
- Statement:
- Effect: "Allow"
Action: s3:GetObject
Resource:
- !Sub 'arn:aws:s3:::${AWS::StackName}-${AWS::Region}-${AWS::AccountId}-ephstorage/*'
- Effect: "Allow"
Action: s3:ListBucket
Resource:
- !Sub 'arn:aws:s3:::${AWS::StackName}-${AWS::Region}-${AWS::AccountId}-ephstorage'
Layers:
- !Ref dependencyLibraries
#Architectures:
# - arm64
#EphemeralStorage:
# Size: !Ref StorageSize
Tracing: Active
Events:
GetStorage:
Type: Api
Properties:
Path: /ephemeral-storages
Method: GET
RestApiId:
Ref: ApiGatewayApi
dependencyLibraries:
Type: AWS::Lambda::LayerVersion
Properties:
LayerName: storage-tester-library
Description: Dependencies for the functions
Content: build/distributions/lambdaEphemeral-libs.zip
CompatibleRuntimes:
- java11
#CompatibleArchitectures:
# - x86_64