SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Pahud Hsieh(謝洪恩), Solutions Architect
Aug 01, 2017
Hong Kong
Amazon ECS Advanced Workshop
What to Expect from the Workshop
• Introduction to ECS
• Lab1 Getting Started with ECS and
CloudFormation
• Lab2 ECS Windows Container
• Lab3 ECS CI/CD
• Lab4 ECS service autoscaling and host
autoscaling
• Lab5 Log consolidation
What to Expect from the Workshop
• Lab6 ECS Events
• Lab7 Spot Fleet support
• Lab8 host scale in with container draining
• Lab9 credentials management
• Lab10 ECS Service with external and internal
ALB
• Lab11 service discovery with etcd3
• Q & A
Prerequisite
• AWS Account (personal preferred)
• IAM User with AdministratorAccess policy
Amazon ECS: Under the Hood
Amazon ECS: Under the Hood
ALB ALB
AZ 1 AZ 2
user / scheduler
Scheduler
Cluster State Service
Placement Engine
Event Stream
https://github.com/pahud/ecs-cfn-refarch
Lab1 – ECS with CloudFormation
Lab2 – ECS with Windows Container
Lab3 – ECS CI/CD
Deploying Docker Containers
Amazon EC2 Container Service (ECS)
EC2 INSTANCES
ECS
AGENT
ECS
AGENT
Amazon
ECS
ECS
AGENT
DEPLOYMENT
AUTOMATION
Deployment – In Place – Doubling
Availability Zone Availability Zone
Scenario
Service’s task definition is
updated to a new revision with
parameters:
Desired Count = 2
Minimum Healthy Percent = 100%
Maximum Percent = 200%
These settings permit the service
to grow to double its desired size
during deployment
EXISTING EXISTING
Deployment – In Place – Doubling
Availability Zone Availability Zone
Two new tasks are started
growing the number of tasks to
200% of its desired count which is
the maximum permitted
EXISTING EXISTINGNEW NEW
Desired Count = 2
Minimum Healthy Percent = 100%
Maximum Percent = 200%
Deployment – In Place – Doubling
Availability Zone Availability Zone
After the new tasks are verified to
be healthy by the Elastic Load
Balancer health check, the two
previous tasks with the older task
definition are drained and stopped
NEW NEW
Desired Count = 2
Minimum Healthy Percent = 100%
Maximum Percent = 200%
Deployment – In Place – Rolling
Availability Zone Availability Zone
Scenario
Service’s task definition is
updated to a new revision with
parameters:
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
These settings constrain the
service to not exceed its desired
size but allows it to halve the
number of tasks during
deployment
EXISTING EXISTING
Deployment – In Place – Rolling
Availability Zone Availability Zone
First, an existing task is stopped
which brings the healthy
percentage of the service to 50%
and makes room on the cluster for
new tasks
EXISTING
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
Deployment – In Place – Rolling
Availability Zone Availability Zone
A task using the new task
definition is started bringing the
service back to 100%
EXISTING
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
NEW
Deployment – In Place – Rolling
Availability Zone Availability Zone
After the new task is verified to be
healthy by the Elastic Load
Balancer health check, the next
existing task with the older task
definition is drained and stopped
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
NEW
Deployment – In Place – Rolling
Availability Zone Availability Zone
The second new task is started on
the cluster bringing the service
back to 100%
NEW NEW
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
Deployment – Canary
Availability Zone Availability Zone
Scenario
The new revision runs as a small
subset of production by deploying
a canary service in the same
target group
Deployment is completed by
updating the primary service’s
task definition and scaling down
the canary service. EXISTING EXISTINGEXISTING
Deployment – Canary
Availability Zone Availability Zone
A standalone service with the new
task definition is deployed using
the same Application Load
Balancer target group of the
existing service
EXISTING EXISTINGEXISTING CANARY
Deployment – Canary
Availability Zone Availability Zone
After some period of monitoring
the metrics from the canary
instance, the existing service’s
task definition is updated to the
new revision
NEW NEWNEW CANARY
Deployment – Canary
Availability Zone Availability Zone
After the deployment, all tasks are
running the same task definition
with the new revision of the
application and the canary can be
destroyed
NEW NEWNEW
Deployment – Blue/Green – DNS Swap
Availability Zone
EXISTING EXISTING
www.myproduct.com
Scenario
Two services are defined each
with their own Application Load
Balancer
Deployment is completed by
swapping the Route 53 alias
record between the two
Application Load Balancers
Availability Zone
Deployment – Blue/Green – DNS Swap
Availability Zone
EXISTING EXISTING
www.myproduct.com
An identical Application Load
Balancer and a service with a task
definition using the new revision is
deployed
Availability Zone
NEW NEW
next.myproduct.com
Deployment – Blue/Green – DNS Swap
Availability Zone
EXISTING EXISTING
next.myproduct.com
After automated or manual
testing, the deployment is
completed by swapping the Route
53 alias record between the two
Application Load Balancers
Availability Zone
NEW NEW
www.myproduct.com
Deployment – Blue/Green – DNS Swap
Availability Zone
The previous service and its
Application Load Balancer can
then be destroyed
Availability Zone
NEW NEW
www.myproduct.com
Deployment – Blue/Green – Target Group Swap
Availability Zone
EXISTING EXISTING
Scenario
Two services are defined each
with their own target group
registered in the same Application
Load Balancer using Host-based
routing
Deployment is completed by
swapping the listener rules
between the two target groups
Availability Zone
Deployment – Blue/Green – Target Group Swap
Availability Zone
EXISTING EXISTING
The second service is deployed
with a new target group and
registered to the same Application
Load Balancer
Using Host-based routing, requests
to www.myproduct.com are
directed to our blue service while
requests to next.myproduct.com
are directed to our green service NEW NEW
Availability Zone
Deployment – Blue/Green – Target Group Swap
Availability Zone
After automated or manual testing,
the deployment can be completed
by swapping the listener rules on
the Application Load Balancer and
sending traffic to the green service
NEW NEW
Availability Zone
EXISTING EXISTING
Deployment – Blue/Green – Target Group Swap
Availability Zone
The previous service and its target
group can then be destroyed
NEW NEW
Availability Zone
Best Practices
• In-place Doubling – beware the CPU and
Memory reservation with host autoscaling
ahead
• Monitor the health of ecs-agent
• Monitor your CloudWatch metrics and Logs
• Canary deployment – test your pilot
workload with the same backend capacity
• Prepare your rollback plan
Lab4 – ECS Service and Host Autoscaling
Lab5 – Log Consolidation
Best Practices
• CloudWatch Logs Agent
1. In the same Docker image
2. In the same Task Definition
3. Standalone task with distinct
placement
• Alternative – Fluentd
Lab6 – ECS Events
Takeaways
• Monitor state changes for containers
and tasks
• On state changes, trigger SNS and
Lambda for advanced coordination or
scheduling
• Monitor cloudtrail logs(API usage) as
well
Lab7 – Spot Fleet Support
Takeaways
• Use lowestPrice allocation strategy for
dev/testing
• Use diversified allocation strategy for
pilot, staging or pre-prod
• Beware of the host termination – you
have no enough time for container
draining
• Be careful to deploy in Production
Lab8 – ASG Scale In and Container Draining
Takeaways
• Container Draining may take up to 5-10
min
• Beware of the draining of batch tasks
• Stay patient and test
Lab9 – Credentials Management
Takeaways
• Restrict the access of parameter and
KMS key in the ECS Task Role
• Use Parameter Hierarchy, Tagging
and Notification
$ aws ssm get-parameter-by-path –path /Dev/Web/Nginx
$ aws ssm get-parameter-by-path –path /Testing/Web/Nginx
$ aws ssm get-parameter-by-path –path /Prod/Web/Nginx –with-encryption
Lab10 – External and Internal ALB
Takeaways
• Use ALB host-based and path-based
routing
• Fanout your task events for multiple
operations – e.g. Route53 update
• We have a PFR for this
feedback and get $25 credits
Q & A
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)
AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)
AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)Amazon Web Services
 
