This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom_function_arn=$(aws cloudformation describe-stacks --stack-name $create_stack --query Stacks[*].Outputs[?OutputKey==\'CustomFunctionArn\'].OutputValue --output text) | |
aws cloudformation create-stack \ | |
... | |
--parameters \ | |
ParameterKey="CustomFunctionArn",ParameterValue="$custom_function_arn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Outputs: | |
CustomFunctionArn: | |
Description: The arn of the custom resource function. | |
Value: !GetAtt 'CustomFunction.Arn' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resources: | |
CustomFunction: | |
Type: AWS::Lambda::Function | |
Properties | |
... | |
CustomResource: | |
Type: Custom::CustomResource | |
Properties: | |
ServiceToken: !GetAtt 'CustomFunction.Arn' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LambdaExecutionRole: | |
Type: AWS::IAM::Role | |
Properties: | |
Policies: | |
- PolicyName: root | |
PolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resources: | |
CustomFunction: | |
Type: AWS::Lambda::Function | |
Properties: | |
Code: | |
S3Bucket: !Ref 'S3Bucket' | |
S3Key: !Ref 'S3Key' | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parameters: | |
S3Bucket: | |
Description: The name of the bucket that contains your packaged source | |
Type: String | |
S3Key: | |
Description: The name of the ZIP package | |
Type: String | |
Default: custom-resource.zip | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zip /tmp/custom-resource.zip customresource.js | |
aws s3 cp /tmp/custom-resource.zip s3://your-custom-resource-code-bucket/custom-resource.zip |