-
Notifications
You must be signed in to change notification settings - Fork 3
/
Common-Layers.yaml
69 lines (69 loc) · 2.73 KB
/
Common-Layers.yaml
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
AWSTemplateFormatVersion: 2010-09-09
Description: Common-Layers Template.
This creates Lambda Layers intended for use by Functions in multiple areas.
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Stack Dependencies
Parameters:
- BucketsStackName
- Label:
default: Layer Configuration
Parameters:
- AsyncCustomResourceLayerKey
- AsyncCustomResourceLayerObjectVersion
ParameterLabels:
BucketsStackName:
default: Buckets Stack Name
AsyncCustomResourceLayerKey:
default: AsyncCustomResource Layer S3 Key
AsyncCustomResourceLayerObjectVersion:
default: AsyncCustomResource Layer S3 Object Version
Parameters:
BucketsStackName:
Description: Name of the CloudFormation Stack containing Buckets
Type: String
MinLength: 2
MaxLength: 64
Default: Buckets
AllowedPattern: ^[A-Z][-a-zA-Z0-9]*$
ConstraintDescription: must begin with an upper case letter and contain alphanumeric characters and dashes.
AsyncCustomResourceLayerKey:
Description: Key of Object within the S3 Bucket containing the AsyncCustomResource Lambda Layer zipfile
Type: String
MinLength: 2
MaxLength: 64
Default: AsyncCustomResourceLayer.zip
AllowedPattern: ^[A-Za-z][-_a-zA-Z0-9]*Layer\.zip$
ConstraintDescription: must be a valid zipfilename, not containing slashes.
AsyncCustomResourceLayerObjectVersion:
Description: Version of Object within the S3 Bucket containing the AsyncCustomResource Lambda Layer zipfile
Type: String
MaxLength: 32
Default: ''
ConstraintDescription: must be a valid S3 Object Version.
Conditions:
ConfigureAsyncCustomResourceLayerObjectVersion: !Not [ !Equals [ !Ref AsyncCustomResourceLayerObjectVersion, '' ]]
Resources:
AsyncCustomResourceLayerVersion:
Type: AWS::Lambda::LayerVersion
Properties:
LayerName: AsyncCustomResource
Description: A Lambda layer version which contains the cfn-response-promise module, needed to write Lambda Functions
which use the async/await coding style instead of callbacks.
LicenseInfo: MIT
CompatibleRuntimes:
- nodejs8.10
- nodejs10.x
Content:
S3Bucket: !ImportValue
Fn::Sub: ${BucketsStackName}-FunctionsBucket
S3Key: !Ref AsyncCustomResourceLayerKey
S3ObjectVersion: !If [ ConfigureAsyncCustomResourceLayerObjectVersion, !Ref AsyncCustomResourceLayerObjectVersion, !Ref 'AWS::NoValue' ]
Outputs:
AsyncCustomResourceLayerVersionArn:
Description: The AsyncCustomResource Lambda LayerVersion ARN
Value: !Ref AsyncCustomResourceLayerVersion
Export:
Name: !Sub ${AWS::StackName}-AsyncCustomResourceLayerVersionArn