Getting Started with Docker on AWS - DevDay Los Angeles 2017
Getting Started with Docker on AWS - DevDay Los Angeles 2017Getting Started with Docker on AWS - DevDay Los Angeles 2017
Getting Started with Docker on AWS - DevDay Los Angeles 2017Amazon Web Services
 
Getting Started with Docker On AWS
Getting Started with Docker On AWSGetting Started with Docker On AWS
Getting Started with Docker On AWSAmazon Web Services
 
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...Amazon Web Services
 
DevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormation
DevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormationDevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormation
DevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormationAmazon Web Services
 
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...Amazon Web Services
 
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)Amazon Web Services
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)Amazon Web Services
 
CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016
CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016
CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016Amazon Web Services
 
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...Amazon Web Services
 
Dev/Test Environment Provisioning and Management on AWS
Dev/Test Environment Provisioning and Management on AWSDev/Test Environment Provisioning and Management on AWS
Dev/Test Environment Provisioning and Management on AWSShiva Narayanaswamy
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Amazon Web Services
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSAmazon Web Services
 
AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)
AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)
AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)Amazon Web Services
 
Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017Amazon Web Services
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and SchedulingAmazon Web Services
 
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)Amazon Web Services
 

Was ist angesagt? (20)

AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)
AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)
AWS re:Invent 2016: Lessons Learned from a Year of Using Spot Fleet (CMP205)
 
