Skip to content

Instantly share code, notes, and snippets.

@teekaay
Created May 10, 2018 19:50
Show Gist options
  • Select an option

  • Save teekaay/e3274c31efd3d0a5c5a6f3ade6afbb71 to your computer and use it in GitHub Desktop.

Select an option

Save teekaay/e3274c31efd3d0a5c5a6f3ade6afbb71 to your computer and use it in GitHub Desktop.
Shell script to package and deploy a serverless app using AWS::Serverless transform
#!/usr/bin/env bash
set -e
STACK_TAGS="team=team environment=prod"
aws cloudformation deploy \
--template-file cf-templates/resources.yaml \
--stack-name mystack-prod-resources \
--capabilities CAPABILITY_IAM \
--tags "$STACK_TAGS" \
--no-fail-on-empty-changeset
LAMBDA_BUCKET=$(aws cloudformation list-exports --query "Exports[?Name==\`mystack-prod-resources-lambda-bucket-name\`].Value" --output text)
aws cloudformation package \
--template-file cf-templates/sam.yaml \
--s3-bucket $LAMBDA_BUCKET \
--output-template-file sam-new.yaml
aws cloudformation deploy \
--template-file sam-new.yaml \
--stack-name mystack-prod-service \
--s3-bucket $LAMBDA_BUCKET \
--capabilities CAPABILITY_IAM \
--tags "$STACK_TAGS" \
--no-fail-on-empty-changeset \
--parameter-overrides ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment