Skip to main content
  1. Projects/
  2. Certification: AWS DevOps Pro/
  3. 1: SDLC Automation/

3: CodeDeploy

0: Overview

··1 min

What is it?

  • Automates application deployments to various servers:
    • Ec2 instances
    • On-prem instances
    • Lambda functions
    • ECS services

What can you deploy?

  • Code:
    • Java, C#, Lambda Funcs
    • Web and config files
    • Execs, pkgs, scripts
  • Also multimedia files

Where do deployables come from?

  • GitHub / BitBucket
  • S3
  • CodeCommit via S3

Where can we deploy to?

  • Ec2 Placement Group
  • Single ec2 instance
  • Auto-scaling group
  • Potentially cross-region

How to get set up?

  • Have IAM user with CodeDeploy access (so you can use the service)
  • Create IAM instance profile (so ec2 can fetch artifacts from S3)
  • Create IAM service role(s) (so CodeDeploy can work with other AWS services like KMS)
    • Separate roles for lambda, ecs, ec2

1: Setup & Config

·1 min

What are revisions?

  • The package type things we deploy in CodeDeploy

What’s the Deployment Configuration?

  • Specifies how to deploy, and at what rate
    • Disaster recovery?
  • Deployment method determines rate of deployment

What’s a Deployment Group?

  • It’s where we deploy to.
  • Could be a single instance or many
    • Could be one of many OS’es
  • Could also be Lambda or ECS

How do we bring in some automation?

  • EventBridge to monitor deployments
    • Create an SNS topic to subscribe to
    • Make a Lambda to do stuff with e.g. Slack

2: App, Groups, Configs

·1 min

What is a CodeDeploy “application”?

  • A name identifier used reference your deployment settings.

“Deployment Group”?

  • Instance(s) where you want to target and deploy your code.
    • This could be even just one instance..!
    • Instance must have CodeDeploy agent installed in User Data

“Deployment Configuration”?

  • Set of rules and success/fail conditions used during deploy
  • May vary depending on deployment medium (e.g. on-prem vs. lambda)
  • Might specify e.g. # of instances that must remain avail during deploy
    • “Minimum healthy host” value (can be %)

What’s the order of ops for deploy?

  1. Create the “application”
  2. Specify deployment group
  3. Specify deploy config
    • With “Min healthy hosts”
  4. Upload our “revision” (the pkg to deploy)
  5. Deploy
  6. Check results
  7. Redeploy as needed

What are the Default Deployment Options?

  • One at a time
  • All at once
  • Half at once

More details on deploy configs can be found here.