SlideShare una empresa de Scribd logo
1 de 39
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENT
Deep Dive Into AWS Fargate
D a n G e r d e s m e i e r , S o f t w a r e D e v e l o p m e n t M a n a g e r , F a r g a t e
A r c h a n a S r i k a n t a , S r . S o f t w a r e D e v e l o p m e n t E n g i n e e r , F a r g a t e
C O N 3 3 3
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IN THIS TALK
• We will build a TicTacToe game application, called Scorekeep on AWS Fargate
Frontend Server
Container
Angular + Nginx
API Server
Container
JavaInternet
Port
8080
Port
5000
Application
Load
Balancer
Amazom
DynamoDB
Amazon
SNS
• Configure it step by step : Compute, Networking, Permissions, Logging & Debugging
• And demo it using Fargate on Amazon ECS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
FARGATE CONSTRUCTS
C O M P U T E
N E T W O R K I N G
P E R M I S S I O N S
L O G G I N G & D E B U G G I N G
S T O R A G E
D E M O
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Define application containers: Image
URL, CPU & Memory requirements,
etc.
register
Task Definition
create
Cluster
• Infrastructure Isolation
boundary
• IAM Permissions boundary
run
Task
• A running instantiation of
a task definition
• Use FARGATE launch type
create
Service
Elastic Load
Balancer
• Maintain n running copies
• Integrated with ELB
• Unhealthy tasks
automatically replaced
CONSTRUCTS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
TASK DEFINITION
{
"family": “scorekeep",
"containerDefinitions": [
{
"name":“scorekeep-frontend",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe"
},
{
"name":“scorekeep-api",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api"
}
]
}
Immutable, versioned document
Identified by family:version
Contains a list of up to 10 container definitions
All containers are co-located on the same host
Each container definition has:
• A name
• Image URL (Amazon ECR or Public Images)
• And more…stay tuned!
Task Definition Snippet
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
F A R G A T E C O N S T R U C T S
COMPUTE
N E T W O R K I N G
P E R M I S S I O N S
L O G G I N G & D E B U G G I N G
S T O R A G E
S C O R E K E E P D E M O
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CPU & MEMORY SPECIFICATION
{
"family": "scorekeep",
"cpu": "1 vCpu",
"memory": "2 gb",
"containerDefinitions": [
{
"name":“scorekeep-frontend",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe“,
"cpu": 256,
"memoryReservation": 512
},
{
"name":“scorekeep-api",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api",
"cpu": 768,
"memoryReservation": 512
}
]
}
Units
• CPU : cpu-units. 1 vCPU = 1024 cpu-units
• Memory : MB (2^20)
Task Level Resources:
• Total Cpu/Memory across all containers
• Required fields
• Billing axis
Container Level Resources:
• Defines sharing of task resources among containers
• Optional fields
Task
Level
Resources
Container
Level
Resources
Task Definition Snippet
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CONTAINER CPU SHARING
• Task CPU is the total CPU available for all containers in the task definition
• Container CPU is optional. By default all containers get an equal share of task CPU time
• Specify container CPU to control relative sharing among containers
In our example: scorekeep-frontend = 256; scorekeep-api = 768;
Task CPU = 1024
scorekeep-api
container
scorekeep-frontend
container
Container 1 Container 2
Task CPU = 1024
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CONTAINER MEMORY SHARING
• Task memory is the total memory available for all containers
• Container level memory settings are optional. By default all task memory is available to all containers
• Memory reservation is a soft lower bound. Can kick in when task memory is under contention
In our example: scorekeep-frontend = 512 mb; scorekeep-api = 512 mb;
• Memory is a hard upper bound. Container will not be allowed to grow beyond this value
Task Memory = 2 gb
scorekeep-api
container
scorekeep-frontend
container
Available for all
Container 1 Container 2Available for all
Task Memory = 2 gb
non-critical
container
critical
container
Task Memory = 2gb
Memory Reservation Memory Reservation
Memory Reservation Hard Memory Limit
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
TASK CPU MEMORY CONFIGURATIONS
50 different CPU/Memory configurations to choose from
CPU Memory
256 units (.25 vCPU) 512MB, 1GB, 2GB
512 units (.5 vCPU) Between 1GB & 4GB in 1GB increments
1024 units (1 vCPU) Between 2GB & 8GB in 1GB increments
2048 units (2 vCPU) Between 4GB & 16GB in 1GB increments
4096 units (4 vCPU) Between 8GB & 30GB in 1GB increments
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
PLATFORM VERSION
What is it?
• It refers to a specific runtime environment around your task
• Combination of Kernel version & container runtime version
• Available today: 1.0.0
• New versions will be released as the runtime environment evolves: Kernel/OS updates, new features, bug
fixes, and security updates
Why expose it?
• Gives you explicit control over
• Migration to new platform versions
• Rollback to previous platform versions
How do I use it?
$ aws ecs run-task ... --platform-version 1.0.0
$ aws ecs run-task ... --platform-version LATEST #or just leave it blank
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
F A R G A T E C O N S T R U C T S
C O M P U T E
NETWORKING
P E R M I S S I O N S
L O G G I N G & D E B U G G I N G
S T O R A G E
S C O R E K E E P D E M O
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
VPC INTEGRATION 172.31.0.0/16
Subnet
172.31.1.0/24
Internet
Other Entities in VPC
EC2 LB DB etc.
Private IP
172.31.1.164
Launch your Fargate Tasks into subnets
Under the hood :
• We create an Elastic Network Interface (ENI)
• The ENI is allocated a private IP from your subnet
• The ENI is attached to your task
• Your task now has a private IP from your subnet!
You can assign public IPs to your tasks
Configure security groups to control inbound & outbound
traffic
Spread your application across subnets in multiple Availability
Zones (AZs) for high redundancy
us-east-1a
us-east-1b
us-east-1c
ENI Fargate
TaskPublic /
208.57.73.13 /
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
VPC CONFIGURATION
{
"family": "scorekeep",
"cpu": "1 vCpu",
"memory": "2 gb",
"networkMode": "awsvpc",
"containerDefinitions": [
{
"name":“scorekeep-frontend",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe",
"cpu": 256,
"memoryReservation": 512
},
{
"name":“scorekeep-api",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api",
"cpu": 768,
"memoryReservation": 512
}
]
}
$ aws ecs run-task ...
-- task-definition scorekeep:1
-- network-configuration
“awsvpcConfiguration = {
subnets=[subnet1-id, subnet2-id],
securityGroups=[sg-id]
}”
Enables ENI
creation &
attachment
to Task
Run Task
Task Definition
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
INTERNET ACCESS
The Task ENI is used for all inbound & outbound network traffic to and from your task
It is also used for:
• Image Pull (from ECR or a public repository)
• Pushing to Amazon CloudWatch logs
Both these endpoints need to be reachable via your task ENI
Two common modes of setup:
• Private with no inbound internet traffic, but allows outbound internet access
• Public task with both inbound and outbound internet access
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
PRIVATE TASK SETUP
Public subnet Private subnet
Fargate
TaskENI
Private IP
172.31.1.164
NAT Gateway
Public EIP
34.214.162.237
Internet
Gateway
172.31.0.0/16
172.31.2.0/24 172.31.1.0/24
Destination Target
172.31.0.0/16 local
0.0.0.0/0 NAT Gateway
Destination Target
172.31.0.0/16 local
0.0.0.0/0 Internet Gateway
Route Tables
Internet
Attach Internet Gateway to VPC
Setup a Public Subnet with
• Route to Internet Gateway
• NAT Gateway
Setup Private Subnet with
• Fargate Task
• Route to NAT Gateway
Security Group to allow outbound traffic
Type Port Destination
All Traffic ALL 0.0.0.0/0
Outbound Security Group Rules
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Outbound
Inbound
PUBLIC TASK SETUP
Public subnet
Fargate
Task
Public IP
54.191.135.66
Internet
Gateway
172.31.0.0/16
172.31.2.0/24
Destination Target
172.31.0.0/16 local
0.0.0.0/0 Internet Gateway
Route Table
Internet
ENI
$ aws ecs run-task ...
-- task-definition scorekeep:1
-- network-configuration
“awsvpcConfiguration = {
subnets=[public-subnet],
securityGroups=[sg-id],
}”
Launch the task into a Public subnet
Give it a public IP address
Security Group to allow the expected inbound traffic
Discover the public IP by describing the ENI attached to
the task
Type Port Source
HTTP 8080 0.0.0.0/0
Inbound Security Group Rule
Type Port Destination
All Traffic ALL 0.0.0.0/0
Outbound Security Group Rules
assignPublicIp=ENABLED
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ELB SETUP
• ELB integration supported on services
• ALB & NLB supported
• ALB requires that you pick at least two subnets in two different AZs
• Ensure that the ALB subnet AZs are a superset of your task subnet AZs
• Select ALB Target type: IP (not Instance)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ELB CONFIGURATION
{
"family": "scorekeep",
"cpu": "1 vCpu",
"memory": "2 gb",
"networkMode": “awsvpc“,
"containerDefinitions": [
{
"name":“scorekeep-frontend",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe",
"cpu": 256,
"memoryReservation": 512,
"portMappings": [
{ "containerPort": 8080 }
]
},
{
"name":“scorekeep-api",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api",
"cpu": 768,
"memoryReservation": 512,
"portMappings": [
{ "containerPort": 5000 }
]
}
]
}
$ aws ecs create-service ...
-- task-definition scorekeep:1
-- network-configuration
“awsvpcConfiguration = {
subnets=[subnet-id],
securityGroups=[sg-id]
}”
-- load-balancers
“[
{
"targetGroupArn": “<insert arn>",
"containerName": “scorekeep-frontend",
"containerPort": 8080
}
]”
Create Service
Task Definition
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
INTERNET FACING ELB SETUP
Public subnet Private subnet
Fargate
TaskENI
Private IP
172.31.1.164
:8080
ALB
Public IP
208.57.73.13
:80
172.31.0.0/16
172.31.2.0/24 172.31.1.0/24
Internet
Task in private subnet with private IP
ALB in public subnet with public IP
Make sure the AZs of the two subnets match
ALB security group to allow inbound traffic from
internet
Task security group to allow inbound traffic from the
ALB’s security group
Task Security GroupALB Security Group
Type Port Source
HTTP 80 0.0.0.0/0
Inbound Rule
Type Port Source
Custom TCP 8080 ALB Security	Group
Inbound Rule
us-east-1a us-east-1a
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
F A R G A T E C O N S T R U C T S
C O M P U T E
N E T W O R K I N G
PERMISSIONS
L O G G I N G & D E B U G G I N G
S T O R A G E
S C O R E K E E P D E M O
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
PERMISSION TIERS
Cluster
Permissions
Application
Permissions
Task
Housekeeping
Permissions
Cluster
Fargate Task
Cluster Permissions:
Control who can launch, stop and describe tasks in your cluster
Application Permissions:
Allows your application containers to access AWS resources
securely
Housekeeping Permissions:
Allows us to perform housekeeping activities around your task:
• ECR Image Pull
• CloudWatch logs pushing
• ENI creation
• Register/Deregister targets into ELB
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLUSTER PERMISSIONS
{
"Effect": "Allow",
"Action": [ "ecs:RunTask" ],
"Condition": {
"ArnEquals": {"ecs:cluster":"<cluster-arn>"}
},
"Resource": [ “<task_def_family>:*" ]
}
You can tailor IAM policies for fine grained access control to your clusters
Attach these policies to IAM Users and/or Roles as necessary
Some example policies:
Example 1: Allow RunTask in a specific cluster
with a specific task definition only
{
"Effect": "Allow",
"Action": [ "ecs:ListTasks“,
“ecs:DescribeTasks” ],
"Condition": {
"ArnEquals": {"ecs:cluster":"<cluster-arn>"}
},
"Resource": “*”
}
Example 2: Read-only access to tasks in a
specific cluster
and many more!
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
APPLICATION PERMISSIONS
Do your application containers access other AWS resources?
Need to get credentials down to the task?
Create an IAM Role with the requisite permissions that your
application needs. In our scorekeep example, DynamoDB & SNS
permissions.
Establish a trust relationship with ecs-tasks.amazonaws.com on
that role. This lets us assume the role and wire the credentials
down to your task.
Add the role arn to your task definition and you’re done!
AWS CLI/SDK calls from within your application will
automatically use the Task Role credentials
Credentials are temporary and rotated periodically
Use a Task Role
{
"family": "scorekeep",
"cpu": "1 vCpu",
"memory": "2 gb",
"networkMode": “awsvpc“,
“taskRoleArn": “arn:aws...role/scorekeepRole“,
"containerDefinitions": [
{
"name":“scorekeep-frontend",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe",
"cpu": 256,
"memoryReservation": 512,
"portMappings": [
{ "containerPort": 8080 }
]
},
{
"name":“scorekeep-api",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api",
"cpu": 768,
"memoryReservation": 512,
"portMappings": [
{ "containerPort": 5000 }
]
}
]
}
Task Definition
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
HOUSEKEEPING PERMISSIONS
• We need certain permissions in your account to bootstrap your task and keep it
running.
• Execution Role gives us permissions for:
• ECR Image Pull
• Pushing to CloudWatch logs
• ECS Service Linked Role gives us permissions for:
• ENI Management
• ELB Target Registration/Deregistration
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EXECUTION ROLE
• Using an ECR Image or CloudWatch Logs?
• Create an IAM Role. Add Read Permissions to ECR.
Add Write Permissions to CloudWatch Logs
• Establish trust relationship with ecs-tasks.amazonaws.com.
This lets us assume the role
• Add the execution role arn into your task definition
Give us permissions via an Execution Role {
"family": "scorekeep",
"cpu": "1 vCpu",
"memory": "2 gb",
"networkMode": “awsvpc“,
“taskRoleArn": “arn:aws...role/scorekeepRole“,
“executionRoleArn":
“arn:aws...role/scorekeepExecutionRole“,
"containerDefinitions": [
{
"name":“scorekeep-frontend",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe",
"cpu": 256,
"memoryReservation": 512,
"portMappings": [
{ "containerPort": 8080 }
]
},
{
"name":“scorekeep-api",
"image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api",
"cpu": 768,
"memoryReservation": 512,
"portMappings": [
{ "containerPort": 5000 }
]
}
]
}
Task Definition
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ECS SERVICE LINKED ROLE
• A service-linked role is a unique type of IAM role that is linked directly to an AWS service, in
this case ECS
• It has a predefined policy, that is immutable. In this case, ENI & ELB permissions
• It has a trust relationship with ecs.amazonaws.com. Allows us to assume the role and
perform ENI & ELB management on your behalf
• It is automatically created in your account at cluster creation time
• You don’t have to explicitly pass this role in the task definition or any API call
• Just know about it in case you stumble upon it in the IAM console
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
F A R G A T E C O N S T R U C T S
C O M P U T E
N E T W O R K I N G
P E R M I S S I O N S
LOGGING & DEBUGGING
S T O R A G E
S C O R E K E E P D E M O
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLOUDWATCH LOGS CONFIGURATION
• Use the awslogs driver to send
stdout from your application to
CloudWatch logs
• Create a log group in CloudWatch
• Configure the log driver in your
task definition
{
"family": "scorekeep",
...
"containerDefinitions": [
{
"name":“scorekeep-frontend",
...
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "scorekeep",
"awslogs-region": “us-east-1",
"awslogs-stream-prefix": "scorekeep/frontend“}}
},
{
"name":“scorekeep-api",
...
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "scorekeep",
"awslogs-region": “us-east-1",
"awslogs-stream-prefix": "scorekeep/api"}}
}
]}
Task Definition
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLOUDWATCH LOGS
Logs Tab in the
Task Detail Page
View logs in the ECS or CloudWatch Console
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLOUDWATCH METRICS FOR SERVICES
ScorekeepService
ScorekeepService
Metrics tab in the
service detail page
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DEBUGGING TIPS
Task is not RUNNING? Inspect container stopped reason in the Task Detail page or via DescribeTasks API
Task in STOPPED state
Inspect Container
Stopped Reasons
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DEBUGGING TIPS
Service not scaling as expected? Check activity log in the Service Events tab or DescribeServices API
Events Tab in the
Service Detail Page
Inspect activity
messages
Drill down into the
task detail page for
more
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
F A R G A T E C O N S T R U C T S
C O M P U T E
N E T W O R K I N G
P E R M I S S I O N S
L O G G I N G & D E B U G G I N G
STORAGE
S C O R E K E E P D E M O
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
STORAGE
Layer Storage Space : 10 GB per task
Ephemeral storage backed by Amazon EBS
Volume for scratch space
• 4 GB per task
• Mount points specified in Task Definition
• Can be shared among containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
F A R G A T E C O N S T R U C T S
C O M P U T E
N E T W O R K I N G
P E R M I S S I O N S
L O G G I N G & D E B U G G I N G
S T O R A G E
SCOREKEEP DEMO
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"family": "scorekeep",
"cpu": "1 vCpu",
"memory": "2 gb",
"networkMode":"awsvpc",
"taskRoleArn": "arn:aws:…",
"executionRoleArn": “arn:…”,
"requiresCompatibilities": [
"FARGATE"
],
"containerDefinitions": […]
}
{
"name": "scorekeep-frontend",
"image":“xxx.dkr.ecr…frontend",
"cpu": 256,
"memoryReservation": 512,
"portMappings" : [
{ "containerPort": 8080 }
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "scorekeep",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix":
"scorekeep/frontend"
}
}
}
{
"name": "scorekeep-api",
"image":“xxx.dkr.ecr…api",
"cpu": 768,
"memoryReservation": 512,
"portMappings" : [
{ "containerPort": 5000 }
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "scorekeep",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix":
"scorekeep/api”
}
},
"environment": […] #env var
}
SCOREKEEP TASK DEFINITION
Task Definition scorekeep-frontend
Container Definition
scorekeep-api
Container Definition
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
LET’S RUN IT!
Register Task Definition
$ aws ecs register-task-definition --cli-input-json file:///scorekeep-task-definition.json
Create Cluster
$ aws ecs create-cluster --cluster-name FargateDemoCluster
Run Task
$ aws ecs run-task
--cluster FargateDemoCluster --task-definition scorekeep:1
--launch-type FARGATE --count 1
--network-configuration "awsvpcConfiguration={subnets=[subnet-xxx], securityGroups=[sg-xxx]}"
Create Service
$ aws ecs create-service --service-name ScorekeepService
--cluster FargateDemoCluster --task-definition scorekeep:1
--launch-type FARGATE –desired-count 5
--network-configuration "awsvpcConfiguration={subnets=[subnet-xxx], securityGroups=[sg-xxx]}“
--load-balancer “[{"targetGroupArn":“arn:aws:xxx",
"containerName":“scorekeep-frontend",
"containerPort":8080}]”
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
THANK YOU!
http s: / / aws. am azo n. c o m / f ar g ate /

