Skip to content

Artemmkin/codedeploy-terraform

Repository files navigation

CodeDeploy with Terraform Demo

  1. Generate an SSH key pair:
$ ssh-keygen -t rsa -f ~/.ssh/code-deploy-demo -C cd-demo -P ""
  1. Run terraform:
$ terraform init
$ terraform apply

Resources will be created in eu-west-1 region by default. Change region var if you want another region.

  1. From the output get the name of the s3 bucket created. If you get an output like this:
codedeploydemo-734.s3.amazonaws.com

then the name of the created bucket is codedeploydemo-734. Save this bucket name, you will upload the sample application revision to that bucket.

  1. Change directory into sample-app. And run the following command to create application revision and upload it to S3 bucket (make sure to change the name of the bucket [and region if you changed it in terraform]).
$ cd sample-app
$ aws --region eu-west-1 deploy push \
    --application-name Sample_App \
    --s3-location s3://codedeploydemo-734/SampleApp.zip

This command bundles the files from the current directory into a single archive file named SampleApp.zip, uploads the revision to the codedeploydemo-734 bucket, and registers information with AWS CodeDeploy about the uploaded revision.

  1. Create a deployment (make sure to change the name of the bucket [and region if you changed it in terraform]):
$ aws --region eu-west-1 deploy create-deployment \
    --application-name Sample_App \
    --deployment-config-name CodeDeployDefault.OneAtATime \
    --deployment-group-name Sample_DepGroup \
    --s3-location bucket=codedeploydemo-734,bundleType=zip,key=SampleApp.zip
  1. Access the Sample application by instace's public IP. Get the instance's public IP from terraform output and put it in your browser.

About

CodeDeploy demo using Terraform and Sample application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published