Getting Started with Docker on AWS - DevDay Los Angeles 2017
Getting Started with Docker on AWS - DevDay Los Angeles 2017Getting Started with Docker on AWS - DevDay Los Angeles 2017
Getting Started with Docker on AWS - DevDay Los Angeles 2017
 
Getting Started with Docker On AWS
Getting Started with Docker On AWSGetting Started with Docker On AWS
Getting Started with Docker On AWS
 
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
 
Containers State of the Union
Containers State of the UnionContainers State of the Union
Containers State of the Union
 
DevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormation
DevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormationDevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormation
DevOps on AWS: Deep Dive on AWS Code Services and AWS CloudFormation
 
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
 
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
 
From Monolith to Microservices
From Monolith to MicroservicesFrom Monolith to Microservices
From Monolith to Microservices
 
CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016
CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016
CI/CD on AWS: Deploy Everything All the Time | AWS Public Sector Summit 2016
 
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
 
Dev/Test Environment Provisioning and Management on AWS
Dev/Test Environment Provisioning and Management on AWSDev/Test Environment Provisioning and Management on AWS
Dev/Test Environment Provisioning and Management on AWS
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECS
 
AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)
AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)
AWS re:Invent 2016: 20k in 20 Days - Agile Genomic Analysis (ENT320)
 
Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017Build a Serverless Web Application in One Day - DevDay Austin 2017
Build a Serverless Web Application in One Day - DevDay Austin 2017
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and Scheduling
 
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
 
How to Design for High Availability & Scale with AWS
How to Design for High Availability & Scale with AWSHow to Design for High Availability & Scale with AWS
How to Design for High Availability & Scale with AWS
 

Ähnlich wie Deep Dive with Amazon EC2 Container Service Hands-on Workshop

Building a CICD Pipeline for deploying on Containers
Building a CICD Pipeline for deploying on ContainersBuilding a CICD Pipeline for deploying on Containers
Building a CICD Pipeline for deploying on ContainersAmazon Web Services
 
Building a CI/CD Pipeline For Container Deployment to Amazon ECS
Building a CI/CD Pipeline For Container Deployment to Amazon ECSBuilding a CI/CD Pipeline For Container Deployment to Amazon ECS
Building a CI/CD Pipeline For Container Deployment to Amazon ECSAmazon Web Services
 
Building a CICD pipeline for deploying to containers
Building a CICD pipeline for deploying to containersBuilding a CICD pipeline for deploying to containers
Building a CICD pipeline for deploying to containersAmazon Web Services
 
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017Amazon Web Services
 
Building a CICD Pipeline for Container Deployment to Amazon ECS
Building a CICD Pipeline for Container Deployment to Amazon ECSBuilding a CICD Pipeline for Container Deployment to Amazon ECS
Building a CICD Pipeline for Container Deployment to Amazon ECSAmazon Web Services
 