Más contenido relacionado

La actualidad más candente

Red Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterRed Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterMike Felch
 
Subdomain takeover
 Subdomain takeover Subdomain takeover
Subdomain takeoverHina Rawal
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
 
Security Testing Training With Examples
Security Testing Training With ExamplesSecurity Testing Training With Examples
Security Testing Training With ExamplesAlwin Thayyil
 
Enumeration and system hacking
Enumeration and system hackingEnumeration and system hacking
Enumeration and system hackingbegmohsin
 
The Skeletal System - Complete
The Skeletal System - CompleteThe Skeletal System - Complete
The Skeletal System - CompleteRens Peralta
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryDaniel Miessler
 
Understanding the Event Log
Understanding the Event LogUnderstanding the Event Log
Understanding the Event Logchuckbt
 
Thick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdfThick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdfSouvikRoy114738
 
User Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: StethoscopeUser Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: StethoscopeJesse Kriss
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용KyeongMook "Kay" Cha
 
JavaScript - Chapter 3 - Introduction
 JavaScript - Chapter 3 - Introduction JavaScript - Chapter 3 - Introduction
JavaScript - Chapter 3 - IntroductionWebStackAcademy
 
PHP Cookies and Sessions
PHP Cookies and SessionsPHP Cookies and Sessions
PHP Cookies and SessionsNisa Soomro
 
