SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
Getting	started	with	Amazon	
EC2	Container	Service
Abby	Fuller,	Sr Technical	Evangelist,	AWS
@abbyfuller
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 Container Service
• Highly scaleable, high
performance container
management system.
• Eliminates the need to install,
operate and scale your own
container management system.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ECS
• ECS provides a managed platform for:
Cluster	management Container	orchestration Deep	AWS	integration
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ECS
• No software to:
Deploy Manage Scale
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deep AWS integration
Autoscaling Load balancing IAM MonitoringNetworking Logging
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How does ECS map to traditional
workloads?
Instances: standard EC2 boxes. Once registered to a
Cluster, your Tasks run here
Service: layer that manage and place your Tasks
Task: container wrapper and configuration around a
process running on the instance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How does ECS work?
Staging	cluster Production	cluster
Container	instance Container	instance
Container	instance
Container	instance Container	instance
Container	instance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
A closer look
Load balancer (ALB, NLB, or ELB Classic)
routes traffic to the cluster instances
Cluster is made up of one or more EC2
instances
Each Container instance runs one or more
Services
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
A closer look
A Service controls things like the number of copies
of a Task you want running (Desired Count), and
registers your Service with a load balancer
A Task Definition controls things like container image,
environment variables, resource allocation, logger, and
other parameters
Getting	started	with	ECS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building your cluster
Either navigate to the ECS service in your AWS console or:
$ aws ecs create-cluster --cluster-name ”your-cluster-name"
{
"cluster": {
"status": "ACTIVE",
"clusterName": ”websummit",
"registeredContainerInstancesCount": 0,
"pendingTasksCount": 0,
"runningTasksCount": 0,
"activeServicesCount": 0,
}
}
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Task Definitions in ECS
After creating your Cluster, you need to create your first Task Definition. Task Definitions
control almost everything about your service, from the container image used, to your resource
allocation.
$ aws ecs register-task-definition [ --family <value>
[--task-role-arn <value>]
[--network-mode <value>]
--container-definitions <value>
[--volumes <value>]
[--placement-constraints <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Creating a task
• $ aws ecs register-task-definition --cli-input-json
file://pathwebsumit.json
• You can also use a JSON string:
• $ aws ecs register-task-definition --family websummit--container-
definitions
"[{"name":”websummit","image":”alpine","cpu":10,"command":[
"sleep","360"],"memory":10,"essential":true}]”
• This same call is used to register a different version of the task definition as well. For
example, websummit:5 à websummit:6
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Use your task to create a service
• $ aws ecs create-service --service-name websummit --task-definition
websummit --desired-count 2
• You can add more parameters here, such as placement strategy. You can also register your
new service with an ELB/ALB.
Something to note: once a service is registered to a specific load balancer,
that value cannot be changed. This holds true for --family when you’re
registering tasks, as well.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Task Placement Policies
When you call create-service, you have the opportunity to set Task Placement constraints and
strategies:
$ aws ecs create-service
[--placement-constraints <value>]
[--placement-strategy <value>]
By default, the ECS scheduler will place tasks like this: first check for constraints like port,
memory, and CPU, then place tasks on the instances with the fewest number of running tasks,
balanced by Availability Zone. You have custom options, though.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Custom Task Placement Strategies
• If you’re so inclined, you can customize the strategy that ECS uses to place tasks:
Binpacking Spread Affinity Distinct	instance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Custom Task Placement Constraints
Name Example
AMI ID attribute:ecs.ami-id == ami-eca289fb
Availability Zone
attribute:ecs.availability-zone == us-east-
1a
Instance Type attribute:ecs.instance-type == t2.small
Distinct Instances type=“distinctInstances”
Custom attribute:stack == prod
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s take a second to talk about Load
Balancers
• Three different kinds: Application Load Balancer, Network Load Balancer, ELB Classic:
• ELB Classic: the original. Distributes traffic between instances.
• Application Load Balancer: path based routing. Great for microservices. Functions at
Application Layer (7)
• Network Load Balancer: extremely high performance/low latency. Also good for
unusual/spiky traffic patterns. Functions at Connection Layer (4)
• Strongly recommend Application Load Balancer (ALB) for microservices and ECS. Why? Path-
based routing lets you route traffic to multiple services (/web, /messages, /api) with a single
ALB. It also supports dynamic port allocation. This is magical.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Editing a service can deploy or scale
• $ aws ecs update-service --service reinvent --desired-count 4 --task-definition
reinvent:6
• This update-service call serves many functions:
• Changing the --desired-count will scale the service up or down.
• Changing the --task-definition will change the revision. This is effectively a deploy.
•
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scaling up and down
• This is possible in the console and the CLI:
• $ aws ecs update-service --service reinvent --
desired-count 2
• However, in a production environment, this is something we
probably want to handle with autoscaling.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Query cluster state
• $ aws ecs describe-services --service reinvent
• This returns A TON of information about our service: most importantly, it shows us our
current deployment, and what events are happening in our cluster:
• "events": [
• {
• "message": "(service reinvent) has reached a steady state.”
• Cluster events can also be streamed to CloudWatch.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ECS Event Stream for
CloudWatch Logs
• Receive near real-time updates about both the current state of both the container instances
within the ECS Cluster, and the current state of all tasks running on those container
instances.
• Can be used to build custom schedulers, or to monitor cluster state and handle those state
changes by consuming events with other AWS services, such as Lambda.
You’ve	set	up	your	cluster:		now	what?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring with CloudWatch Metrics
• Get Task, Service, and Cluster level metrics via CloudWatch:
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring with CloudWatch Metrics
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Centralized logging with CloudWatch
Logs
{
"image": ”nginx:latest",
...
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": ”nginx",
"awslogs-region": "us-east-1"
}
}
{
• Defined within the task definition
• Available log drivers
• awslogs
• fluentd
• gelf
• journald
• json-file
• splunk
• Syslog
• Open a PR on ecs-agent GitHub repo if you want
to add others.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Centralized logging with CloudWatch
Logs
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Use metric filters with CloudWatch Logs
• Helps reduce noise, and makes for faster debugging!
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Service Discovery with ALB
• There are lots of ways to do this. One way is with your load balancer. This is particularly
straightforward with an ALB, since we can route to content based on path (like /web vs
/messaging).
• This might look something like:
• https://<load-balancer-name>/ à goes to main website service
• https://<load-balancer-name>/signin à goes to login service
• https://<load-balancer-name>/api à goes to backend API service
• As new tasks are added to the service, they can be ’discovered’ through the ALB, since the
ALB handles routing requests to all available services.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Service Discovery with DNS
• As new tasks stop and start, CloudWatch events trigger a Lambda handler, which adds or
removes a DNS record in Route53.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What about secrets?
• Couple of different ways. You can pass environments variables as part of the Task Definition:
• "environment" : [ { "name" : "string", "value" : "string" }, { "name" :
"string", "value" : "string" } ]
• This maps to:
• --env
• In Docker run. While this is OK for non sensitive variables, it’s not great for sensitive secrets,
since the value can be seen in the Task Definition.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Systems Manager Parameter Store
• Sensitive variables can be stored with EC2 Systems Manager Parameter Store, and ecnrypted
via KMS.
• This allows Tasks only to access the parameters that they have permission to access. Since
IAM Roles can be set at the Task level, this allows for granular control over which resources
and variables each Service can access.
prod.app1.db-pass
general.license-code
prod.app2.user-name
Service	A
Service	B
IAM	Role
IAM	Role
EC2	Systems	Manager	Parameter	Store
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Performance monitoring with X-Ray
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Performance monitoring with X-Ray
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Performance monitoring with X-Ray

Weitere ähnliche Inhalte

Was ist angesagt?

Deep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentDeep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentAmazon Web Services
 
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 2018Amazon Web Services
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural PatternsAmazon Web Services
 
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 ComputingAmazon Web Services
 
Deep Dive on Serverless Application Development
Deep Dive on Serverless Application DevelopmentDeep Dive on Serverless Application Development
Deep Dive on Serverless Application DevelopmentAmazon Web Services
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAmazon Web Services
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Amazon Web Services
 
Building Chatbots with Amazon Lex
Building Chatbots with Amazon LexBuilding Chatbots with Amazon Lex
Building Chatbots with Amazon LexAmazon Web Services
 
Tips and Tricks for Running Container Workloads on AWS
Tips and Tricks for Running Container Workloads on AWSTips and Tricks for Running Container Workloads on AWS
Tips and Tricks for Running Container Workloads on AWSAmazon Web Services
 
Managing Container Images with Amazon ECR - AWS Online Tech Talks
Managing Container Images with Amazon ECR - AWS Online Tech TalksManaging Container Images with Amazon ECR - AWS Online Tech Talks
Managing Container Images with Amazon ECR - AWS Online Tech TalksAmazon Web Services
 
Intro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStarIntro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStarAmazon Web Services
 
ARC402_Architectural Patterns and Best Practices with VMware Cloud on AWS
ARC402_Architectural Patterns and Best Practices with VMware Cloud on AWSARC402_Architectural Patterns and Best Practices with VMware Cloud on AWS
ARC402_Architectural Patterns and Best Practices with VMware Cloud on AWSAmazon Web Services
 
State of the Union: Containers on AWS
State of the Union: Containers on AWSState of the Union: Containers on AWS
State of the Union: Containers on AWSAmazon Web Services
 
Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017
Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017
Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017Amazon Web Services
 
Getting Started with AWS for Developers
Getting Started with AWS for DevelopersGetting Started with AWS for Developers
Getting Started with AWS for DevelopersAmazon Web Services
 
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...Amazon Web Services
 
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018AWS Germany
 

Was ist angesagt? (19)

Deep Dive On Serverless App Development
Deep Dive On Serverless App DevelopmentDeep Dive On Serverless App Development
Deep Dive On Serverless App Development
 
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
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
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
 
Deep Dive on Serverless Application Development
Deep Dive on Serverless Application DevelopmentDeep Dive on Serverless Application Development
Deep Dive on Serverless Application Development
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step Functions
 
Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
 
Building Chatbots with Amazon Lex
Building Chatbots with Amazon LexBuilding Chatbots with Amazon Lex
Building Chatbots with Amazon Lex
 
Tips and Tricks for Running Container Workloads on AWS
Tips and Tricks for Running Container Workloads on AWSTips and Tricks for Running Container Workloads on AWS
Tips and Tricks for Running Container Workloads on AWS
 
Managing Container Images with Amazon ECR - AWS Online Tech Talks
Managing Container Images with Amazon ECR - AWS Online Tech TalksManaging Container Images with Amazon ECR - AWS Online Tech Talks
Managing Container Images with Amazon ECR - AWS Online Tech Talks
 
Intro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStarIntro to AWS Developer Tools, featuring AWS CodeStar
Intro to AWS Developer Tools, featuring AWS CodeStar
 
Serverless - State Of the Union
Serverless - State Of the UnionServerless - State Of the Union
Serverless - State Of the Union
 
ARC402_Architectural Patterns and Best Practices with VMware Cloud on AWS
ARC402_Architectural Patterns and Best Practices with VMware Cloud on AWSARC402_Architectural Patterns and Best Practices with VMware Cloud on AWS
ARC402_Architectural Patterns and Best Practices with VMware Cloud on AWS
 
State of the Union: Containers on AWS
State of the Union: Containers on AWSState of the Union: Containers on AWS
State of the Union: Containers on AWS
 
Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017
Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017
Simplifying Microsoft Architectures with AWS - CMP214 - re:Invent 2017
 
Getting Started with AWS for Developers
Getting Started with AWS for DevelopersGetting Started with AWS for Developers
Getting Started with AWS for Developers
 
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
 
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
 

Andere mochten auch

Getting Started with Serverless Apps
Getting Started with Serverless AppsGetting Started with Serverless Apps
Getting Started with Serverless AppsAmazon Web Services
 
You Don’t Need A Mobile App! Responsive Web Apps Using AWS
You Don’t Need A Mobile App! Responsive Web Apps Using AWSYou Don’t Need A Mobile App! Responsive Web Apps Using AWS
You Don’t Need A Mobile App! Responsive Web Apps Using AWSAmazon Web Services
 
Build Cloud-Connected Apps in React Native for iOS & Android.pdf
Build Cloud-Connected Apps in React Native for iOS & Android.pdfBuild Cloud-Connected Apps in React Native for iOS & Android.pdf
Build Cloud-Connected Apps in React Native for iOS & Android.pdfAmazon Web Services
 
Getting Started with Kubernetes on AWS
Getting Started with Kubernetes on AWSGetting Started with Kubernetes on AWS
Getting Started with Kubernetes on AWSAmazon Web Services
 
Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...
Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...
Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...Amazon Web Services
 
Serverless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis AnalyticsServerless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis AnalyticsAmazon Web Services
 
Deep Dive on Amazon DynamoDB - AWS Online Tech Talks
Deep Dive on Amazon DynamoDB - AWS Online Tech TalksDeep Dive on Amazon DynamoDB - AWS Online Tech Talks
Deep Dive on Amazon DynamoDB - AWS Online Tech TalksAmazon Web Services
 
Serverless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemServerless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemAmazon Web Services
 
Deep Dive on Amazon SES What's New - AWS Online Tech Talks
Deep Dive on Amazon SES What's New - AWS Online Tech TalksDeep Dive on Amazon SES What's New - AWS Online Tech Talks
Deep Dive on Amazon SES What's New - AWS Online Tech TalksAmazon Web Services
 
Serverless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best PracticesServerless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best PracticesAmazon Web Services
 
Building Smart Applications with Amazon Machine Learning.pdf
Building Smart Applications with Amazon Machine Learning.pdfBuilding Smart Applications with Amazon Machine Learning.pdf
Building Smart Applications with Amazon Machine Learning.pdfAmazon Web Services
 
Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...
Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...
Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...Amazon Web Services
 

Andere mochten auch (20)

Getting Started with Serverless Apps
Getting Started with Serverless AppsGetting Started with Serverless Apps
Getting Started with Serverless Apps
 
You Don’t Need A Mobile App! Responsive Web Apps Using AWS
You Don’t Need A Mobile App! Responsive Web Apps Using AWSYou Don’t Need A Mobile App! Responsive Web Apps Using AWS
You Don’t Need A Mobile App! Responsive Web Apps Using AWS
 
Getting Started with AWS IoT
Getting Started with AWS IoTGetting Started with AWS IoT
Getting Started with AWS IoT
 
Intro to Amazon AI Services
Intro to Amazon AI ServicesIntro to Amazon AI Services
Intro to Amazon AI Services
 
Build Cloud-Connected Apps in React Native for iOS & Android.pdf
Build Cloud-Connected Apps in React Native for iOS & Android.pdfBuild Cloud-Connected Apps in React Native for iOS & Android.pdf
Build Cloud-Connected Apps in React Native for iOS & Android.pdf
 
Getting Started with Kubernetes on AWS
Getting Started with Kubernetes on AWSGetting Started with Kubernetes on AWS
Getting Started with Kubernetes on AWS
 
Deep Dive on Big Data
Deep Dive on Big Data Deep Dive on Big Data
Deep Dive on Big Data
 
Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...
Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...
Set it and Forget it: Auto Scaling Target Tracking Policies - AWS Online Tech...
 
Deep Dive on AWS Lambda
Deep Dive on AWS LambdaDeep Dive on AWS Lambda
Deep Dive on AWS Lambda
 
Serverless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis AnalyticsServerless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis Analytics
 
AWS Security Fundamentals
AWS Security FundamentalsAWS Security Fundamentals
AWS Security Fundamentals
 
Deep Dive on Amazon DynamoDB - AWS Online Tech Talks
Deep Dive on Amazon DynamoDB - AWS Online Tech TalksDeep Dive on Amazon DynamoDB - AWS Online Tech Talks
Deep Dive on Amazon DynamoDB - AWS Online Tech Talks
 
Serverless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemServerless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat System
 
Deep Dive on Amazon SES What's New - AWS Online Tech Talks
Deep Dive on Amazon SES What's New - AWS Online Tech TalksDeep Dive on Amazon SES What's New - AWS Online Tech Talks
Deep Dive on Amazon SES What's New - AWS Online Tech Talks
 
Serverless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best PracticesServerless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best Practices
 
Building Smart Applications with Amazon Machine Learning.pdf
Building Smart Applications with Amazon Machine Learning.pdfBuilding Smart Applications with Amazon Machine Learning.pdf
Building Smart Applications with Amazon Machine Learning.pdf
 
Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...
Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...
Big Data Experience Sharing: Building Collaborative Data Analytics Platform -...
 
Amazon Alexa Workshop
Amazon Alexa WorkshopAmazon Alexa Workshop
Amazon Alexa Workshop
 
9 Security Best Practices
9 Security Best Practices9 Security Best Practices
9 Security Best Practices
 
Cost Optimisation on AWS
Cost Optimisation on AWSCost Optimisation on AWS
Cost Optimisation on AWS
 

Ähnlich wie Getting Started with Amazon EC2 Container Service

CMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWSCMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWSAmazon 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
 
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
 
Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017Amazon Web Services
 
Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019
Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019 Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019
Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019 Amazon Web Services
 
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...Amazon Web Services Korea
 
Deep dive ECS & Fargate Deep Dive
Deep dive ECS & Fargate Deep DiveDeep dive ECS & Fargate Deep Dive
Deep dive ECS & Fargate Deep DiveAmazon Web Services
 
CON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lolCON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lolAmazon Web Services
 
intro elastic container service amazon aws
intro elastic container service amazon awsintro elastic container service amazon aws
intro elastic container service amazon awsDanielJara92
 
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)Amazon Web Services
 
From Docker Straight to AWS
From Docker Straight to AWSFrom Docker Straight to AWS
From Docker Straight to AWSDevOps.com
 
Born in the Cloud, Built like a Startup
Born in the Cloud, Built like a StartupBorn in the Cloud, Built like a Startup
Born in the Cloud, Built like a StartupAmazon Web Services
 
CMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS Snapshots
CMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS SnapshotsCMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS Snapshots
CMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS SnapshotsAmazon Web Services
 
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 FargateAmazon Web Services
 
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Amazon Web Services
 

Ähnlich wie Getting Started with Amazon EC2 Container Service (20)

CMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWSCMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWS
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWS
 
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
 
Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017
 
Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019
Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019 Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019
Containers and mission-critical applications - SEP309-R - AWS re:Inforce 2019
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 컨테이너 - 김세호 AWS 솔루션...
 
AWS 容器服務入門實務
AWS 容器服務入門實務AWS 容器服務入門實務
AWS 容器服務入門實務
 
Deep dive ECS & Fargate Deep Dive
Deep dive ECS & Fargate Deep DiveDeep dive ECS & Fargate Deep Dive
Deep dive ECS & Fargate Deep Dive
 
CON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lolCON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lol
 
Intro to Amazon ECS
Intro to Amazon ECSIntro to Amazon ECS
Intro to Amazon ECS
 
intro elastic container service amazon aws
intro elastic container service amazon awsintro elastic container service amazon aws
intro elastic container service amazon aws
 
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)
 
