Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Maintaining an open source library of productio...

Michael Wittig
September 28, 2017

Maintaining an open source library of production-ready CloudFormation templates

CloudFormation is the standard to provision AWS resources. But developing a template is a lot of work. Let’s speed up development and maintenance by working together on high-quality templates: Reviewed by certified experts, secure, highly available, scalable, easy to deploy and update, built-in monitoring and logging; As a maintainer of https://github.com/widdix/aws-cf-templates I will
share what I learned by answering the following questions: What is a
production-ready template? How to reuse templates? How to modularize
templates? How to keep stacks updated? How to assure that templates are
working? How to create a sustainable library?

Michael Wittig

September 28, 2017
Tweet

More Decks by Michael Wittig

Other Decks in Technology

Transcript

  1. What do I do? 3 Independent consultant focusing on AWS

    & DevOps https://widdix.net Writer Amazon Web Services in Action (Manning, 2nd ed) & https://cloudonaut.io AWS
  2. 6 Production-ready Reviewed by experts Pull Requests by default. Automated

    test suite verifies templates on every change and weekly. Secure Keep security groups as tight as possible, avoid * in IAM policies, bastion host, IAM SSH, keep AMIs up-to-date... Highly available No single point of failures by default or documented limitations. Scalable EC2 instances are auto scaled by default or documented limitations. Easy to deploy and update Everything is in CloudFormation. Built-in monitoring and logging Log files are shipped to CloudWatch Logs. Important metrics are monitored with CloudWatch Alarms.
  3. 14 Bastion Host × Elastic IP × SSH via IAM

    public SSH key × CloudWatch Logs × CloudWatch Alarms × Security Group × Auto Scaling Group (1:1:1)
  4. 15 Jenkins × Load Balancer × SSH via IAM public

    SSH key × CloudWatch Logs × CloudWatch Alarms × Security Group × EFS File System × Master Auto Scaling Group (1:1:1) × Agent Auto Scaling Group
  5. 18 --- Parameters: ParentVPCStack: Type: String Resources: SecurityGroup: Type: 'AWS::EC2::SecurityGroup'

    Properties: VpcId: 'Fn::ImportValue': !Sub '${ParentVPCStack}-VPC' Outputs: SecurityGroup: Value: !Ref SecurityGroup Export: Name: !Sub '${ AWS::StackName}-SG' vpc-ssh-bastion.yaml
  6. 22 Deploy & test @Test public void test() { KeyPair

    key = this.createKey("key"); this.createStack("vpc", "vpc/vpc-2azs.yaml", [...]); this.createStack("ssh-bastion", "vpc/vpc-ssh-bastion.yaml", [...]); String host = this.getStackOutputValue("ssh-bastion", "IPAddress"); this.probeSSH(host, key); this.deleteStack("ssh-bastion"); this.deleteStack("vpc"); this.deleteKey("key"); }
  7. 23 × CloudFront is super unstable during delete × Use

    unique names to enable parallel tests × Writing your test functions is hard × Expensive regarding AWS costs × Caught many bugs × RDS snapshots are created on deletion, breaking change! Learnings
  8. 4. Keep stacks up-to-date What’s the best way to keep

    stacks up-to-date when new template versions are released? 24
  9. 26 Pipeline App A Stage A App B Stage B

    VPC Alert Bastion VPC Alert Bastion
  10. 31 Sustainable Users 620 stars 224 forks Core Contributors 2

    people 1 company Community Contributions 11 people 52 PRs Sponsor a feature or bug fix Training and Consulting
  11. 33 Templates https://github.com/widdix/aws-cf-templates VPC × Public/Private × Nat Gateway ×

    Route53 Zone * × SSH Bastion Host × Flow Logs × VPC Endpoints ECS × Cluster × Service Security × Auth Proxy (GitHub) × CloudTrail × Config × Password Policy Operations × Alert × DynamoDB backup Applications × Jenkins × WordPress EC2 × Auto Recovery * https://github.com/widdix/aws-cf-templates/pull/122
  12. Roadmap × Dashboards × Update stacks × Improve runtime of

    test suite × Improve Monitoring × Docs are not for newcomers × Load testing tool to fine tune scaling triggers × CLI tool 34
  13. Save 40% 35 Second Edition Use code awstcd17 during checkout

    at www.manning.com × New chapters: Lambda, EFS, ElastiCache × YAML templates × Updated everything Code expires on October 8, 2017
  14. Credits Special thanks to all the people who made and

    released these awesome resources for free: × Presentation template by SlidesCarnival × Photographs by Pexels and Unsplash × Watercolor textures by GraphicBurguer 37