viveksangi / Terraform_withcontainers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PREREQUISIITE - Create a repo in aws ECR with name - > django-app

IMPORTANT - Once the repo is create change the 600735812827.dkr.ecr.us-west-1.amazonaws.com IN COMMANDS TO THE REPO OF YOURS

  1. Change the docker_image_url_django in VARIABLES.TF file with

  2. Change the policy file paths in iam.tf and variables.tf file

  3. aws ecr get-login-password --region us-west-1 | docker login --username AWS --password-stdin

  4. cd app/

  5. docker build -t /django-app:latest .

6)docker push /django-app:latest

  1. Go to terraform folder and hit this below command

ssh-keygen -f california-region-key-pair

terraform init

terraform plan -out terraform.out

terraform apply "terraform.out"

  1. pip install boto3 click

  2. export AWS_ACCESS_KEY_ID=""

  3. export AWS_SECRET_ACCESS_KEY=""

  4. export AWS_DEFAULT_REGION="us-west-1"

12 ) cd deploy folder

Run command in deploy folder - python3 update-ecs.py --cluster=production-cluster --service=production-service

13 ) terraform destroy

About


Languages

Language:HCL 56.8%Language:Python 37.7%Language:Smarty 3.2%Language:Dockerfile 2.3%