Clean up the deployment process, because we can't use the Github .zip file directly
This commit is contained in:
parent
c1de9ee1c6
commit
8e9c7ba1cd
2 changed files with 22 additions and 17 deletions
25
README.md
25
README.md
|
@ -12,9 +12,9 @@ general manner - much the same way CloudFormation itself has permission to do al
|
|||
|
||||
|
||||
## Usage
|
||||
1. Upload the .zip file of this repo from Github to an S3 bucket in your AWS account.
|
||||
2. Use the included create_functions.template to deploy a stack that creates the Lambda functions for you. Remember the stack name.
|
||||
3. Include the following resources in your CloudFormation template. These will create a) a nested stack that
|
||||
1. Use https://s3.amazonaws.com/com.gilt.public.backoffice/cloudformation_templates/create_cloufformation_helper_functions.template
|
||||
to deploy a stack that creates the Lambda functions for you. Remember the stack name.
|
||||
2. Include the following resources in your CloudFormation template. These will create a) a nested stack that
|
||||
looks up the ARNs from the previous step and b) a custom resource that allows your template to read those ARNs.
|
||||
|
||||
```
|
||||
|
@ -37,7 +37,7 @@ general manner - much the same way CloudFormation itself has permission to do al
|
|||
```
|
||||
|
||||
You can either hardcode the stack name of your helper functions, or request it as a parameter.
|
||||
4. Use the ARNs from the previous step in a custom resource, to call those Lambda functions:
|
||||
3. Use the ARNs from the previous step in a custom resource, to call those Lambda functions:
|
||||
|
||||
```
|
||||
"PopulateTable": {
|
||||
|
@ -86,4 +86,19 @@ it does not already exist.
|
|||
A JSON array of items to be inserted, in JSON format (not DynamoDB format).
|
||||
|
||||
#### Reference Output Name
|
||||
DynamoDBPutItemsFunctionArn
|
||||
DynamoDBPutItemsFunctionArn
|
||||
|
||||
## Deployment (contributors)
|
||||
After making changes (i.e. adding a new helper function), please do the following:
|
||||
|
||||
1. Upload this zipped repo to the com.gilt.public.backoffice/lambda_functions bucket. To produce the .zip file:
|
||||
|
||||
```
|
||||
zip -r cloudformation-helpers.zip . -x *.git*
|
||||
```
|
||||
|
||||
Unfortunately we can't use the Github .zip file directly, because it zips the code into a subdirectory named after
|
||||
the repo; AWS Lambda then can't find the .js file containing the helper functions because it is not on the top-level.
|
||||
|
||||
2. Upload the edited create_cloufformation_helper_functions.template to com.gilt.public.backoffice/cloudformation_templates
|
||||
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
{
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
"Parameters": {
|
||||
"S3ZipFileBucket": {
|
||||
"Type": "String",
|
||||
"Description": "The S3 bucket where the .zip file is stored."
|
||||
},
|
||||
"S3ZipFileObjectKey": {
|
||||
"Type": "String",
|
||||
"Description": "The object key (including any 'folder prefix') of the .zip file containing the lambda functions."
|
||||
}
|
||||
},
|
||||
"Resources": {
|
||||
"DynamoDBPutItemsFunctionRole": {
|
||||
"Type": "AWS::IAM::Role",
|
||||
|
@ -66,8 +56,8 @@
|
|||
"Type": "AWS::Lambda::Function",
|
||||
"Properties": {
|
||||
"Code": {
|
||||
"S3Bucket": { "Ref": "S3ZipFileBucket" },
|
||||
"S3Key": { "Ref": "S3ZipFileObjectKey" }
|
||||
"S3Bucket": "com.gilt.public.backoffice",
|
||||
"S3Key": "lambda_functions/cloudformation-helpers.zip"
|
||||
},
|
||||
"Description": "Used to populate a DynamoDB database from CloudFormation",
|
||||
"Handler": "cloudformation_helpers.dynamoDBPutItems",
|
Loading…
Add table
Reference in a new issue