Created
January 13, 2017 01:56
-
-
Save wjordan/8fde8bb25601c974872921196dea055a to your computer and use it in GitHub Desktop.
Nested stacks
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Resources": { | |
"LambdaStack": { | |
"Type": "AWS::CloudFormation::Stack", | |
"Properties": { | |
"TemplateURL": "./Test1.json", | |
"TimeoutInMinutes": "60" | |
} | |
}, | |
"PermissionsStack": { | |
"Type": "AWS::CloudFormation::Stack", | |
"Properties": { | |
"TemplateURL": "./Test2.json", | |
"Parameters": { | |
"LambdaTest": { | |
"Fn::GetAtt": ["LambdaStack", "Outputs.LambdaTest"] | |
} | |
}, | |
"TimeoutInMinutes": "60" | |
} | |
} | |
} | |
} |
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": { | |
"LambdaTestRes": { | |
"Type": "AWS::Lambda::Function", | |
"Properties": { | |
"Description": "Testing AWS cloud formation", | |
"FunctionName": "LambdaTest", | |
"Handler": "lambda_handler.lambda_handler", | |
"MemorySize": 128, | |
"Role": "arn:aws:iam::[account]:role/[role]", | |
"Runtime": "python2.7", | |
"Timeout": 300, | |
"Code": { | |
"ZipFile": { | |
"Fn::Join": [ | |
"\n", | |
[ | |
"var response = require('cfn-response');", | |
"exports.handler = function(event, context) {", | |
" response.send(event, context, response.SUCCESS, {});", | |
"};" | |
] | |
] | |
} | |
} | |
} | |
} | |
}, | |
"Outputs": { | |
"LambdaTest": { | |
"Value": { | |
"Fn::GetAtt": [ | |
"LambdaTestRes", | |
"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
{ | |
"Parameters": { | |
"LambdaTest": { | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"LambdaPermissionLambdaTest": { | |
"Type": "AWS::Lambda::Permission", | |
"Properties": { | |
"Action": "lambda:invokeFunction", | |
"FunctionName": { | |
"Ref": "LambdaTest" | |
}, | |
"Principal": "apigateway.amazonaws.com", | |
"SourceArn": { | |
"Fn::Join": ["", ["arn:aws:execute-api:", { | |
"Ref": "AWS::Region" | |
}, ":", { | |
"Ref": "AWS::AccountId" | |
}, ":", "TestAPI", "/*"]] | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fill in
"arn:aws:iam::[account]:role/[role]"
with a valid role in your account.