SlideShare uma empresa Scribd logo
1 de 59
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Brent Langston - @brentContained
Developer Advocate, AWS
April 2018 (Dev Days)
Amazon ECS Deep Dive
From zero to production
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
About me
Brent Langston
Sr Developer Advocate
Amazon Web Services
‱ 16 years of dev, SRE, and systems architecture background
‱ Developer: Python/Ruby/Crystal/Node
‱ Helped build: Tumblr.com, Spotify.com, HiOscar.com and
CloudPassage.com
Twitter: @brentContained
Email: blangs@amazon.com
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What to expect from this talk
‱ Build and deploy a containerized microservices application
‱ Twitter analyzer
‱ Go, RPC, Amazon Kinesis Firehose, AWS SSM Parameter Store
‱ Amazon ECS
‱ Deployment
‱ Availability
‱ Cost optimization
‱ Scaling
‱ Security
‱ Monitoring & logging
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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
(Amazon ECR)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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 EC2 Container Registry
(Amazon ECR)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Component: ECS
AWS is responsible for
operations of the cloud
You are responsible for operations in the cloud
using the building blocks provided.
Deployment
Security
Patching
Monitoring
Scaling
Availability
Cost Control
$ aws ecs create-cluster --cluster-name dev
AWS
Customer
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Component: ECR
Deployment
Security
Cost Control
AWS
Customer
Monitoring
Scaling
Availability
Patching
AWS is responsible for
operations of the cloud
You are responsible for operations in the cloud
using the building blocks provided.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Component: Container Instances
Development cluster
Cluster instance Cluster instance
Cluster instance
Deployment Cost Control
Patching Monitoring
Scaling Availability
Security
AWS
Customer
AWS is responsible for
operations of the cloud
You are responsible for operations in the cloud
using the building blocks provided.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container Instances: Building Blocks Provided
Deployment
Security
Patching
Monitoring
Scaling
Availability
Cost Control
CloudFormation
Update your AMI, replace instances
CloudWatch
Auto Scaling group
Reserved Instances
CLI SDKs etc...
IAM Inspector VPC Flow Logs etc...
Spot Fleet
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Component: Tasks & Containers
Container
Container
Volume
Deployment
Security
Patching
Monitoring
Scaling
Availability
Logging
AWS
Customer
AWS is responsible for
operations of the cloud
You are responsible for operations in the cloud
using the building blocks provided.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deployment
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Should I Set This Up?
Use the AWS
Management
Console?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Should I SetThis Up?
Flex your scripting skills?
What happens if my
script fails halfway
through?
How long
should I pause?
How do I upgrade /
roll back?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deployments should be:
- A self-contained, deployable unit
- Repeatable
- Auditable
- Self-documenting
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CloudFormation: Infrastructure-as-Code
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time to deploy!

or

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time to update


or

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
When a new environment is required