Host Header injection - Slides
Host Header injection - SlidesHost Header injection - Slides
Host Header injection - SlidesAmit Dubey
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NETShingalaKrupa
 

La actualidad más candente (20)

Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Red Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterRed Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite Perimeter
 
ASP.NET-Web Programming - Sessions and Cookies
ASP.NET-Web Programming - Sessions and CookiesASP.NET-Web Programming - Sessions and Cookies
ASP.NET-Web Programming - Sessions and Cookies
 
Subdomain takeover
 Subdomain takeover Subdomain takeover
Subdomain takeover
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Security Testing Training With Examples
Security Testing Training With ExamplesSecurity Testing Training With Examples
Security Testing Training With Examples
 
Enumeration and system hacking
Enumeration and system hackingEnumeration and system hacking
Enumeration and system hacking
 
The Skeletal System - Complete
The Skeletal System - CompleteThe Skeletal System - Complete
The Skeletal System - Complete
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request Forgery
 
Understanding the Event Log
Understanding the Event LogUnderstanding the Event Log
Understanding the Event Log
 
Thick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdfThick Client Penetration Testing.pdf
Thick Client Penetration Testing.pdf
 
User Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: StethoscopeUser Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: Stethoscope
 
Broken access controls
Broken access controlsBroken access controls
Broken access controls
 
