AWS CodeDeploy is an automated deployment service which allows you to deploy your application code automatically to EC2 instances, on-premise systems and Lambda functions
Allows you to quickly release new features, avoid downtime during application deployments, and avoid the risks associated with manual processes
All deployments are completely consistent
Automatically scales with your infrastructure and integrates with various CI/CD tools like Jenkins, GitHub, Atlassian, AWS CodePipeline, as well as config management tools like Ansible, Puppet, and Chef
Two deployment approaches available:
In-Place
Blue/Green
Deployment Options: In-Place Deployment
The application is stopped on each instance (in turn) and the latest revision is installed
The instance is out of service during this time and your capacity will be reduced
If the instances are behind a load balancer, you can configure the load balancer to stop sending requests to the instances which are being upgraded
Also known as rolling update
Can only be used for EC2 and on premise, not lambda
When you need to roll back, the previous verious must be deployed and it is not instant.
Deployment Options: Blue/Green Deployment
New instances are provisioned and the latest revision is installed on the new instances.
Blue represents the active deployment, and green is the new release
The new instances are registered with an Elastic Load Balancer, traffic is then routed to the new instances and the original instances are eventually terminated
Advantages of a Blue/Green deployment are that the new instances can be created ahead of time and the code released to production by simply switching all traffic to the new servers
Switching back to the original environment is faster and more reliable and is just a case of routing the traffic back to the original servers (as long as you haven't already terminated them)
No reduction in capacity or performance
AWS CodeDeploy Terminology
Deployment Group
A set of EC2 instances or Lambda functions to which a new revision of the software is to be deployed
Deployment
The process and components used to apply a new revision
Deployment Configuration
A set of deployment rules as well as success/failure conditions used during a deployment
AppSpec File
Defines the deployment actions you want AWS CodeDeploy to execute
Unique identifier for the application you want to deploy. To ensure the correct combination of revision, deployment configuration, and deployment group are referenced during a deployment
AWS CodeDeploy Exam Tips
AWS Code Deploy is a fully managed automated deployment service and can be used as part of a Continuous Delivery or Continuous Deployment process
Remember the different types of deployment approaches:
In-Place (Rolling Update)
You stop the application on each host and deploy the latest code
EC2 and on premise systems only
To roll back you must re-deploy the previous version of the application
Blue/Green
New instances are provisioned and the new application is deployed to these new instances
Traffic is routed to the new instances according to your own schedule
Supported for EC2, ECS, and Lambda
Roll back is easy
Route the traffic back to the original instances
Blue is the active deployment (old version)
Green is the new release
Swap CNAMEs of the two environments to redirect traffic to the new version at what ever point you want the traffic to be completely redirected to the new environment
Extras
AWS CodeDeploy rolls back deployments by redeploying a previously deployed revision of an application as a new deployment on the failed instances.
This is done first during th rollback process
CodeDeploy Agent can be used for configuring the instances to archive a certain number of revisions
In an EC2/On-Premises deployment, a deployment group is a set of individual instances targeted for a deployment.
A deployment group contains individually tagged instances, Amazon EC2 instances in Amazon EC2 Auto Scaling groups, or both
Study AppSpec hooks!!!
Code Deploy can only provide two deployment types: IN PLACE AND BLUE GREEN
The Code Deploy agent communicates outbound using HTTPS over port 443
The Code Deploy agent is required only if you deploy to EC2 or On Premis