ARC205_Born in the Cloud
ARC205_Born in the CloudARC205_Born in the Cloud
ARC205_Born in the Cloud
 
From Docker Straight to AWS
From Docker Straight to AWSFrom Docker Straight to AWS
From Docker Straight to AWS
 
Born in the Cloud, Built like a Startup
Born in the Cloud, Built like a StartupBorn in the Cloud, Built like a Startup
Born in the Cloud, Built like a Startup
 
CMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS Snapshots
CMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS SnapshotsCMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS Snapshots
CMP304_Deep Dive Backing Up Amazon EC2 with Amazon EBS Snapshots
 
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
 
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
 
Introducing Amazon Fargate
Introducing Amazon FargateIntroducing Amazon Fargate
Introducing Amazon Fargate
 

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
 

Getting Started with Amazon EC2 Container Service

  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon EC2 Container Service • Highly scaleable, high performance container management system. • Eliminates the need to install, operate and scale your own container management system.
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon ECS • ECS provides a managed platform for: Cluster management Container orchestration Deep AWS integration
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon ECS • No software to: Deploy Manage Scale
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deep AWS integration Autoscaling Load balancing IAM MonitoringNetworking Logging
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How does ECS map to traditional workloads? Instances: standard EC2 boxes. Once registered to a Cluster, your Tasks run here Service: layer that manage and place your Tasks Task: container wrapper and configuration around a process running on the instance
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How does ECS work? Staging cluster Production cluster Container instance Container instance Container instance Container instance Container instance Container instance
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A closer look Load balancer (ALB, NLB, or ELB Classic) routes traffic to the cluster instances Cluster is made up of one or more EC2 instances Each Container instance runs one or more Services
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A closer look A Service controls things like the number of copies of a Task you want running (Desired Count), and registers your Service with a load balancer A Task Definition controls things like container image, environment variables, resource allocation, logger, and other parameters
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Building your cluster Either navigate to the ECS service in your AWS console or: $ aws ecs create-cluster --cluster-name ”your-cluster-name" { "cluster": { "status": "ACTIVE", "clusterName": ”websummit", "registeredContainerInstancesCount": 0, "pendingTasksCount": 0, "runningTasksCount": 0, "activeServicesCount": 0, } }
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Task Definitions in ECS After creating your Cluster, you need to create your first Task Definition. Task Definitions control almost everything about your service, from the container image used, to your resource allocation. $ aws ecs register-task-definition [ --family <value> [--task-role-arn <value>] [--network-mode <value>] --container-definitions <value> [--volumes <value>] [--placement-constraints <value>] [--cli-input-json <value>] [--generate-cli-skeleton <value>]
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Creating a task • $ aws ecs register-task-definition --cli-input-json file://pathwebsumit.json • You can also use a JSON string: • $ aws ecs register-task-definition --family websummit--container- definitions "[{"name":”websummit","image":”alpine","cpu":10,"command":[ "sleep","360"],"memory":10,"essential":true}]” • This same call is used to register a different version of the task definition as well. For example, websummit:5 à websummit:6
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Use your task to create a service • $ aws ecs create-service --service-name websummit --task-definition websummit --desired-count 2 • You can add more parameters here, such as placement strategy. You can also register your new service with an ELB/ALB. Something to note: once a service is registered to a specific load balancer, that value cannot be changed. This holds true for --family when you’re registering tasks, as well.
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Task Placement Policies When you call create-service, you have the opportunity to set Task Placement constraints and strategies: $ aws ecs create-service [--placement-constraints <value>] [--placement-strategy <value>] By default, the ECS scheduler will place tasks like this: first check for constraints like port, memory, and CPU, then place tasks on the instances with the fewest number of running tasks, balanced by Availability Zone. You have custom options, though.
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Custom Task Placement Strategies • If you’re so inclined, you can customize the strategy that ECS uses to place tasks: Binpacking Spread Affinity Distinct instance
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Custom Task Placement Constraints Name Example AMI ID attribute:ecs.ami-id == ami-eca289fb Availability Zone attribute:ecs.availability-zone == us-east- 1a Instance Type attribute:ecs.instance-type == t2.small Distinct Instances type=“distinctInstances” Custom attribute:stack == prod
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Let’s take a second to talk about Load Balancers • Three different kinds: Application Load Balancer, Network Load Balancer, ELB Classic: • ELB Classic: the original. Distributes traffic between instances. • Application Load Balancer: path based routing. Great for microservices. Functions at Application Layer (7) • Network Load Balancer: extremely high performance/low latency. Also good for unusual/spiky traffic patterns. Functions at Connection Layer (4) • Strongly recommend Application Load Balancer (ALB) for microservices and ECS. Why? Path- based routing lets you route traffic to multiple services (/web, /messages, /api) with a single ALB. It also supports dynamic port allocation. This is magical.
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Editing a service can deploy or scale • $ aws ecs update-service --service reinvent --desired-count 4 --task-definition reinvent:6 • This update-service call serves many functions: • Changing the --desired-count will scale the service up or down. • Changing the --task-definition will change the revision. This is effectively a deploy. •
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Scaling up and down • This is possible in the console and the CLI: • $ aws ecs update-service --service reinvent -- desired-count 2 • However, in a production environment, this is something we probably want to handle with autoscaling.
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Query cluster state • $ aws ecs describe-services --service reinvent • This returns A TON of information about our service: most importantly, it shows us our current deployment, and what events are happening in our cluster: • "events": [ • { • "message": "(service reinvent) has reached a steady state.” • Cluster events can also be streamed to CloudWatch.
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon ECS Event Stream for CloudWatch Logs • Receive near real-time updates about both the current state of both the container instances within the ECS Cluster, and the current state of all tasks running on those container instances. • Can be used to build custom schedulers, or to monitor cluster state and handle those state changes by consuming events with other AWS services, such as Lambda.
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring with CloudWatch Metrics • Get Task, Service, and Cluster level metrics via CloudWatch:
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring with CloudWatch Metrics
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Centralized logging with CloudWatch Logs { "image": ”nginx:latest", ... "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": ”nginx", "awslogs-region": "us-east-1" } } { • Defined within the task definition • Available log drivers • awslogs • fluentd • gelf • journald • json-file • splunk • Syslog • Open a PR on ecs-agent GitHub repo if you want to add others.
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Centralized logging with CloudWatch Logs
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Use metric filters with CloudWatch Logs • Helps reduce noise, and makes for faster debugging!
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Service Discovery with ALB • There are lots of ways to do this. One way is with your load balancer. This is particularly straightforward with an ALB, since we can route to content based on path (like /web vs /messaging). • This might look something like: • https://<load-balancer-name>/ à goes to main website service • https://<load-balancer-name>/signin à goes to login service • https://<load-balancer-name>/api à goes to backend API service • As new tasks are added to the service, they can be ’discovered’ through the ALB, since the ALB handles routing requests to all available services.
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Service Discovery with DNS • As new tasks stop and start, CloudWatch events trigger a Lambda handler, which adds or removes a DNS record in Route53.
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What about secrets? • Couple of different ways. You can pass environments variables as part of the Task Definition: • "environment" : [ { "name" : "string", "value" : "string" }, { "name" : "string", "value" : "string" } ] • This maps to: • --env • In Docker run. While this is OK for non sensitive variables, it’s not great for sensitive secrets, since the value can be seen in the Task Definition.
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. EC2 Systems Manager Parameter Store • Sensitive variables can be stored with EC2 Systems Manager Parameter Store, and ecnrypted via KMS. • This allows Tasks only to access the parameters that they have permission to access. Since IAM Roles can be set at the Task level, this allows for granular control over which resources and variables each Service can access. prod.app1.db-pass general.license-code prod.app2.user-name Service A Service B IAM Role IAM Role EC2 Systems Manager Parameter Store
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Performance monitoring with X-Ray
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Performance monitoring with X-Ray
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Performance monitoring with X-Ray