Skip to content

jeff-pedro/learn-terraform-docker-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Terraform and Docker with AWS provider

This repository builds and deploys a simple application using Terraform to deploy the infrastructure, Docker to build the image, and AWS Elastic Beanstalk to run the container.

Applied Concepts

  • Elastic Bean Stalk (ECS) to run containers.
  • Elastic Container Registry (ECR), repository to store docker images.
  • Terraform Backends, to save states in the cloud.
  • AWS Permissions with role, policies and profile.
  • AWS S3 Bucket to store terraform states and others files.

Useful resources

Explored

Deploy


Infra

  1. Go to
    cd ./env/prod
    
  2. Check
    terraform plan
    
  3. Deploy
    terraform apply
    

Web Interface:

http://<elasticbeanstalk_dns>:80

Update application version

  1. Build new image

    cd ./api
    docker build -t [AWS_ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/production:v1 .
  2. Push image to ECR

     docker push [AWS_ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/production:v1
    
    aws ecr get-login-password --region [REGION] | docker login --username AWS --password-stdin [AWS_ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com
  3. ZIP Dockerfilerun.aws.json

    zip -r production.zip Dockerrun.aws.json
  4. Deploy with Terraform

    terraform init
    terraform apply
  5. Update application version

    aws elasticbeanstalk update-environment --environment production-environment --version-label production

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published