learn to sleep easy with aws...
TRANSCRIPT
![Page 1: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/1.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Deployments got you up all night?Learn to sleep easy with AWS codedeploy
Adam DockterVP of Engineering
ServiceTarget
![Page 2: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/2.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Who are we?
Small Company 4 Developers
AWS Infrastructure
NO QA!!
![Page 3: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/3.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
About our product
Self service web application deployed on AWS
![Page 4: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/4.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Goal of this Session
Deploying To Production
Before After
![Page 5: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/5.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
AssumptionsBasic understanding of AWS concepts
IAMEC2S3
AWS CLI Autoscaling ELB
![Page 6: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/6.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Codedeploy
EC2S3
![Page 7: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/7.jpg)
1. Deregister from ELB
2. Stop service
3. Update data storage
4. Run utility scripts
5. Secure copy files
6. Start services
7. Register to ELB
8. Run validation
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Complexity of deployments
Environments
1. Dev
2. QA
3. Production
EC2 Instances
- at least 3
72
![Page 8: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/8.jpg)
1. Deregister from ELB
2. Stop service
3. Update data storage
4. Run utility scripts
5. Secure copy files
6. Start services
7. Register to ELB
8. Run validation
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Complexity of deployments
Environments
1. Dev
2. QA
3. Production
EC2 Instances
- at least 3
Repetitive Work
Low Value Work
Time consuming
Human Error
Bad Hours
![Page 9: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/9.jpg)
1. Deregister from ELB
2. Stop service
3. Update data storage
4. Run utility scripts
5. Secure copy files
6. Start services
7. Register to ELB
8. Run validation
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Complexity of deployments
Environments
1. Dev
2. QA
3. Production
EC2 Instances
- at least 3
![Page 10: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/10.jpg)
1. Deregister from ELB
2. Stop service
3. Update data storage
4. Run utility scripts
5. Secure copy files
6. Start services
7. Register to ELB
8. Run validation
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Complexity of deployments
Environments
1. Dev
2. QA
3. Production
EC2 Instances
- at least 3
![Page 11: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/11.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Codedeploy
EC2S3
![Page 12: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/12.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
EC2
AMI
Auto Scaling Group
EC2
● Installed Node JS
● Installed AWS Codedeploy Agent
ELBCode
Deploy
Launch
Configuration
Deployment
Group
Target
Group
![Page 13: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/13.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Deployment Group
Deployment Group
EC2 EC2 EC2
one at a time
EC2
Notes
● Application changes are backward
compatible
● Able to keep most services running
to continue to service load needs
![Page 14: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/14.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Deployment Group
Deployment Group
EC2 EC2 EC2 EC2
Notes
● Backward compatibility not required
● Lose half of your service bandwidth,
require low traffic time
half at a time
![Page 15: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/15.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Deployment Group
Deployment Group
EC2 EC2 EC2 EC2
Notes
● Backward compatibility not required
● Downtime required
● Fastest
all at once
![Page 16: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/16.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Deployment Group
Deployment Group
EC2 EC2 EC2EC2 EC2 EC2
Notes
● Backward compatibility not required,
for all scenarios
● Requires autoscaling and launch
configurations
blue / green
![Page 17: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/17.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Codedeploy
EC2S3
![Page 18: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/18.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Deployment Package
Folder contain
artifacts that need
deployed
Folder containing
lifecycle scripts to run
File containing
instructions on what
to do and when
S3
![Page 19: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/19.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
version: 1.2
os: linux
files:
- source: content/ServiceTarget-1.2.tgz
destination: /var/app-server
- source: content/newrelic
destination: /opt/newrelic
hooks:
ApplicationStop:
- location: scripts/deregisterElb.sh
runas: awsDeploy
- location: scripts/stopLogstash.sh
runas: awsDeploy
- location: scripts/stopApiServer.sh
runas: awsDeploy
AfterInstall:
- location: scripts/unpackApiSnapshot.sh
runas: awsDeploy
- location: scripts/updateApiConfig.sh
runas: awsDeploy
- location: scripts/startLogstash.sh
runas: awsDeploy
ApplicationStart:
- location: scripts/startApiServer.sh
runas: awsDeploy
- location: scripts/registerElb.sh
runas: awsDeploy
![Page 20: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/20.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
version: 1.2
os: linux
files:
- source: content/ServiceTarget-1.2.tgz
destination: /var/app-server
- source: content/newrelic
destination: /opt/newrelic
hooks:
ApplicationStop:
- location: scripts/deregisterElb.sh
runas: awsDeploy
- location: scripts/stopLogstash.sh
runas: awsDeploy
- location: scripts/stopApiServer.sh
runas: awsDeploy
AfterInstall:
- location: scripts/unpackApiSnapshot.sh
runas: awsDeploy
- location: scripts/updateApiConfig.sh
runas: awsDeploy
- location: scripts/startLogstash.sh
runas: awsDeploy
ApplicationStart:
- location: scripts/startApiServer.sh
runas: awsDeploy
- location: scripts/registerElb.sh
runas: awsDeploy
Deployment version
Operating System
![Page 21: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/21.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
version: 1.2
os: linux
files:
- source: content/ServiceTarget-1.2.tgz
destination: /var/app-server
- source: content/newrelic
destination: /opt/newrelic
hooks:
ApplicationStop:
- location: scripts/deregisterElb.sh
runas: awsDeploy
- location: scripts/stopLogstash.sh
runas: awsDeploy
- location: scripts/stopApiServer.sh
runas: awsDeploy
AfterInstall:
- location: scripts/unpackApiSnapshot.sh
runas: awsDeploy
- location: scripts/updateApiConfig.sh
runas: awsDeploy
- location: scripts/startLogstash.sh
runas: awsDeploy
ApplicationStart:
- location: scripts/startApiServer.sh
runas: awsDeploy
- location: scripts/registerElb.sh
runas: awsDeploy
File locations in your
archive file and where
they should go on the EC2
instance
![Page 22: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/22.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
version: 1.2
os: linux
files:
- source: content/ServiceTarget-1.2.tgz
destination: /var/app-server
- source: content/newrelic
destination: /opt/newrelic
hooks:
ApplicationStop:
- location: scripts/deregisterElb.sh
runas: awsDeploy
- location: scripts/stopLogstash.sh
runas: awsDeploy
- location: scripts/stopApiServer.sh
runas: awsDeploy
AfterInstall:
- location: scripts/unpackApiSnapshot.sh
runas: awsDeploy
- location: scripts/updateApiConfig.sh
runas: awsDeploy
- location: scripts/startLogstash.sh
runas: awsDeploy
ApplicationStart:
- location: scripts/startApiServer.sh
runas: awsDeploy
- location: scripts/registerElb.sh
runas: awsDeploy
Life cycle hooks:
1. ApplicationStop
2. BeforeInstall
3. AfterInstall
4. ApplicationStart
5. ValidateService
Life cycle hooks:
1. ApplicationStop
2. BeforeInstall
3. AfterInstall
4. ApplicationStart
5. ValidateService
Life cycle hooks:
1. ApplicationStop
2. BeforeInstall
3. AfterInstall
4. ApplicationStart
5. ValidateService
Scripts:
1. location
2. timeout
3. runas
![Page 23: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/23.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Life cycle and hooks
Start
ConsoleAWS CLI/SDK
Auto Scale
Download Bundle
Github
S3
Bitbucket
Before Install
Hook
Install
Files from AppSpec
Validate Service
Hook
End
ApplicationStop
Hook
*Not on 1st app deployment
After Install
Hook
Application StartHook
![Page 24: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/24.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
DEMO TIME!
![Page 25: Learn to sleep easy with AWS codedeployfiles.informatandm.com/...you_up_at_Night...AWS_Codedeploy_Adam… · Installed AWS Codedeploy Agent ELB Code Deploy Launch Configuration Deployment](https://reader035.vdocuments.mx/reader035/viewer/2022071216/60471b89e505f60911218182/html5/thumbnails/25.jpg)
#ITDEVCONNECTIONS | ITDEVCONNECTIONS.COM
Questions?