Skip to content

AWS Lambda to rollback ECS deployment. Created with serverless framework and js

License

Notifications You must be signed in to change notification settings

abiydv/serverless-aws-lambda-ecs-rollback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless: AWS Lambda to rollback AWS ECS deployment

CodeFactor

servrless js cli aws-lambda aws-ecs

Serverless framework example to deploy AWS Lambda, which can rollback a ECS deployment to the second last 'active' task definition version. Lambda runtime used - nodejs 8.x

Prerequisites

1. Install serverless. Follow this guide

2. Setup aws cli with profiles matching environments/stages. A sample ~/.aws/credentials file -

[dev]
aws_access_key_id = DEV_ACCESS_KEY
aws_secret_access_key = DEV_SECRET_KEY
[qa]
aws_access_key_id = QA_ACCESS_KEY
aws_secret_access_key = QA_SECRET_KEY
[prod]
aws_access_key_id = PROD_ACCESS_KEY
aws_secret_access_key = PROD_SECRET_KEY

How to use

1. Deploy the service with --stage dev argument to create the dev stack. Use qa or prod to launch function in other environments.

NOTE: Create config-qa.json and config-prod.json with the respective AWS Account Id info.

serverless deploy -v --stage dev

2. Invoke the lambda function

serverless invoke -f rollback -l --stage dev

3. Deploy only the lambda function after any change in lambda code. (Skip if no change)

serverless deploy -f rollback --stage dev

4. Cleanup everything

serverless remove -v --stage dev

Contact

Drop me a note or open an issue if something doesn't work out.

Cheers! 👍

About

AWS Lambda to rollback ECS deployment. Created with serverless framework and js

Topics

Resources

License

Stars

Watchers

Forks