You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to be able to deploy using the scripts provided by npm scripts for AWS ECS make sure your user is part of an IAM Group that has the following inline policy applied to it.
These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to upload and release your Docker images in spectacular, no-downtime, blue-green fashion.
Looking for npm scripts for Docker? Go here!
Don't know how to create your own AWS ECS Cluster? Go here.
aws:login: Using your AWS credentials, gets the Docker for your ECS Container Repository and configures your Docker CLI instance to point at your private repository.
aws:deploy: Kicks-off the blue-green deployment your already published image.
aws:release: Points Docker to your private ECS repository, publishes your latest build image and then kicks-off deployment.
Pre-Requisites
A correctly configured AWS ECS Cluster. Instructions are here.
You'll need your Access Key ID and Secret Access Key
Default region name: us-east-1
Configuring Package.json in 2-steps
Step 1
Make sure to update package.json from when you configured npm scripts for Docker, so that the imageRepo property has the address of your new ECS repository.
In your package.json file, under the config property, add three new properties using your own values, as shown below:
Note the duluca/ecs-deploy-fargate blue-green deployment script is a fork of the original silintl/ecs-deploy image with AWS ECS Fargate support with this PR silinternational/ecs-deploy#129 integrated. Once silintl/ecs-deploy merges this change, I recommend using silintl/ecs-deploy for your blue-green deployments.
Running
You're done. Now run your scripts. To build and publish an image you only need to use two of the commands frequently.
npm run docker:debug: [Test], Build, Tag, Run, Tail and launch your app in a browser to test.
npm run aws:release: Configure Docker with AWS, publish your latest image build and release it on ECS.
Be patient! Things won't work right away. AWS is a complicated beast, however once everything is configured correctly, it is an immensely powerful tool. Go through AWS ECS setup instructions here.