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. 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. 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. 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
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
* It can be used to deploy to anything connected to internet where Ruby can be installed
** Free for EC2 instances, 2 cents per deployment for on-premise instances
*** Deployable content can be code, configuration files, packages, anything.