Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
AWS CodeDeploy
By Anton Babenko, May 2016
Hi!
Anton Babenko
I enjoy AWS, DevOps and web-development.
I am AWS Certified Solution Architect, SysOps and DevOps.
I wor...
What is AWS CodeDeploy?
Fully managed service which allows deployment to Amazon EC2 and on-premise instances
Requires no m...
Getting started
Install codedeploy agent
Prepare your application (add appspec.yml)
Create archive and register applicatio...
Deploy
Deploy application revision (myapp-v1.0.zip) to deployment group (myapp-prod) according to deployment
configuration...
Execution flow
appspec.yml
version: 0.0
os: linux
files:
- source: Config/config.txt
destination: webapps/Config
- source: source
destina...
codedeploy/playbooks/application_stop.yml
#!/usr/bin/env ansible-playbook
---
- hosts: localhost
gather_facts: false
becom...
Deployment configuration
One at a time
Half at a time
All at once
Custom
Deployment group
Options:
One per environment (development-site, staging-site, production-site)
Blue-green fashion:
produc...
Integrations
Github webhooks
S3 + AWS Lambda
CircleCI, CodeShip, Jenkins, etc
AWS
Auto-scaling
ELB
SNS
Cloudwatch
Cloudtra...
Considerations
S3 bucket and CodeDeploy application should be in the same AWS region
S3 cross-region replication does not ...
Thank you!
Questions ?
Upcoming SlideShare
Loading in …5
×

AWS CodeDeploy - basic intro

310 views

Published on

AWS CodeDeploy basics and getting started. Lightning talk at DevOps Norway meetup 25.5.2016

Published in: Technology
  • Be the first to comment

  • Be the first to like this

AWS CodeDeploy - basic intro

  1. 1. AWS CodeDeploy By Anton Babenko, May 2016
  2. 2. Hi! Anton Babenko I enjoy AWS, DevOps and web-development. I am AWS Certified Solution Architect, SysOps and DevOps. I work as DevOps engineer at Your.MD. I am one of organizers of AWS User Group Norway meetups ( Next meetup - “Big data experience at Schibsted”, 30th of May, 17:30 at MESH ) github.com/antonbabenko linkedin.com/in/antonbabenko anton@antonbabenko.com
  3. 3. What is AWS CodeDeploy? Fully managed service which allows deployment to Amazon EC2 and on-premise instances Requires no modifications to existing code and is technology agnostic Can deploy from Amazon S3 buckets and Github repos Free
  4. 4. Getting started Install codedeploy agent Prepare your application (add appspec.yml) Create archive and register application revision Create archive, upload it to S3 and register application revision: aws deploy push Register application revision (can be combined with ghr): aws deploy register-application-revision Configure target environment (“deployment group”)
  5. 5. Deploy Deploy application revision (myapp-v1.0.zip) to deployment group (myapp-prod) according to deployment configuration (CodeDeployDefault.OneAtATime): aws deploy create-deployment --application-name myapp --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name myapp-prod --description "My app v1.0 deployment to production" --s3-location bucket=myapp-archives,bundleType=zip,key=myapp-v1.0.zip
  6. 6. Execution flow
  7. 7. appspec.yml version: 0.0 os: linux files: - source: Config/config.txt destination: webapps/Config - source: source destination: /webapps/myApp # permissions: # skipped on this example hooks: ApplicationStop: - location: codedeploy/playbooks/application_stop.yml BeforeInstall: - location: codedeploy/playbooks/before_install.yml - location: Scripts/UnzipDataBundle.sh AfterInstall: - location: codedeploy/playbooks/after_install.yml ApplicationStart: - location: codedeploy/playbooks/application_start.yml timeout: 3600 ValidateService: - location: Scripts/MonitorService.sh timeout: 3600 runas: codedeployuser
  8. 8. codedeploy/playbooks/application_stop.yml #!/usr/bin/env ansible-playbook --- - hosts: localhost gather_facts: false become: true tasks: - name: Stop supervisor service ignore_errors: yes supervisorctl: name: "search" state: stopped
  9. 9. Deployment configuration One at a time Half at a time All at once Custom
  10. 10. Deployment group Options: One per environment (development-site, staging-site, production-site) Blue-green fashion: production-site-blue + application revision v1.0 production-site-green + application revision v1.1
  11. 11. Integrations Github webhooks S3 + AWS Lambda CircleCI, CodeShip, Jenkins, etc AWS Auto-scaling ELB SNS Cloudwatch Cloudtrail Terraform
  12. 12. Considerations S3 bucket and CodeDeploy application should be in the same AWS region S3 cross-region replication does not work for private files Solution: Register application revision for each region/bucket individually Take care of created files not managed by CodeDeploy yourself Solution: Use BeforeInstall hook No control of what revision to deploy during ASG scaling activity No straightforward solutions I know, only hacks (wrapper-application, triggers to SNS) Watch out for infinite EC2 restarts during ASG scaling activity Solution: Use ValidateService hook wisely Hint: Test deployments on both running and newly created instances
  13. 13. Thank you! Questions ?

×