Building CI/CD Pipelines for Serverless Applications
Building CI/CD Pipelines for Serverless ApplicationsBuilding CI/CD Pipelines for Serverless Applications
Building CI/CD Pipelines for Serverless ApplicationsAmazon Web Services
 
Building A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to ContainersBuilding A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to ContainersAmazon Web Services
 
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...Amazon Web Services
 
Building a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersBuilding a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersAmazon Web Services
 
SRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerSRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerAmazon Web Services
 
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017Amazon Web Services
 
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container DayECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container DayAmazon Web Services Korea
 
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?DATAVERSITY
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSAmazon Web Services
 
Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Harshal Shah
 
Failover-Apachecon-Asia-2022.pptx
Failover-Apachecon-Asia-2022.pptxFailover-Apachecon-Asia-2022.pptx
Failover-Apachecon-Asia-2022.pptxDavidKjerrumgaard1
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵Amazon Web Services Korea
 
CON302_Building a CICD Pipeline for Containers on Amazon ECS
CON302_Building a CICD Pipeline for Containers on Amazon ECSCON302_Building a CICD Pipeline for Containers on Amazon ECS
CON302_Building a CICD Pipeline for Containers on Amazon ECSAmazon Web Services
 
Distributed Performance testing by funkload
Distributed Performance testing by funkloadDistributed Performance testing by funkload
Distributed Performance testing by funkloadAkhil Singh
 
Autonomic Decentralised Elasticity Management of Cloud Applications
Autonomic Decentralised Elasticity Management of Cloud ApplicationsAutonomic Decentralised Elasticity Management of Cloud Applications
Autonomic Decentralised Elasticity Management of Cloud ApplicationsSrikumar Venugopal
 

Ähnlich wie Deep Dive with Amazon EC2 Container Service Hands-on Workshop (20)

Building a CICD Pipeline for deploying on Containers
Building a CICD Pipeline for deploying on ContainersBuilding a CICD Pipeline for deploying on Containers
Building a CICD Pipeline for deploying on Containers
 
Building a CI/CD Pipeline For Container Deployment to Amazon ECS
Building a CI/CD Pipeline For Container Deployment to Amazon ECSBuilding a CI/CD Pipeline For Container Deployment to Amazon ECS
Building a CI/CD Pipeline For Container Deployment to Amazon ECS
 
Building a CICD pipeline for deploying to containers
Building a CICD pipeline for deploying to containersBuilding a CICD pipeline for deploying to containers
Building a CICD pipeline for deploying to containers
 
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
 
Building a CICD Pipeline for Container Deployment to Amazon ECS
Building a CICD Pipeline for Container Deployment to Amazon ECSBuilding a CICD Pipeline for Container Deployment to Amazon ECS
Building a CICD Pipeline for Container Deployment to Amazon ECS
 
Building CI/CD Pipelines for Serverless Applications
Building CI/CD Pipelines for Serverless ApplicationsBuilding CI/CD Pipelines for Serverless Applications
Building CI/CD Pipelines for Serverless Applications
 
Building A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to ContainersBuilding A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to Containers
 
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AW...
 
Building a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersBuilding a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to Containers
 
SRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerSRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and Docker
 
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
 
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container DayECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
 
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECS
 
Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6
 
Failover-Apachecon-Asia-2022.pptx
Failover-Apachecon-Asia-2022.pptxFailover-Apachecon-Asia-2022.pptx
Failover-Apachecon-Asia-2022.pptx
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 
CON302_Building a CICD Pipeline for Containers on Amazon ECS
CON302_Building a CICD Pipeline for Containers on Amazon ECSCON302_Building a CICD Pipeline for Containers on Amazon ECS
CON302_Building a CICD Pipeline for Containers on Amazon ECS
 
Distributed Performance testing by funkload
Distributed Performance testing by funkloadDistributed Performance testing by funkload
Distributed Performance testing by funkload
 
Autonomic Decentralised Elasticity Management of Cloud Applications
Autonomic Decentralised Elasticity Management of Cloud ApplicationsAutonomic Decentralised Elasticity Management of Cloud Applications
Autonomic Decentralised Elasticity Management of Cloud Applications
 

