UPLOAD

    1.8K

    CI / CD pipeline with AWS Fargate - 26 September - 10:00

    Published: October 16, 2019

    AWS Loft Istanbul 2019 CI / CD pipeline with AWS Fargate - 26 September - 10:00

    Comments

    CI / CD pipeline with AWS Fargate - 26 September - 10:00

    • 1. CI/CD pipeline with AWS Fargate © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. CI/CD pipeline with AWS Fargate COBUS BERNARD AWS SENIOR TECHNICAL EVANGELIST @cobusbernard -
    • 2. https://slideshare.net/cobusbernard © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. https://slideshare.net/cobusbernard
    • 3. Agenda © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda •Overview of releasing modern apps •Infrastructure as code • CI/CD •Containers on AWS •Workshop •Demo •Questions
    • 4. Experiments power the engine of rapid innovation © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Experiments power the engine of rapid innovation Listen Iterate Experiment Innovation Flywheel
    • 5. Pillars of releasing modern applications © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pillars of releasing modern applications Continuous deployment Continuous integration Infrastructure as code
    • 6. Use code to model applications and infrastructureTreating everything as software increases the speed and agility of infrastructure deployments © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Use code to model applications and infrastructure Treating everything as software increases the speed and agility of infrastructure deployments
    • 7. Use code to model applications and infrastructure Infrastructure as code © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Use code to model applications and infrastructure Infrastructure as code Declarative I tell you what I need I tell you what to do Imperative
    • 8. Use code to model applications and infrastructure Infrastructure as code goals © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Use code to model applications and infrastructure Infrastructure as code goals Infrastructure as code 1.Make infrastructure changes repeatable and predictable 2.Release infrastructure changes using the same tools as code changes 3.Replicate production environment in a staging environment to enable continuous testing
    • 9. Model container environments with AWSCloud Development Kit (CDK) © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Model container environments with AWS Cloud Development Kit (CDK) •Open source framework to define cloud infrastructure in TypeScript, Java, C#, … •Provides library of higher-level resource types (“construct” classes) that have AWS best practices built in by default, packaged as npm modules •Provisions resources with CloudFormation •Supports all CloudFormation resource types AWS CDK https://awslabs.github.io/aws-cdk
    • 10. AWS Cloud Development Kit (CDK) © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Development Kit (CDK) npm install -g aws-cdk cdk init app --language typescript cdk synth cdk diff cdk deploy cdk destroy CodePipeline Use CloudFormation deployment actions with any synthesized CDK application Jenkins Use CDK CLI TypeScript C# F# Java Python …
    • 11. CDK template © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. CDK template High-level VPC class includes VPC, subnets, security groups, internet gateway, NAT gateways, and route tables import ec2 = require('@aws-cdk/aws-ec2'); import ecs = require('@aws-cdk/aws-ecs'); import cdk = require('@aws-cdk/cdk'); class BonjourFargate extends cdk.Stack { constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { super(parent, name, props); const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); new ecs.LoadBalancedFargateService( this, "FargateService", { cluster, image: ecs.DockerHub.image("amazon/amazon-ecs-sample"), }); } } const app = new cdk.App(); new BonjourFargate(app, 'Bonjour'); app.run();
    • 12. CDK template © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. import ec2 = require('@aws-cdk/aws-ec2'); import ecs = require('@aws-cdk/aws-ecs'); import cdk = require('@aws-cdk/cdk'); class BonjourFargate extends cdk.Stack { constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { super(parent, name, props); const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); new ecs.LoadBalancedFargateService( this, "FargateService", { cluster, image: ecs.DockerHub.image("amazon/amazon-ecs-sample"), }); } } const app = new cdk.App(); new BonjourFargate(app, 'Bonjour'); app.run(); High-level Fargate class includes ECS service, ECS task definition, Application Load Balancer, listener rule, target group, and optionally Amazon Route 53 alias record CDK template
    • 13. CDK template © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 22 Lines of TypeScript code generate over 400 lines of CloudFormation syntax CDK template import ec2 = require('@aws-cdk/aws-ec2'); import ecs = require('@aws-cdk/aws-ecs'); import cdk = require('@aws-cdk/cdk'); class BonjourFargate extends cdk.Stack { constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { super(parent, name, props); const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); new ecs.LoadBalancedFargateService( this, "FargateService", { cluster, image: ecs.DockerHub.image("amazon/amazon-ecs-sample"), }); } } const app = new cdk.App(); new BonjourFargate(app, 'Bonjour'); app.run();
    • 14. Rapidly release High Quality Features with CI/CD © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Rapidly release High Quality Features with CI/CD
    • 15. Rapidly release high-quality features with CI/CDTeams that practice CI/CD ship more code faster, and with more confidence © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Rapidly release high-quality features with CI/CD Teams that practice CI/CD ship more code faster, and with more confidence Source: Puppet 2017 State of DevOps Report 5x Lower change failure rate 440x Faster from commit to deploy 46x More frequent deployments 44% More time spent on new features & code
    • 16. Release process stages © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Release process stages Continuous deployment
    • 17. Rapidly release high-quality features with CI/CD Microservice development lifecycle © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. developers services monitor release test build delivery pipelines monitor release test build monitor release test build monitor release test build monitor release test build monitor release test build Rapidly release high-quality features with CI/CD Microservice development lifecycle
    • 18. Containers and Docker © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Containers and Docker A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.1 1 https://www.docker.com/resources/what-container Server Operating System Docker Engine App A App B App C App D
    • 19. Build with serverless technologies as much as possibleAWS container services landscape © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Build with serverless technologies as much as possible AWS container services landscape Management Deployment, Scheduling, Scaling & Management of containerized applications Hosting Where the containers run Amazon Elastic Container Service Amazon Elastic Container Service for Kubernetes Amazon EC2 AWS Fargate Image Registry Container Image Repository Amazon Elastic Container Registry
    • 20. Amazon ECS key components © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon ECS key components Development cluster Container instance Container instance Container instance Production cluster Container instance Container instance Container instance Amazon Elastic Container Service (Amazon ECS) Container Container Volume Task definition Amazon Elastic Container Registry
    • 21. EKS Architecture © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. mycluster.eks.amazonaws.com Availability Zone 1 Availability Zone 2 Availability Zone 3 Kubectl EKS Architecture
    • 22. Workshop, let’s build! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Workshop, let’s build!
    • 23. https://ecsworkshop.com © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. https://ecsworkshop.com
    • 24. Demo! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Demo!
    • 25. AWS CodePipeline © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS CodePipeline
    • 26. Architecture © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Architecture
    • 27. Security - IAM Roles © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Security - IAM Roles
    • 28. Slide1175 Thank you! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. COBUS BERNARD AWS SENIOR TECHNICAL EVANGELIST @cobusbernard -
    • 29. Slide3 © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Please Complete Your Session Survey! WORKSHOP: CI/CD Pipeline on Amazon ECS https://bit.ly/2mcnW7X