or

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CLI
ECR
CloudFormation (YAML)
Resources:
MyRepository:
Type: AWS::ECR::Repository
Properties:
Name: myapp
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using ECR
Use AWS CLI to perform ‘docker login’
Tip: Use the Amazon ECR Credential Helper for automatic logins
https://github.com/awslabs/amazon-ecr-credential-helper
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CLI
ECS Cluster
CloudFormation (YAML)
Resources:
ECSCluster:
Type: AWS::ECS::Cluster
Properties:
ClusterName: preprod
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ECS Container Instances
‱ Highly available architecture, distributed
across multipleAvailability Zones
‱ VPC with public and private subnets
‱ Application Load Balancer with path based
routing for inbound traffic
‱ NAT gateways for outbound traffic
‱ Auto Scaling group of container instances
‱ CloudWatch Logs for centralized container
logging
Private Subnet
Availability Zone Availability Zone
Internet
Gateway
Public Subnet Public Subnet
Private Subnet
Nat GatewayNat Gateway
AutoScaling GroupContainer InstanceContainer Instance Container InstanceContainer Instance
Application
Load Balancer
CloudWatch Logs
(container logs)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Inbound Traffic
‱ Incoming HTTP/HTTPS traffic comes in via
theApplication Load Balancer (ALB) in
public subnets
‱ The ALB uses path based routing to route
/products/* to the container instances in
private subnets running our product’s
service
‱ Supports dynamic host port mapping,
allowing multiple containers of the same
type on each host
Internet
Gateway
AutoScaling GroupContainer Instance Container Instance
Application
Load Balancer
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Outbound Traffic
‱ Our container instances are in private
subnets, with no direct internet access
‱ At some point, they might need access to
external services
‱ NAT gateways provide a highly scalable and
available solution
Private Subnet
Internet
Gateway
Public Subnet Public Subnet
Private Subnet
Nat GatewayNat Gateway
Container Instance Container Instance
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Logging
Container Instance Container Instance
CloudWatch Logs
(container logs)
‱ ECS integrates directly with CloudWatch
Logs (as well as others)
‱ Centralized collection of container logs
‱ Centralized collection of instance logs
‱ Search, filter, and alert on log conditions
‱ (more to come later
)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
tl;dr - ECS Reference Architecture on GitHub
https://github.com/awslabs/ecs-refarch-cloudformation
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let's build an application
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Parameter Store
(for Twitter Credentials)
Overview
Tweet
Collector
Twitter API
Tweet
Archiver
Kinesis Firehose
Amazon S3 (archive)
AWS Lambda (realtime)
Elasticsearch (analyze)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Microservices and RPC at Twitch
‱ Used for inter-service communication
‱ Structured RPCs are much easier to
design and maintain compared to REST
‱ Focus on data models, not
transports/routing
‱ Works with protobufs or JSON
‱ HTTP/1 compatible (unlike gRPC)
‱ Simplicity
https://blog.twitch.tv/twirp-a-
sweet-new-rpc-framework-for-
go-5f2febbf35f
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
RPC with Twitch Twirp
‱ Write a spec describing your API
(using protobufs)
‱ Generate a client and server from
the specification
‱ Limited to Go today, but more
language support in progress.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tweet Collector
‱ Written in Go
‱ Uses Twitter API to subscribe to
search terms
‱ Environment variables:
‱ SEARCH_TERMS
‱ ARCHIVE_ENDPOINT
‱ IAM role:
‱ AWS SSM Parameter Store
(for Twitter API credentials)
‱ Sends tweets to archiving service via
client SDK generated by Twitch
Twirp.
AWS Parameter Store
(for Twitter Credentials)
Tweet
Collector
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tweet Archiver
‱ Written in Go
‱ Hosts RPC server that receives tweets
‱ Sends tweets to Amazon Kinesis via aws-sdk-go
‱ Environment variables
‱ KINESIS_STREAM_NAME
‱ IAM role
‱ Write access to Kinesis stream
‱ Responds with Kinesis sequence number or error
Tweet
Archiver
Kinesis Firehose
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Local
‱ Run locally with docker-
compose
‱ Logs to stdout/stderr
‱ Local AWS credentials
‱ Build/push containers
Development Workflow
AWS
‱ Deploy to ECS with
CloudFormation
‱ Logs in AWS CloudTrail Logs
‱ IAM Task Role
‱ Metrics in CloudWatch
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
https://github.com/paulmaddox/rpc-demo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Taking it further
‱ Sentiment analysis with
Amazon Comprehend
‱ Dashboards with Amazon
Quicksight
https://aws.amazon.com/blogs/
machine-learning/build-a-
social-media-dashboard-using-
machine-learning-and-bi-
services
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What else do we need for
production?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cost Optimization
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Reserved Instances
Up to 75%
Savings*
‱ Use Auto Scaling groups
‱ Reserve ECS container
instances when you have
known baseline capacity
requirements.
‱ Use On-Demand pricing for
capacity peaks.
* Dependent on specific AWS service, size/type, and region
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spot Instances
Up to 90%
Savings*
‱ Use Spot Fleet to maintain
instance availability and
define cluster based on
required CPU/memory.
* Compared to On-Demand price based on specific EC2 instance type, region, and Availability Zone
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Multiple ECS Clusters
Creating multiple ECS clusters is easy, and often more cost efficient.
Consider availability and compute requirements.
Example: Development Cluster
Spot Fleet
Example: Production Cluster
Auto Scaling group with Reserved Instances for baseline and
On-Demand for capacity peaks
Example: Batch Processing Cluster
Spot Fleet of GPU Instances
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scaling
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scaling ECS Container Instances Automatically
Min
Desired
Scale out as needed
Max
‱ Use Auto Scaling groups
‱ Set Auto Scaling group
min, max, desired
‱ Scale in and out based on
CloudWatch alarms
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scaling ECS Container Instances Automatically
Tip
Use the ECS cluster
MemoryReservation
CloudWatch metric
Tutorial: Scaling Container Instances with CloudWatch Alarms
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Application Auto Scaling for ECS Services
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Application Auto Scaling for ECS Services
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Security
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Patching ECS Container Instances
ECSLaunchConfiguration:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-1924770e
ECSAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
MinSize: 2
MaxSize: 8
DesiredCapacity: 2
AutoScalingRollingUpdate:
MinInstancesInService: 2
MaxBatchSize: 2
PauseTime: PT15M
WaitOnResourceSignals: true
1. Ensure you have an
AutoScalingRollingUpdate policy
on your Auto Scaling group
2. Update the AMI in your
CloudFormation template
3. aws cloudformation update-stack
4. Let CloudFormation perform a rolling
update to your ECS container
instances
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Patching Containers
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Minimal Containers
‱ Use the smallest FROM
base container to minimize
surface attack
‱ FROM scratch is ideal for
Go and other languages
that compile a (near) static
binary
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Roles
IAM roles for container instances:
‱ Bound to the ECS container instance
‱ Applies to all containers running on the host
‱ Pulling images from ECR
‱ CloudWatch Logs
IAM roles for tasks:
‱ Bound to specific ECS tasks
‱ Task-specific access to AWS services
Tip Use principle of least privilege – prefer IAM roles for tasks where applicable
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring & Logging
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring with CloudWatch
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring with CloudWatch
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Prometheus
https://github.com/slok/ecs-exporter
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Centralized Logging with CloudWatch Logs
‱ Defined within the task definition
‱ Available log drivers
‱ awslogs
‱ fluentd
‱ gelf
‱ journald
‱ json-file
‱ splunk
‱ Syslog
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Centralized Logging with CloudWatch Logs
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tip: Use Metric Filters with CloudWatch Logs
5
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Everything about everything ECS.
https://github.com/nathanpeck/awesome-ecs
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!
https://ecsworkshop.com
Twitter: @brentContained
Email: blangs@amazon.com

Mais conteĂșdo relacionado

Mais procurados

Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless Backends
Amazon Web Services
 

Mais procurados (20)

Interstella GTC: Monolith to Microservices with ECS
Interstella GTC: Monolith to Microservices with ECSInterstella GTC: Monolith to Microservices with ECS
Interstella GTC: Monolith to Microservices with ECS
 
AWS Container services
AWS Container servicesAWS Container services
AWS Container services
 
Containers - State of the Union
Containers - State of the UnionContainers - State of the Union
Containers - State of the Union
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
re:Invent Deep Dive on Lambda Layers and Runtime API
re:Invent Deep Dive on Lambda Layers and Runtime APIre:Invent Deep Dive on Lambda Layers and Runtime API
re:Invent Deep Dive on Lambda Layers and Runtime API
 
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
 
Getting Started with Containers on AWS: Collision 2018
Getting Started with Containers on AWS: Collision 2018Getting Started with Containers on AWS: Collision 2018
Getting Started with Containers on AWS: Collision 2018
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
 
Overview of Serverless Application Deployment Patterns - AWS Online Tech Talks
Overview of Serverless Application Deployment Patterns - AWS Online Tech TalksOverview of Serverless Application Deployment Patterns - AWS Online Tech Talks
Overview of Serverless Application Deployment Patterns - AWS Online Tech Talks
 
Getting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and ServerlessGetting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and Serverless
 
Architecting Next Generation Serverless SaaS Solutions on AWS (ARC324-R1) - A...
Architecting Next Generation Serverless SaaS Solutions on AWS (ARC324-R1) - A...Architecting Next Generation Serverless SaaS Solutions on AWS (ARC324-R1) - A...
Architecting Next Generation Serverless SaaS Solutions on AWS (ARC324-R1) - A...
 
Getting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless ComputingGetting Started with AWS Lambda and Serverless Computing
Getting Started with AWS Lambda and Serverless Computing
 
Introduction to the Serverless Cloud
Introduction to the Serverless CloudIntroduction to the Serverless Cloud
Introduction to the Serverless Cloud
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless Backends
 
Bluesoft @ AWS re:Invent 2017 + AWS 101
Bluesoft @ AWS re:Invent 2017 + AWS 101Bluesoft @ AWS re:Invent 2017 + AWS 101
Bluesoft @ AWS re:Invent 2017 + AWS 101
 
How AWS is reinventing the cloud
How AWS is reinventing the cloudHow AWS is reinventing the cloud
How AWS is reinventing the cloud
 
Introduction to AWS
Introduction to AWSIntroduction to AWS
Introduction to AWS
 
Introduction To Containers - Builders Day Israel
Introduction To Containers - Builders Day IsraelIntroduction To Containers - Builders Day Israel
Introduction To Containers - Builders Day Israel
 
Amazon Elastic Container Service for Kubernetes (Amazon EKS) I AWS Dev Day 2018
Amazon Elastic Container Service for Kubernetes (Amazon EKS) I AWS Dev Day 2018Amazon Elastic Container Service for Kubernetes (Amazon EKS) I AWS Dev Day 2018
Amazon Elastic Container Service for Kubernetes (Amazon EKS) I AWS Dev Day 2018
 

Semelhante a Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018

Semelhante a Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018 (20)

Deep Dive on Amazon Elastic Container Service (ECS) and Fargate
Deep Dive on Amazon Elastic Container Service (ECS) and FargateDeep Dive on Amazon Elastic Container Service (ECS) and Fargate
Deep Dive on Amazon Elastic Container Service (ECS) and Fargate
 
Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
Amazon Amazon Elastic Container Service (Amazon ECS)
Amazon Amazon Elastic Container Service (Amazon ECS)Amazon Amazon Elastic Container Service (Amazon ECS)
Amazon Amazon Elastic Container Service (Amazon ECS)
 
Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...
Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...
Set Up a CI/CD Pipeline for Deploying Containers Using the AWS Developer Tool...
 
Build CICD Pipeline for Container Presentation Slides
Build CICD Pipeline for Container Presentation SlidesBuild CICD Pipeline for Container Presentation Slides
Build CICD Pipeline for Container Presentation Slides
 
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
 
Serverless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless EventServerless use cases with AWS Lambda - More Serverless Event
Serverless use cases with AWS Lambda - More Serverless Event
 
Orchestrating containers on AWS | AWS Floor28
Orchestrating containers on AWS | AWS Floor28Orchestrating containers on AWS | AWS Floor28
Orchestrating containers on AWS | AWS Floor28
 
More Containers Less Operations
More Containers Less OperationsMore Containers Less Operations
More Containers Less Operations
 
Operations for Containerized Applications (CON334-R1) - AWS re:Invent 2018
Operations for Containerized Applications (CON334-R1) - AWS re:Invent 2018Operations for Containerized Applications (CON334-R1) - AWS re:Invent 2018
Operations for Containerized Applications (CON334-R1) - AWS re:Invent 2018
 
Deep Dive into Amazon Fargate
Deep Dive into Amazon FargateDeep Dive into Amazon Fargate
Deep Dive into Amazon Fargate
 
Comparing Compute Options for Microservices - AWS Summti Sydney 2018
Comparing Compute Options for Microservices - AWS Summti Sydney 2018Comparing Compute Options for Microservices - AWS Summti Sydney 2018
Comparing Compute Options for Microservices - AWS Summti Sydney 2018
 
AWS 101 - Tel Aviv Summit 2018
AWS 101 - Tel Aviv Summit 2018AWS 101 - Tel Aviv Summit 2018
AWS 101 - Tel Aviv Summit 2018
 
AWS SUMMIT TEL AVIV - 2018
AWS SUMMIT TEL AVIV - 2018AWS SUMMIT TEL AVIV - 2018
AWS SUMMIT TEL AVIV - 2018
 
Have Your Front End and Monitor It, Too (ANT303) - AWS re:Invent 2018
Have Your Front End and Monitor It, Too (ANT303) - AWS re:Invent 2018Have Your Front End and Monitor It, Too (ANT303) - AWS re:Invent 2018
Have Your Front End and Monitor It, Too (ANT303) - AWS re:Invent 2018
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
AWS ćŸźæœć‹™äž­çš„ Container éžé …æŻ”èŒƒ (Level 400)
AWS ćŸźæœć‹™äž­çš„ Container éžé …æŻ”èŒƒ   (Level 400)AWS ćŸźæœć‹™äž­çš„ Container éžé …æŻ”èŒƒ   (Level 400)
AWS ćŸźæœć‹™äž­çš„ Container éžé …æŻ”èŒƒ (Level 400)
 
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
Become a Serverless Black Belt - Optimizing Your Serverless Applications - AW...
 
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
 
Advanced Container Security - AWS Summit Sydney 2018
Advanced Container Security - AWS Summit Sydney 2018Advanced Container Security - AWS Summit Sydney 2018
Advanced Container Security - AWS Summit Sydney 2018
 

Mais de AWS Germany

Mais de AWS Germany (20)

Analytics Web Day | From Theory to Practice: Big Data Stories from the Field
Analytics Web Day | From Theory to Practice: Big Data Stories from the FieldAnalytics Web Day | From Theory to Practice: Big Data Stories from the Field
Analytics Web Day | From Theory to Practice: Big Data Stories from the Field
 
Analytics Web Day | Query your Data in S3 with SQL and optimize for Cost and ...
Analytics Web Day | Query your Data in S3 with SQL and optimize for Cost and ...Analytics Web Day | Query your Data in S3 with SQL and optimize for Cost and ...
Analytics Web Day | Query your Data in S3 with SQL and optimize for Cost and ...
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
 
Modern Applications Web Day | Manage Your Infrastructure and Configuration on...
Modern Applications Web Day | Manage Your Infrastructure and Configuration on...Modern Applications Web Day | Manage Your Infrastructure and Configuration on...
Modern Applications Web Day | Manage Your Infrastructure and Configuration on...
 
Modern Applications Web Day | Container Workloads on AWS
Modern Applications Web Day | Container Workloads on AWSModern Applications Web Day | Container Workloads on AWS
Modern Applications Web Day | Container Workloads on AWS
 
Modern Applications Web Day | Continuous Delivery to Amazon EKS with Spinnaker
Modern Applications Web Day | Continuous Delivery to Amazon EKS with SpinnakerModern Applications Web Day | Continuous Delivery to Amazon EKS with Spinnaker
Modern Applications Web Day | Continuous Delivery to Amazon EKS with Spinnaker
 
Building Smart Home skills for Alexa
Building Smart Home skills for AlexaBuilding Smart Home skills for Alexa
Building Smart Home skills for Alexa
 
Hotel or Taxi? "Sorting hat" for travel expenses with AWS ML infrastructure
Hotel or Taxi? "Sorting hat" for travel expenses with AWS ML infrastructureHotel or Taxi? "Sorting hat" for travel expenses with AWS ML infrastructure
Hotel or Taxi? "Sorting hat" for travel expenses with AWS ML infrastructure
 
Wild Rydes with Big Data/Kinesis focus: AWS Serverless Workshop
Wild Rydes with Big Data/Kinesis focus: AWS Serverless WorkshopWild Rydes with Big Data/Kinesis focus: AWS Serverless Workshop
Wild Rydes with Big Data/Kinesis focus: AWS Serverless Workshop
 
Log Analytics with AWS
Log Analytics with AWSLog Analytics with AWS
Log Analytics with AWS
 
Deep Dive into Concepts and Tools for Analyzing Streaming Data on AWS
Deep Dive into Concepts and Tools for Analyzing Streaming Data on AWS Deep Dive into Concepts and Tools for Analyzing Streaming Data on AWS
Deep Dive into Concepts and Tools for Analyzing Streaming Data on AWS
 
AWS Programme fĂŒr Nonprofits
AWS Programme fĂŒr NonprofitsAWS Programme fĂŒr Nonprofits
AWS Programme fĂŒr Nonprofits
 
Microservices and Data Design
Microservices and Data DesignMicroservices and Data Design
Microservices and Data Design
 
Serverless vs. Developers – the real crash
Serverless vs. Developers – the real crashServerless vs. Developers – the real crash
Serverless vs. Developers – the real crash
 
Query your data in S3 with SQL and optimize for cost and performance
Query your data in S3 with SQL and optimize for cost and performanceQuery your data in S3 with SQL and optimize for cost and performance
Query your data in S3 with SQL and optimize for cost and performance
 
Secret Management with Hashicorp’s Vault
Secret Management with Hashicorp’s VaultSecret Management with Hashicorp’s Vault
Secret Management with Hashicorp’s Vault
 
EKS Workshop
 EKS Workshop EKS Workshop
EKS Workshop
 
Scale to Infinity with ECS
Scale to Infinity with ECSScale to Infinity with ECS
Scale to Infinity with ECS
 
Containers on AWS - State of the Union
Containers on AWS - State of the UnionContainers on AWS - State of the Union
Containers on AWS - State of the Union
 
Deploying and Scaling Your First Cloud Application with Amazon Lightsail
Deploying and Scaling Your First Cloud Application with Amazon LightsailDeploying and Scaling Your First Cloud Application with Amazon Lightsail
Deploying and Scaling Your First Cloud Application with Amazon Lightsail
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Brent Langston - @brentContained Developer Advocate, AWS April 2018 (Dev Days) Amazon ECS Deep Dive From zero to production
  • 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. About me Brent Langston Sr Developer Advocate Amazon Web Services ‱ 16 years of dev, SRE, and systems architecture background ‱ Developer: Python/Ruby/Crystal/Node ‱ Helped build: Tumblr.com, Spotify.com, HiOscar.com and CloudPassage.com Twitter: @brentContained Email: blangs@amazon.com
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What to expect from this talk ‱ Build and deploy a containerized microservices application ‱ Twitter analyzer ‱ Go, RPC, Amazon Kinesis Firehose, AWS SSM Parameter Store ‱ Amazon ECS ‱ Deployment ‱ Availability ‱ Cost optimization ‱ Scaling ‱ Security ‱ Monitoring & logging
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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 (Amazon ECR)
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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 EC2 Container Registry (Amazon ECR)
  • 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Component: ECS AWS is responsible for operations of the cloud You are responsible for operations in the cloud using the building blocks provided. Deployment Security Patching Monitoring Scaling Availability Cost Control $ aws ecs create-cluster --cluster-name dev AWS Customer
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Component: ECR Deployment Security Cost Control AWS Customer Monitoring Scaling Availability Patching AWS is responsible for operations of the cloud You are responsible for operations in the cloud using the building blocks provided.
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Component: Container Instances Development cluster Cluster instance Cluster instance Cluster instance Deployment Cost Control Patching Monitoring Scaling Availability Security AWS Customer AWS is responsible for operations of the cloud You are responsible for operations in the cloud using the building blocks provided.
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container Instances: Building Blocks Provided Deployment Security Patching Monitoring Scaling Availability Cost Control CloudFormation Update your AMI, replace instances CloudWatch Auto Scaling group Reserved Instances CLI SDKs etc... IAM Inspector VPC Flow Logs etc... Spot Fleet
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Component: Tasks & Containers Container Container Volume Deployment Security Patching Monitoring Scaling Availability Logging AWS Customer AWS is responsible for operations of the cloud You are responsible for operations in the cloud using the building blocks provided.
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deployment
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How Should I Set This Up? Use the AWS Management Console?
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How Should I SetThis Up? Flex your scripting skills? What happens if my script fails halfway through? How long should I pause? How do I upgrade / roll back?
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deployments should be: - A self-contained, deployable unit - Repeatable - Auditable - Self-documenting
  • 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CloudFormation: Infrastructure-as-Code
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Time to deploy! 
or

  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Time to update
 
or

  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. When a new environment is required
 
or

  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CLI ECR CloudFormation (YAML) Resources: MyRepository: Type: AWS::ECR::Repository Properties: Name: myapp
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using ECR Use AWS CLI to perform ‘docker login’ Tip: Use the Amazon ECR Credential Helper for automatic logins https://github.com/awslabs/amazon-ecr-credential-helper
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CLI ECS Cluster CloudFormation (YAML) Resources: ECSCluster: Type: AWS::ECS::Cluster Properties: ClusterName: preprod
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ECS Container Instances ‱ Highly available architecture, distributed across multipleAvailability Zones ‱ VPC with public and private subnets ‱ Application Load Balancer with path based routing for inbound traffic ‱ NAT gateways for outbound traffic ‱ Auto Scaling group of container instances ‱ CloudWatch Logs for centralized container logging Private Subnet Availability Zone Availability Zone Internet Gateway Public Subnet Public Subnet Private Subnet Nat GatewayNat Gateway AutoScaling GroupContainer InstanceContainer Instance Container InstanceContainer Instance Application Load Balancer CloudWatch Logs (container logs)
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Inbound Traffic ‱ Incoming HTTP/HTTPS traffic comes in via theApplication Load Balancer (ALB) in public subnets ‱ The ALB uses path based routing to route /products/* to the container instances in private subnets running our product’s service ‱ Supports dynamic host port mapping, allowing multiple containers of the same type on each host Internet Gateway AutoScaling GroupContainer Instance Container Instance Application Load Balancer
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Outbound Traffic ‱ Our container instances are in private subnets, with no direct internet access ‱ At some point, they might need access to external services ‱ NAT gateways provide a highly scalable and available solution Private Subnet Internet Gateway Public Subnet Public Subnet Private Subnet Nat GatewayNat Gateway Container Instance Container Instance
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Logging Container Instance Container Instance CloudWatch Logs (container logs) ‱ ECS integrates directly with CloudWatch Logs (as well as others) ‱ Centralized collection of container logs ‱ Centralized collection of instance logs ‱ Search, filter, and alert on log conditions ‱ (more to come later
)
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. tl;dr - ECS Reference Architecture on GitHub https://github.com/awslabs/ecs-refarch-cloudformation
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Let's build an application
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Parameter Store (for Twitter Credentials) Overview Tweet Collector Twitter API Tweet Archiver Kinesis Firehose Amazon S3 (archive) AWS Lambda (realtime) Elasticsearch (analyze)
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Microservices and RPC at Twitch ‱ Used for inter-service communication ‱ Structured RPCs are much easier to design and maintain compared to REST ‱ Focus on data models, not transports/routing ‱ Works with protobufs or JSON ‱ HTTP/1 compatible (unlike gRPC) ‱ Simplicity https://blog.twitch.tv/twirp-a- sweet-new-rpc-framework-for- go-5f2febbf35f
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. RPC with Twitch Twirp ‱ Write a spec describing your API (using protobufs) ‱ Generate a client and server from the specification ‱ Limited to Go today, but more language support in progress.
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Tweet Collector ‱ Written in Go ‱ Uses Twitter API to subscribe to search terms ‱ Environment variables: ‱ SEARCH_TERMS ‱ ARCHIVE_ENDPOINT ‱ IAM role: ‱ AWS SSM Parameter Store (for Twitter API credentials) ‱ Sends tweets to archiving service via client SDK generated by Twitch Twirp. AWS Parameter Store (for Twitter Credentials) Tweet Collector
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Tweet Archiver ‱ Written in Go ‱ Hosts RPC server that receives tweets ‱ Sends tweets to Amazon Kinesis via aws-sdk-go ‱ Environment variables ‱ KINESIS_STREAM_NAME ‱ IAM role ‱ Write access to Kinesis stream ‱ Responds with Kinesis sequence number or error Tweet Archiver Kinesis Firehose
  • 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Local ‱ Run locally with docker- compose ‱ Logs to stdout/stderr ‱ Local AWS credentials ‱ Build/push containers Development Workflow AWS ‱ Deploy to ECS with CloudFormation ‱ Logs in AWS CloudTrail Logs ‱ IAM Task Role ‱ Metrics in CloudWatch
  • 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. https://github.com/paulmaddox/rpc-demo
  • 35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Taking it further ‱ Sentiment analysis with Amazon Comprehend ‱ Dashboards with Amazon Quicksight https://aws.amazon.com/blogs/ machine-learning/build-a- social-media-dashboard-using- machine-learning-and-bi- services
  • 36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What else do we need for production?
  • 37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cost Optimization
  • 38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Reserved Instances Up to 75% Savings* ‱ Use Auto Scaling groups ‱ Reserve ECS container instances when you have known baseline capacity requirements. ‱ Use On-Demand pricing for capacity peaks. * Dependent on specific AWS service, size/type, and region
  • 39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Spot Instances Up to 90% Savings* ‱ Use Spot Fleet to maintain instance availability and define cluster based on required CPU/memory. * Compared to On-Demand price based on specific EC2 instance type, region, and Availability Zone
  • 40. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Multiple ECS Clusters Creating multiple ECS clusters is easy, and often more cost efficient. Consider availability and compute requirements. Example: Development Cluster Spot Fleet Example: Production Cluster Auto Scaling group with Reserved Instances for baseline and On-Demand for capacity peaks Example: Batch Processing Cluster Spot Fleet of GPU Instances
  • 41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Scaling
  • 42. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Scaling ECS Container Instances Automatically Min Desired Scale out as needed Max ‱ Use Auto Scaling groups ‱ Set Auto Scaling group min, max, desired ‱ Scale in and out based on CloudWatch alarms
  • 43. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Scaling ECS Container Instances Automatically Tip Use the ECS cluster MemoryReservation CloudWatch metric Tutorial: Scaling Container Instances with CloudWatch Alarms
  • 44. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Application Auto Scaling for ECS Services
  • 45. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Application Auto Scaling for ECS Services
  • 46. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Security
  • 47. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Patching ECS Container Instances ECSLaunchConfiguration: Type: AWS::AutoScaling::LaunchConfiguration Properties: ImageId: ami-1924770e ECSAutoScalingGroup: Type: AWS::AutoScaling::AutoScalingGroup Properties: MinSize: 2 MaxSize: 8 DesiredCapacity: 2 AutoScalingRollingUpdate: MinInstancesInService: 2 MaxBatchSize: 2 PauseTime: PT15M WaitOnResourceSignals: true 1. Ensure you have an AutoScalingRollingUpdate policy on your Auto Scaling group 2. Update the AMI in your CloudFormation template 3. aws cloudformation update-stack 4. Let CloudFormation perform a rolling update to your ECS container instances
  • 48. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Patching Containers
  • 49. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Minimal Containers ‱ Use the smallest FROM base container to minimize surface attack ‱ FROM scratch is ideal for Go and other languages that compile a (near) static binary
  • 50. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Roles IAM roles for container instances: ‱ Bound to the ECS container instance ‱ Applies to all containers running on the host ‱ Pulling images from ECR ‱ CloudWatch Logs IAM roles for tasks: ‱ Bound to specific ECS tasks ‱ Task-specific access to AWS services Tip Use principle of least privilege – prefer IAM roles for tasks where applicable
  • 51. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring & Logging
  • 52. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring with CloudWatch
  • 53. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring with CloudWatch
  • 54. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Prometheus https://github.com/slok/ecs-exporter
  • 55. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Centralized Logging with CloudWatch Logs ‱ Defined within the task definition ‱ Available log drivers ‱ awslogs ‱ fluentd ‱ gelf ‱ journald ‱ json-file ‱ splunk ‱ Syslog
  • 56. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Centralized Logging with CloudWatch Logs
  • 57. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Tip: Use Metric Filters with CloudWatch Logs 5
  • 58. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Everything about everything ECS. https://github.com/nathanpeck/awesome-ecs
  • 59. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you! https://ecsworkshop.com Twitter: @brentContained Email: blangs@amazon.com

Notas do Editor

  1. SIMPLY not JUST
  2. /
  3. Mention Tagging
  4. Mention Change Sets
  5. Quite a lot of text
  6. Security is #1 priority
  7. Mention expiring the logs