Purpose of this repo is to document and simplify deployment & setup process of Docker-based applications on AWS Elastic Beanstalk.
- AWS IAM Role with access to IAM, EC2, Beanstalk & Elastic Container Registry/Engine and it's access & secret keys. Profile must be set inside
~/.aws/credentials
directory. - Terraform
Dockerrun.aws.json
- AWS Beanstalk standard task definition. Tells Beanstalk which image from ECR it should usedeploy.sh
- script for deploying applications. App must be first set up*.tf
files - Terraform infrastructure definition written in HCL (HashiCorp Configuration Language)clean.sh
- script for cleaning temporary files
- Run
terraform plan -out plan.tfplan
- Fill out Name, Description & environment
- Profile is name of your profile inside
~/.aws/credentials
file (Standard AWS way). Default profile is calleddefault
. You can insert many profiles insidecredentials
file.
- Run
terraform apply plan.tfplan
- this may take up to 15 minutes
Alternatively you can place variables inside terraform.tfvars
file instead of pasting them into CLI input.
terraform destroy
./deploy.sh <appname> <environment> <region> <commit_sha>
For example:
./deploy.sh my-app-name staging us-east-1 f0478bd7c2f584b41a49405c91a439ce9d944657
If you don't have your AWS credentials set as ENV variables:
AWS_ACCOUNT_ID=XX677677XXXX \
AWS_ACCESS_KEY_ID=AKIAIXEXIX5JW5XM6XXX \
AWS_SECRET_ACCESS_KEY=XXXxmxxXlxxbA3vgOxxxxCk+uXXXXOrdmpC/oXxx \
./deploy.sh my-app-name staging us-east-1 f0478bd7c2f584b41a49405c91a439ce9d944657
Edit your circle.yml
file to invoke deploy.sh
script in post.test
or deploy
hook. Don't forget to fill out ENV variables in CircleCI setup.