Mehr von Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Mehr von Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Deep Dive with Amazon EC2 Container Service Hands-on Workshop

  • 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Pahud Hsieh(謝洪恩), Solutions Architect Aug 01, 2017 Hong Kong Amazon ECS Advanced Workshop
  • 2. What to Expect from the Workshop • Introduction to ECS • Lab1 Getting Started with ECS and CloudFormation • Lab2 ECS Windows Container • Lab3 ECS CI/CD • Lab4 ECS service autoscaling and host autoscaling • Lab5 Log consolidation
  • 3. What to Expect from the Workshop • Lab6 ECS Events • Lab7 Spot Fleet support • Lab8 host scale in with container draining • Lab9 credentials management • Lab10 ECS Service with external and internal ALB • Lab11 service discovery with etcd3 • Q & A
  • 4. Prerequisite • AWS Account (personal preferred) • IAM User with AdministratorAccess policy
  • 5. Amazon ECS: Under the Hood
  • 6. Amazon ECS: Under the Hood ALB ALB AZ 1 AZ 2 user / scheduler Scheduler Cluster State Service Placement Engine Event Stream
  • 8. Lab1 – ECS with CloudFormation
  • 9. Lab2 – ECS with Windows Container
  • 10. Lab3 – ECS CI/CD
  • 12.
  • 13.
  • 14. Amazon EC2 Container Service (ECS) EC2 INSTANCES ECS AGENT ECS AGENT Amazon ECS ECS AGENT DEPLOYMENT AUTOMATION
  • 15. Deployment – In Place – Doubling Availability Zone Availability Zone Scenario Service’s task definition is updated to a new revision with parameters: Desired Count = 2 Minimum Healthy Percent = 100% Maximum Percent = 200% These settings permit the service to grow to double its desired size during deployment EXISTING EXISTING
  • 16. Deployment – In Place – Doubling Availability Zone Availability Zone Two new tasks are started growing the number of tasks to 200% of its desired count which is the maximum permitted EXISTING EXISTINGNEW NEW Desired Count = 2 Minimum Healthy Percent = 100% Maximum Percent = 200%
  • 17. Deployment – In Place – Doubling Availability Zone Availability Zone After the new tasks are verified to be healthy by the Elastic Load Balancer health check, the two previous tasks with the older task definition are drained and stopped NEW NEW Desired Count = 2 Minimum Healthy Percent = 100% Maximum Percent = 200%
  • 18. Deployment – In Place – Rolling Availability Zone Availability Zone Scenario Service’s task definition is updated to a new revision with parameters: Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100% These settings constrain the service to not exceed its desired size but allows it to halve the number of tasks during deployment EXISTING EXISTING
  • 19. Deployment – In Place – Rolling Availability Zone Availability Zone First, an existing task is stopped which brings the healthy percentage of the service to 50% and makes room on the cluster for new tasks EXISTING Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100%
  • 20. Deployment – In Place – Rolling Availability Zone Availability Zone A task using the new task definition is started bringing the service back to 100% EXISTING Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100% NEW
  • 21. Deployment – In Place – Rolling Availability Zone Availability Zone After the new task is verified to be healthy by the Elastic Load Balancer health check, the next existing task with the older task definition is drained and stopped Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100% NEW
  • 22. Deployment – In Place – Rolling Availability Zone Availability Zone The second new task is started on the cluster bringing the service back to 100% NEW NEW Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100%
  • 23. Deployment – Canary Availability Zone Availability Zone Scenario The new revision runs as a small subset of production by deploying a canary service in the same target group Deployment is completed by updating the primary service’s task definition and scaling down the canary service. EXISTING EXISTINGEXISTING
  • 24. Deployment – Canary Availability Zone Availability Zone A standalone service with the new task definition is deployed using the same Application Load Balancer target group of the existing service EXISTING EXISTINGEXISTING CANARY
  • 25. Deployment – Canary Availability Zone Availability Zone After some period of monitoring the metrics from the canary instance, the existing service’s task definition is updated to the new revision NEW NEWNEW CANARY
  • 26. Deployment – Canary Availability Zone Availability Zone After the deployment, all tasks are running the same task definition with the new revision of the application and the canary can be destroyed NEW NEWNEW
  • 27. Deployment – Blue/Green – DNS Swap Availability Zone EXISTING EXISTING www.myproduct.com Scenario Two services are defined each with their own Application Load Balancer Deployment is completed by swapping the Route 53 alias record between the two Application Load Balancers Availability Zone
  • 28. Deployment – Blue/Green – DNS Swap Availability Zone EXISTING EXISTING www.myproduct.com An identical Application Load Balancer and a service with a task definition using the new revision is deployed Availability Zone NEW NEW next.myproduct.com
  • 29. Deployment – Blue/Green – DNS Swap Availability Zone EXISTING EXISTING next.myproduct.com After automated or manual testing, the deployment is completed by swapping the Route 53 alias record between the two Application Load Balancers Availability Zone NEW NEW www.myproduct.com
  • 30. Deployment – Blue/Green – DNS Swap Availability Zone The previous service and its Application Load Balancer can then be destroyed Availability Zone NEW NEW www.myproduct.com
  • 31. Deployment – Blue/Green – Target Group Swap Availability Zone EXISTING EXISTING Scenario Two services are defined each with their own target group registered in the same Application Load Balancer using Host-based routing Deployment is completed by swapping the listener rules between the two target groups Availability Zone
  • 32. Deployment – Blue/Green – Target Group Swap Availability Zone EXISTING EXISTING The second service is deployed with a new target group and registered to the same Application Load Balancer Using Host-based routing, requests to www.myproduct.com are directed to our blue service while requests to next.myproduct.com are directed to our green service NEW NEW Availability Zone
  • 33. Deployment – Blue/Green – Target Group Swap Availability Zone After automated or manual testing, the deployment can be completed by swapping the listener rules on the Application Load Balancer and sending traffic to the green service NEW NEW Availability Zone EXISTING EXISTING
  • 34. Deployment – Blue/Green – Target Group Swap Availability Zone The previous service and its target group can then be destroyed NEW NEW Availability Zone
  • 35. Best Practices • In-place Doubling – beware the CPU and Memory reservation with host autoscaling ahead • Monitor the health of ecs-agent • Monitor your CloudWatch metrics and Logs • Canary deployment – test your pilot workload with the same backend capacity • Prepare your rollback plan
  • 36. Lab4 – ECS Service and Host Autoscaling
  • 37. Lab5 – Log Consolidation
  • 38. Best Practices • CloudWatch Logs Agent 1. In the same Docker image 2. In the same Task Definition 3. Standalone task with distinct placement • Alternative – Fluentd
  • 39. Lab6 – ECS Events
  • 40. Takeaways • Monitor state changes for containers and tasks • On state changes, trigger SNS and Lambda for advanced coordination or scheduling • Monitor cloudtrail logs(API usage) as well
  • 41. Lab7 – Spot Fleet Support
  • 42. Takeaways • Use lowestPrice allocation strategy for dev/testing • Use diversified allocation strategy for pilot, staging or pre-prod • Beware of the host termination – you have no enough time for container draining • Be careful to deploy in Production
  • 43. Lab8 – ASG Scale In and Container Draining
  • 44. Takeaways • Container Draining may take up to 5-10 min • Beware of the draining of batch tasks • Stay patient and test
  • 45. Lab9 – Credentials Management
  • 46. Takeaways • Restrict the access of parameter and KMS key in the ECS Task Role • Use Parameter Hierarchy, Tagging and Notification $ aws ssm get-parameter-by-path –path /Dev/Web/Nginx $ aws ssm get-parameter-by-path –path /Testing/Web/Nginx $ aws ssm get-parameter-by-path –path /Prod/Web/Nginx –with-encryption
  • 47. Lab10 – External and Internal ALB
  • 48. Takeaways • Use ALB host-based and path-based routing • Fanout your task events for multiple operations – e.g. Route53 update • We have a PFR for this
  • 49. feedback and get $25 credits
  • 50. Q & A