6. Build And Deployment with CodeDeploy
Trigger Build and
deploy
AWS EC2
ServerDev Machine
Deployed
Code Push
+
AWS
CodeDeploy
7. AWS Code Deploy: What we need
Amazon EC2 with CodeDeploy Agent
Amazon S3
AWS CodeDeploy
8. AWS Code Deploy
Getting ready:
Assign proper roles and permissions both to AWS CodeDeploy and EC2
Tag the instance where we want to do deployment
Install agent if not using AMI which already have one
Create Application
Specify Deployment
Group
Specify Deployment
Configration
Upload Revision
DeployCheck Result
9. Life Cycle Events
Agent goes through series of
events
Steps allow us to control
application development
For example: We can close
application cleanly using these
steps.
AppSpec.yml sits in
application’s source directory
which allows us to define
AWS Code Deploy
ApplicationStop
BeforeInstall
AfterInstall
ApplicationStart
ValidateService
Agent
Start
Download
Bundle
Install
End
11. Issues
Build and deployment at same place restrict us from deploying same build
on multiple environments
Need to build multiple times for each environment
Code pushes can happen between different builds for deployment on
different environment
Build and deployment needs to be decoupled
12. Jenkins
Machine
Content with
env conf with
AppSpec.yml
EC2
Machine
Amazon
S3 /
Github
can be
used
CodeDeploy
Deployment
Management
Content
+
AppSpec.y
ml
Deployment
Group
Agent Agent
Agent Agent
Agent Agent
1
2 3
4
AWS Code Deploy
Jenkins
Machine
Build
Application: What we are deploying, a container for revision
Revision: A given version of application
Deployment: A action of deploying
AppSpec file: Describe action need to be taken
Deployment Group: Group of instances
Deployment Configuration: One at a time, Half at a time, All at a time, Custom
Build process using one Jenkins task
Deployment is seperate