Php gd library
Php gd libraryPhp gd library
Php gd library
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
 
JavaScript - Chapter 3 - Introduction
 JavaScript - Chapter 3 - Introduction JavaScript - Chapter 3 - Introduction
JavaScript - Chapter 3 - Introduction
 
Subdomain Enumeration
Subdomain EnumerationSubdomain Enumeration
Subdomain Enumeration
 
PHP Cookies and Sessions
PHP Cookies and SessionsPHP Cookies and Sessions
PHP Cookies and Sessions
 
Host Header injection - Slides
Host Header injection - SlidesHost Header injection - Slides
Host Header injection - Slides
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
 

Similar a Deep Dive into AWS Fargate - CON333 - re:Invent 2017

Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017Amazon Web Services
 
Introducing AWS Fargate - AWS Online Tech Talks
Introducing AWS Fargate - AWS Online Tech TalksIntroducing AWS Fargate - AWS Online Tech Talks
Introducing AWS Fargate - AWS Online Tech TalksAmazon Web Services
 
SRV314 Containerized App Development with AWS Fargate
SRV314 Containerized App Development with AWS FargateSRV314 Containerized App Development with AWS Fargate
SRV314 Containerized App Development with AWS FargateAmazon Web Services
 
Exciting world of Amazon container services with AWS Fargate and Amazon EKS
Exciting world of Amazon container services with AWS Fargate and Amazon EKSExciting world of Amazon container services with AWS Fargate and Amazon EKS
Exciting world of Amazon container services with AWS Fargate and Amazon EKSAmazon Web Services
 
