Continuous Integration and Deployment Best Practices on AWS

  • 436 views
Uploaded on

AWS Summit 2014 Brisbane - Breakout 5 …

AWS Summit 2014 Brisbane - Breakout 5

With AWS companies now have the ability to develop and run their applications with speed and flexibility like never before. Working with an infrastructure that can be 100% API driven enables businesses to use lean methodologies and realize these benefits. This in turn leads to greater success for those who make use of these practices. In this session we'll talk about some key concepts and design patterns for Continuous Deployment and Continuous Integration, two elements of lean development of applications and infrastructures.

Presenter: Adrian White, Solutions Architect, Amazon Web Services

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
436
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. © 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc. Continuous Integration and Deployment Best Practices on AWS Adrian White Solutions Architect, Amazon Web Services
  • 2. Innovation, Quality, Governance
  • 3. Stacks / Environment(s) An example CI / CD workflow CI/CD tool Issue Tracker SCM Infrastructure automation / deployment Test tools / harnesses
  • 4. CloudFormation Stack(s) An example CI / CD workflow PHPUnit jQuery … Tasks for AWS
  • 5. A CI / CD pipeline Teardown Release Deploy Test Code
  • 6. Get your source under control Prod Phoenix (feature)UAT Code Test Deploy Release Teardown Code Test Deploy Release Teardown Code Test Deploy Release Teardown Code Test Deploy Release Teardown
  • 7. Automated Merging UAT Feature 2Feature 1
  • 8. What does CI give us? •  Test driven promotion (of development change) •  Increasing velocity of feedback cycle through iterative change •  Contain change to reduce risk •  Bugs are detected quickly •  Automated testing reduces size of testing effort
  • 9. What does CD give us? •  Changes are pushed quickly to production •  Immediate feedback from users •  Supports A/B testing or “We test customer reactions to features in production” •  Hardens, de-risks the deployment process •  Gives us a breadth of data points across our applications
  • 10. Deployment approaches •  Deploy in place –  Manage interruption •  Bake –  Discrete environment •  Multiple environments from branches •  Support A/B testing •  “Rolling DNS” Deploy Deploy in-place Bake
  • 11. Deploy in-place Un-baked •  Common baseline AMI •  Customise at instantiation •  Change in-place Your app AMI
  • 12. Deploy in-place Un-baked •  Common baseline AMI •  Customise at instantiation •  Change in-place Your app AMI
  • 13. Deploy in-place Un-baked •  Common baseline AMI •  Customise at instantiation •  Change in-place Your app AMI
  • 14. Deploy in-place Un-baked •  Common baseline AMI •  Customise at instantiation •  Change in-place Your app AMI
  • 15. Deploy in-place Un-baked •  Common baseline AMI •  Customise at instantiation •  Change in-place Your app AMI
  • 16. Deploy in-place Un-baked •  Common baseline AMI •  Customise at instantiation •  Change in-place Your app AMI
  • 17. Bake process 1.  Start a builder instance 2.  Bootstrap / cfn-init, cfn-signal 3.  Bake your AMI 4.  Tag it 5.  Destroy/clean up the builder instance
  • 18. cfn-init "AWS::CloudFormation::Init" : { “cfn” : { "packages" :{ "yum" : { "httpd" : [] } }, "files":{ “/home/ec2-user/myfile.html:{ "source" : { "Fn::Join" : [ "", ["https://s3-ap- southeast-2.amazonaws.com/",{ "Ref" : "S3Bucket" },”/myfile.html”]] }, "mode":"000644", "owner":"root", "group":"root", "authentication":"S3AccessCreds” },
  • 19. cfn-init "services": { "sysvinit" : { "httpd" : { "enabled" : "true", "ensureRunning" : "true" } } } }
  • 20. Release awssummit-1.com awssummit-2.com awssummit.com
  • 21. Release Release Test the new stack Match the traffic between the two stacks Update the “floating” DNS record Send Notification(s) ROLLBACK
  • 22. Blue green deployment awssummit-1.com awssummit-2.com awssummit.com
  • 23. Blue green deployment awssummit-1.com awssummit-2.com awssummit.com
  • 24. Blue green deployment awssummit-1.com awssummit-2.com awssummit.com
  • 25. Blue green deployment awssummit-1.com awssummit-2.com awssummit.com
  • 26. Teardown Teardown Ensure that no traffic is moving though ELB Teardown the CloudFormation Stack Deregister the AMI
  • 27. Advanced Techniques •  Managing CD sprawl / Segregation of duties •  Extending CloudFormation with custom resources •  Extending your CD tools
  • 28. Stack chaining
  • 29. Stack chaining
  • 30. Stack chaining
  • 31. CloudFormation Merging Git Git CloudFormation Operations Repo Application Repo VPC Subnets Security Groups CloudFormation Frameworks Best Practice Application Code Application CloudFormation Load Balancing Setup
  • 32. CloudFormation Custom Resources •  Change DB schema during deployment •  Extend CloudFormation to support other services - “So You Think You Are An AWS Ninja” talk https://github.com/aws/aws-cfn-resource-bridge https://github.com/awslabs/aws-cfn-custom-resource-examples Parameters Custom resource implementation Git
  • 33. Custom resources – DatabaseSchema "MyDBSchema" : { "Type" : "Custom::DatabaseSchema”, "Version" : "1.0", "Properties" : { "ServiceToken": "arn:aws:sns:us-east-1:12345EXAMPLE:DBSchema", "databaseChangeLog" : [ { "changeSet" : { "id" : "1", "author" : "adamthom", "changes" : [ { "createTable" : { … } } ] } } } }
  • 34. Custom resources – DatabaseSchema "createTable" : { "tableName" : "example", "columns" : [ { "column" : { "name" : "id", "type" : "int", "autoIncrement" : true, "constraints" : { "primaryKey" : true, "nullable" : false } } } ] }
  • 35. Extending your CD tools Tasks for AWS DynamoDB
  • 36. Situational Awareness Burden of Responsibility APIs Tasks for AWS
  • 37. Containerisation •  Build environments for artifacts, don’t update environments with artifacts •  All environments are transient •  Standardisation, abstraction and portability
  • 38. Docker, Amazon Linux and Elastic Beanstalk •  A framework for managing containers •  LXC containers are more lightweight than VMs •  Amazon Linux (2014.03) bundles Docker 0.9 and LXC 0.9 •  Docker containers on Beanstalk are Go!
  • 39. Innovation, Quality, Governance Discrete environments for each branch Automated testing on every commit on every branch Leverage CD tools to provide separation of duties Audit Logs Git approvals process Use custom resources to extend CloudFormation Leverage DNS Interface with the API Environments for artifacts
  • 40. Expand your skills with AWS Certification aws.amazon.com/certification Exams Validate your proven technical expertise with the AWS platform On-Demand Resources aws.amazon.com/training/ self-paced-labs Videos & Labs Get hands-on practice working with AWS technologies in a live environment aws.amazon.com/training Instructor-Led Courses Training Classes Expand your technical expertise to design, deploy, and operate scalable, efficient applications on AWS