[AWS Container Service] Introducing AWS Fargate
[AWS Container Service] Introducing AWS Fargate[AWS Container Service] Introducing AWS Fargate
[AWS Container Service] Introducing AWS FargateAmazon Web Services Korea
 
GAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECSGAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECSAmazon Web Services
 
CMP315_Optimizing Network Performance for Amazon EC2 Instances
CMP315_Optimizing Network Performance for Amazon EC2 InstancesCMP315_Optimizing Network Performance for Amazon EC2 Instances
CMP315_Optimizing Network Performance for Amazon EC2 InstancesAmazon Web Services
 
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...Amazon Web Services
 
Module 2: AWS Foundational Services - AWSome Day Online Conference
Module 2: AWS Foundational Services - AWSome Day Online ConferenceModule 2: AWS Foundational Services - AWSome Day Online Conference
Module 2: AWS Foundational Services - AWSome Day Online ConferenceAmazon Web Services
 
Module 2 AWS Foundational Services - AWSome Day Online Conference
Module 2 AWS Foundational Services - AWSome Day Online Conference Module 2 AWS Foundational Services - AWSome Day Online Conference
Module 2 AWS Foundational Services - AWSome Day Online Conference Amazon Web Services
 
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
 
AWSome Day Online Conference 2018 - Module 2
AWSome Day Online Conference 2018 -  Module 2AWSome Day Online Conference 2018 -  Module 2
AWSome Day Online Conference 2018 - Module 2Amazon Web Services
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryAmazon Web Services
 

Similar a Deep Dive into AWS Fargate - CON333 - re:Invent 2017 (20)

Deep dive into AWS fargate
Deep dive into AWS fargateDeep dive into AWS fargate
Deep dive into AWS fargate
 
Deep Dive into AWS Fargate
Deep Dive into AWS FargateDeep Dive into AWS Fargate
Deep Dive into AWS Fargate
 
Introducing AWS Fargate
Introducing AWS FargateIntroducing AWS Fargate
Introducing AWS Fargate
 
Introducing AWS Fargate
Introducing AWS FargateIntroducing AWS Fargate
Introducing AWS Fargate
 
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
 
Introducing AWS Fargate - AWS Online Tech Talks
Introducing AWS Fargate - AWS Online Tech TalksIntroducing AWS Fargate - AWS Online Tech Talks
Introducing AWS Fargate - AWS Online Tech Talks
 
SRV314 Containerized App Development with AWS Fargate
SRV314 Containerized App Development with AWS FargateSRV314 Containerized App Development with AWS Fargate
SRV314 Containerized App Development with AWS Fargate
 
Introducing AWS Fargate
Introducing AWS FargateIntroducing AWS Fargate
Introducing AWS Fargate
 
Exciting world of Amazon container services with AWS Fargate and Amazon EKS
Exciting world of Amazon container services with AWS Fargate and Amazon EKSExciting world of Amazon container services with AWS Fargate and Amazon EKS
Exciting world of Amazon container services with AWS Fargate and Amazon EKS
 
[AWS Container Service] Introducing AWS Fargate
[AWS Container Service] Introducing AWS Fargate[AWS Container Service] Introducing AWS Fargate
[AWS Container Service] Introducing AWS Fargate
 
GAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECSGAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECS
 
CMP315_Optimizing Network Performance for Amazon EC2 Instances
CMP315_Optimizing Network Performance for Amazon EC2 InstancesCMP315_Optimizing Network Performance for Amazon EC2 Instances
CMP315_Optimizing Network Performance for Amazon EC2 Instances
 
Deep Dive into Amazon Fargate
Deep Dive into Amazon FargateDeep Dive into Amazon Fargate
Deep Dive into Amazon Fargate
 
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
 
Module 2: AWS Foundational Services - AWSome Day Online Conference
Module 2: AWS Foundational Services - AWSome Day Online ConferenceModule 2: AWS Foundational Services - AWSome Day Online Conference
Module 2: AWS Foundational Services - AWSome Day Online Conference
 
Module 2 AWS Foundational Services - AWSome Day Online Conference
Module 2 AWS Foundational Services - AWSome Day Online Conference Module 2 AWS Foundational Services - AWSome Day Online Conference
Module 2 AWS Foundational Services - AWSome Day Online Conference
 
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
 
AWSome Day Online Conference 2018 - Module 2
AWSome Day Online Conference 2018 -  Module 2AWSome Day Online Conference 2018 -  Module 2
AWSome Day Online Conference 2018 - Module 2
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s Story
 
Kubernetes on AWS
Kubernetes on AWSKubernetes on AWS
Kubernetes on AWS
 

Más de 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
 

Más de Amazon Web Services (20)

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

Deep Dive into AWS Fargate - CON333 - re:Invent 2017

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT Deep Dive Into AWS Fargate D a n G e r d e s m e i e r , S o f t w a r e D e v e l o p m e n t M a n a g e r , F a r g a t e A r c h a n a S r i k a n t a , S r . S o f t w a r e D e v e l o p m e n t E n g i n e e r , F a r g a t e C O N 3 3 3
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IN THIS TALK • We will build a TicTacToe game application, called Scorekeep on AWS Fargate Frontend Server Container Angular + Nginx API Server Container JavaInternet Port 8080 Port 5000 Application Load Balancer Amazom DynamoDB Amazon SNS • Configure it step by step : Compute, Networking, Permissions, Logging & Debugging • And demo it using Fargate on Amazon ECS
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. FARGATE CONSTRUCTS C O M P U T E N E T W O R K I N G P E R M I S S I O N S L O G G I N G & D E B U G G I N G S T O R A G E D E M O
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Define application containers: Image URL, CPU & Memory requirements, etc. register Task Definition create Cluster • Infrastructure Isolation boundary • IAM Permissions boundary run Task • A running instantiation of a task definition • Use FARGATE launch type create Service Elastic Load Balancer • Maintain n running copies • Integrated with ELB • Unhealthy tasks automatically replaced CONSTRUCTS
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. TASK DEFINITION { "family": “scorekeep", "containerDefinitions": [ { "name":“scorekeep-frontend", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe" }, { "name":“scorekeep-api", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api" } ] } Immutable, versioned document Identified by family:version Contains a list of up to 10 container definitions All containers are co-located on the same host Each container definition has: • A name • Image URL (Amazon ECR or Public Images) • And more…stay tuned! Task Definition Snippet
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. F A R G A T E C O N S T R U C T S COMPUTE N E T W O R K I N G P E R M I S S I O N S L O G G I N G & D E B U G G I N G S T O R A G E S C O R E K E E P D E M O
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CPU & MEMORY SPECIFICATION { "family": "scorekeep", "cpu": "1 vCpu", "memory": "2 gb", "containerDefinitions": [ { "name":“scorekeep-frontend", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe“, "cpu": 256, "memoryReservation": 512 }, { "name":“scorekeep-api", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api", "cpu": 768, "memoryReservation": 512 } ] } Units • CPU : cpu-units. 1 vCPU = 1024 cpu-units • Memory : MB (2^20) Task Level Resources: • Total Cpu/Memory across all containers • Required fields • Billing axis Container Level Resources: • Defines sharing of task resources among containers • Optional fields Task Level Resources Container Level Resources Task Definition Snippet
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CONTAINER CPU SHARING • Task CPU is the total CPU available for all containers in the task definition • Container CPU is optional. By default all containers get an equal share of task CPU time • Specify container CPU to control relative sharing among containers In our example: scorekeep-frontend = 256; scorekeep-api = 768; Task CPU = 1024 scorekeep-api container scorekeep-frontend container Container 1 Container 2 Task CPU = 1024
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CONTAINER MEMORY SHARING • Task memory is the total memory available for all containers • Container level memory settings are optional. By default all task memory is available to all containers • Memory reservation is a soft lower bound. Can kick in when task memory is under contention In our example: scorekeep-frontend = 512 mb; scorekeep-api = 512 mb; • Memory is a hard upper bound. Container will not be allowed to grow beyond this value Task Memory = 2 gb scorekeep-api container scorekeep-frontend container Available for all Container 1 Container 2Available for all Task Memory = 2 gb non-critical container critical container Task Memory = 2gb Memory Reservation Memory Reservation Memory Reservation Hard Memory Limit
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. TASK CPU MEMORY CONFIGURATIONS 50 different CPU/Memory configurations to choose from CPU Memory 256 units (.25 vCPU) 512MB, 1GB, 2GB 512 units (.5 vCPU) Between 1GB & 4GB in 1GB increments 1024 units (1 vCPU) Between 2GB & 8GB in 1GB increments 2048 units (2 vCPU) Between 4GB & 16GB in 1GB increments 4096 units (4 vCPU) Between 8GB & 30GB in 1GB increments
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. PLATFORM VERSION What is it? • It refers to a specific runtime environment around your task • Combination of Kernel version & container runtime version • Available today: 1.0.0 • New versions will be released as the runtime environment evolves: Kernel/OS updates, new features, bug fixes, and security updates Why expose it? • Gives you explicit control over • Migration to new platform versions • Rollback to previous platform versions How do I use it? $ aws ecs run-task ... --platform-version 1.0.0 $ aws ecs run-task ... --platform-version LATEST #or just leave it blank
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. F A R G A T E C O N S T R U C T S C O M P U T E NETWORKING P E R M I S S I O N S L O G G I N G & D E B U G G I N G S T O R A G E S C O R E K E E P D E M O
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. VPC INTEGRATION 172.31.0.0/16 Subnet 172.31.1.0/24 Internet Other Entities in VPC EC2 LB DB etc. Private IP 172.31.1.164 Launch your Fargate Tasks into subnets Under the hood : • We create an Elastic Network Interface (ENI) • The ENI is allocated a private IP from your subnet • The ENI is attached to your task • Your task now has a private IP from your subnet! You can assign public IPs to your tasks Configure security groups to control inbound & outbound traffic Spread your application across subnets in multiple Availability Zones (AZs) for high redundancy us-east-1a us-east-1b us-east-1c ENI Fargate TaskPublic / 208.57.73.13 /
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. VPC CONFIGURATION { "family": "scorekeep", "cpu": "1 vCpu", "memory": "2 gb", "networkMode": "awsvpc", "containerDefinitions": [ { "name":“scorekeep-frontend", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe", "cpu": 256, "memoryReservation": 512 }, { "name":“scorekeep-api", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api", "cpu": 768, "memoryReservation": 512 } ] } $ aws ecs run-task ... -- task-definition scorekeep:1 -- network-configuration “awsvpcConfiguration = { subnets=[subnet1-id, subnet2-id], securityGroups=[sg-id] }” Enables ENI creation & attachment to Task Run Task Task Definition
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. INTERNET ACCESS The Task ENI is used for all inbound & outbound network traffic to and from your task It is also used for: • Image Pull (from ECR or a public repository) • Pushing to Amazon CloudWatch logs Both these endpoints need to be reachable via your task ENI Two common modes of setup: • Private with no inbound internet traffic, but allows outbound internet access • Public task with both inbound and outbound internet access
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. PRIVATE TASK SETUP Public subnet Private subnet Fargate TaskENI Private IP 172.31.1.164 NAT Gateway Public EIP 34.214.162.237 Internet Gateway 172.31.0.0/16 172.31.2.0/24 172.31.1.0/24 Destination Target 172.31.0.0/16 local 0.0.0.0/0 NAT Gateway Destination Target 172.31.0.0/16 local 0.0.0.0/0 Internet Gateway Route Tables Internet Attach Internet Gateway to VPC Setup a Public Subnet with • Route to Internet Gateway • NAT Gateway Setup Private Subnet with • Fargate Task • Route to NAT Gateway Security Group to allow outbound traffic Type Port Destination All Traffic ALL 0.0.0.0/0 Outbound Security Group Rules
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Outbound Inbound PUBLIC TASK SETUP Public subnet Fargate Task Public IP 54.191.135.66 Internet Gateway 172.31.0.0/16 172.31.2.0/24 Destination Target 172.31.0.0/16 local 0.0.0.0/0 Internet Gateway Route Table Internet ENI $ aws ecs run-task ... -- task-definition scorekeep:1 -- network-configuration “awsvpcConfiguration = { subnets=[public-subnet], securityGroups=[sg-id], }” Launch the task into a Public subnet Give it a public IP address Security Group to allow the expected inbound traffic Discover the public IP by describing the ENI attached to the task Type Port Source HTTP 8080 0.0.0.0/0 Inbound Security Group Rule Type Port Destination All Traffic ALL 0.0.0.0/0 Outbound Security Group Rules assignPublicIp=ENABLED
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ELB SETUP • ELB integration supported on services • ALB & NLB supported • ALB requires that you pick at least two subnets in two different AZs • Ensure that the ALB subnet AZs are a superset of your task subnet AZs • Select ALB Target type: IP (not Instance)
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ELB CONFIGURATION { "family": "scorekeep", "cpu": "1 vCpu", "memory": "2 gb", "networkMode": “awsvpc“, "containerDefinitions": [ { "name":“scorekeep-frontend", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe", "cpu": 256, "memoryReservation": 512, "portMappings": [ { "containerPort": 8080 } ] }, { "name":“scorekeep-api", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api", "cpu": 768, "memoryReservation": 512, "portMappings": [ { "containerPort": 5000 } ] } ] } $ aws ecs create-service ... -- task-definition scorekeep:1 -- network-configuration “awsvpcConfiguration = { subnets=[subnet-id], securityGroups=[sg-id] }” -- load-balancers “[ { "targetGroupArn": “<insert arn>", "containerName": “scorekeep-frontend", "containerPort": 8080 } ]” Create Service Task Definition
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. INTERNET FACING ELB SETUP Public subnet Private subnet Fargate TaskENI Private IP 172.31.1.164 :8080 ALB Public IP 208.57.73.13 :80 172.31.0.0/16 172.31.2.0/24 172.31.1.0/24 Internet Task in private subnet with private IP ALB in public subnet with public IP Make sure the AZs of the two subnets match ALB security group to allow inbound traffic from internet Task security group to allow inbound traffic from the ALB’s security group Task Security GroupALB Security Group Type Port Source HTTP 80 0.0.0.0/0 Inbound Rule Type Port Source Custom TCP 8080 ALB Security Group Inbound Rule us-east-1a us-east-1a
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. F A R G A T E C O N S T R U C T S C O M P U T E N E T W O R K I N G PERMISSIONS L O G G I N G & D E B U G G I N G S T O R A G E S C O R E K E E P D E M O
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. PERMISSION TIERS Cluster Permissions Application Permissions Task Housekeeping Permissions Cluster Fargate Task Cluster Permissions: Control who can launch, stop and describe tasks in your cluster Application Permissions: Allows your application containers to access AWS resources securely Housekeeping Permissions: Allows us to perform housekeeping activities around your task: • ECR Image Pull • CloudWatch logs pushing • ENI creation • Register/Deregister targets into ELB
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLUSTER PERMISSIONS { "Effect": "Allow", "Action": [ "ecs:RunTask" ], "Condition": { "ArnEquals": {"ecs:cluster":"<cluster-arn>"} }, "Resource": [ “<task_def_family>:*" ] } You can tailor IAM policies for fine grained access control to your clusters Attach these policies to IAM Users and/or Roles as necessary Some example policies: Example 1: Allow RunTask in a specific cluster with a specific task definition only { "Effect": "Allow", "Action": [ "ecs:ListTasks“, “ecs:DescribeTasks” ], "Condition": { "ArnEquals": {"ecs:cluster":"<cluster-arn>"} }, "Resource": “*” } Example 2: Read-only access to tasks in a specific cluster and many more!
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. APPLICATION PERMISSIONS Do your application containers access other AWS resources? Need to get credentials down to the task? Create an IAM Role with the requisite permissions that your application needs. In our scorekeep example, DynamoDB & SNS permissions. Establish a trust relationship with ecs-tasks.amazonaws.com on that role. This lets us assume the role and wire the credentials down to your task. Add the role arn to your task definition and you’re done! AWS CLI/SDK calls from within your application will automatically use the Task Role credentials Credentials are temporary and rotated periodically Use a Task Role { "family": "scorekeep", "cpu": "1 vCpu", "memory": "2 gb", "networkMode": “awsvpc“, “taskRoleArn": “arn:aws...role/scorekeepRole“, "containerDefinitions": [ { "name":“scorekeep-frontend", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe", "cpu": 256, "memoryReservation": 512, "portMappings": [ { "containerPort": 8080 } ] }, { "name":“scorekeep-api", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api", "cpu": 768, "memoryReservation": 512, "portMappings": [ { "containerPort": 5000 } ] } ] } Task Definition
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. HOUSEKEEPING PERMISSIONS • We need certain permissions in your account to bootstrap your task and keep it running. • Execution Role gives us permissions for: • ECR Image Pull • Pushing to CloudWatch logs • ECS Service Linked Role gives us permissions for: • ENI Management • ELB Target Registration/Deregistration
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. EXECUTION ROLE • Using an ECR Image or CloudWatch Logs? • Create an IAM Role. Add Read Permissions to ECR. Add Write Permissions to CloudWatch Logs • Establish trust relationship with ecs-tasks.amazonaws.com. This lets us assume the role • Add the execution role arn into your task definition Give us permissions via an Execution Role { "family": "scorekeep", "cpu": "1 vCpu", "memory": "2 gb", "networkMode": “awsvpc“, “taskRoleArn": “arn:aws...role/scorekeepRole“, “executionRoleArn": “arn:aws...role/scorekeepExecutionRole“, "containerDefinitions": [ { "name":“scorekeep-frontend", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/fe", "cpu": 256, "memoryReservation": 512, "portMappings": [ { "containerPort": 8080 } ] }, { "name":“scorekeep-api", "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/api", "cpu": 768, "memoryReservation": 512, "portMappings": [ { "containerPort": 5000 } ] } ] } Task Definition
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ECS SERVICE LINKED ROLE • A service-linked role is a unique type of IAM role that is linked directly to an AWS service, in this case ECS • It has a predefined policy, that is immutable. In this case, ENI & ELB permissions • It has a trust relationship with ecs.amazonaws.com. Allows us to assume the role and perform ENI & ELB management on your behalf • It is automatically created in your account at cluster creation time • You don’t have to explicitly pass this role in the task definition or any API call • Just know about it in case you stumble upon it in the IAM console
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. F A R G A T E C O N S T R U C T S C O M P U T E N E T W O R K I N G P E R M I S S I O N S LOGGING & DEBUGGING S T O R A G E S C O R E K E E P D E M O
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLOUDWATCH LOGS CONFIGURATION • Use the awslogs driver to send stdout from your application to CloudWatch logs • Create a log group in CloudWatch • Configure the log driver in your task definition { "family": "scorekeep", ... "containerDefinitions": [ { "name":“scorekeep-frontend", ... "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "scorekeep", "awslogs-region": “us-east-1", "awslogs-stream-prefix": "scorekeep/frontend“}} }, { "name":“scorekeep-api", ... "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "scorekeep", "awslogs-region": “us-east-1", "awslogs-stream-prefix": "scorekeep/api"}} } ]} Task Definition
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLOUDWATCH LOGS Logs Tab in the Task Detail Page View logs in the ECS or CloudWatch Console
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLOUDWATCH METRICS FOR SERVICES ScorekeepService ScorekeepService Metrics tab in the service detail page
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DEBUGGING TIPS Task is not RUNNING? Inspect container stopped reason in the Task Detail page or via DescribeTasks API Task in STOPPED state Inspect Container Stopped Reasons
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DEBUGGING TIPS Service not scaling as expected? Check activity log in the Service Events tab or DescribeServices API Events Tab in the Service Detail Page Inspect activity messages Drill down into the task detail page for more
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. F A R G A T E C O N S T R U C T S C O M P U T E N E T W O R K I N G P E R M I S S I O N S L O G G I N G & D E B U G G I N G STORAGE S C O R E K E E P D E M O
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. STORAGE Layer Storage Space : 10 GB per task Ephemeral storage backed by Amazon EBS Volume for scratch space • 4 GB per task • Mount points specified in Task Definition • Can be shared among containers
  • 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. F A R G A T E C O N S T R U C T S C O M P U T E N E T W O R K I N G P E R M I S S I O N S L O G G I N G & D E B U G G I N G S T O R A G E SCOREKEEP DEMO
  • 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "family": "scorekeep", "cpu": "1 vCpu", "memory": "2 gb", "networkMode":"awsvpc", "taskRoleArn": "arn:aws:…", "executionRoleArn": “arn:…”, "requiresCompatibilities": [ "FARGATE" ], "containerDefinitions": […] } { "name": "scorekeep-frontend", "image":“xxx.dkr.ecr…frontend", "cpu": 256, "memoryReservation": 512, "portMappings" : [ { "containerPort": 8080 } ], "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "scorekeep", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "scorekeep/frontend" } } } { "name": "scorekeep-api", "image":“xxx.dkr.ecr…api", "cpu": 768, "memoryReservation": 512, "portMappings" : [ { "containerPort": 5000 } ], "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "scorekeep", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "scorekeep/api” } }, "environment": […] #env var } SCOREKEEP TASK DEFINITION Task Definition scorekeep-frontend Container Definition scorekeep-api Container Definition
  • 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. LET’S RUN IT! Register Task Definition $ aws ecs register-task-definition --cli-input-json file:///scorekeep-task-definition.json Create Cluster $ aws ecs create-cluster --cluster-name FargateDemoCluster Run Task $ aws ecs run-task --cluster FargateDemoCluster --task-definition scorekeep:1 --launch-type FARGATE --count 1 --network-configuration "awsvpcConfiguration={subnets=[subnet-xxx], securityGroups=[sg-xxx]}" Create Service $ aws ecs create-service --service-name ScorekeepService --cluster FargateDemoCluster --task-definition scorekeep:1 --launch-type FARGATE –desired-count 5 --network-configuration "awsvpcConfiguration={subnets=[subnet-xxx], securityGroups=[sg-xxx]}“ --load-balancer “[{"targetGroupArn":“arn:aws:xxx", "containerName":“scorekeep-frontend", "containerPort":8080}]”
  • 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. THANK YOU! http s: / / aws. am azo n. c o m / f ar g ate /