Download - Amazon EC2 Container Service: Deep Dive
![Page 1: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/1.jpg)
Daniele Stroppa
AWS Solutions Architect
@moviolone
Amazon EC2 Container Service:
Deep Dive
![Page 2: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/2.jpg)
Agenda
• Cluster management
• Container scheduling
• Container deployment
• Scaling Amazon ECS
• Logging & Monitoring
• Service discovery
![Page 3: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/3.jpg)
Cluster management
![Page 4: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/4.jpg)
![Page 5: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/5.jpg)
Cluster management with Amazon ECS
• Management of followers via ECS Agent
• Dispatching of sub-tasks to proper location
• Cluster state inspection
http://amzn.to/1jlHvnU
![Page 6: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/6.jpg)
Cluster management under the hood
• Paxos-based transactional journal based data store
• Writes are committed as transaction in the journal with
order-based ID. The current value is the sum of all
transactions made as recorded by the journal.
• Reads are simply a snapshot in time of the journal. For a
write to succeed, the write proposed must be the latest
transaction since the last read.
http://bit.ly/1M9gGiv
![Page 7: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/7.jpg)
Container scheduling
![Page 8: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/8.jpg)
Amazon ECS Schedulers
• Task scheduler
• Run tasks once
• Batch jobs
• Service scheduler
• Load balancing
• Health management
• Scale-up and scale-down
• Update management
• AZ aware
![Page 9: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/9.jpg)
Custom Schedulers
1. Calls the ECS List* and Describe* API operations to
determine the current state of the cluster.
2. Selects one (or more) container instances according to
the logic implemented.
3. Calls StartTask API to start a task on the selected
container instance.
http://amzn.to/1L9jmHT
![Page 10: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/10.jpg)
Integration with Apache Mesos schedulers
• Allows you to use Apache Mesos schedulers like
Marathon and Chronos with ECS
• The ECSSchedulerDriver interprets the command given
when scheduling jobs with Mesos and starts a task with
TaskDefinition family:revision
http://bit.ly/1WXd6L3
![Page 11: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/11.jpg)
Container deployment
![Page 12: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/12.jpg)
CI/CD Partners
![Page 13: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/13.jpg)
Continuous delivery with Jenkins
Build image
Push image
Update service
![Page 14: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/14.jpg)
Continuous delivery with Jenkins
• Webhook to trigger job execution
• Docker Build and Publish plugin to build Docker image
• Amazon ECS API to update service
• Bonus – Cloudbees ECS plugin to run slave
http://amzn.to/1GbheTp
![Page 15: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/15.jpg)
Amazon ECS CLI
• Easily create Amazon ECS clusters & supporting
resources such as EC2 instances
• Run Docker Compose configuration files on Amazon
ECS
• Available today – http://amzn.to/1jBf45a
![Page 16: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/16.jpg)
Deploy Compose app with Amazon ECS CLI
> ecs-cli compose up
> ecs-cli compose ps
> ecs-cli compose service create
> ecs-cli compose service start
http://amzn.to/1jBf45a
![Page 17: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/17.jpg)
Scaling Amazon ECS
![Page 18: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/18.jpg)
Scaling with Amazon ECS CLI
> ecs-cli scale
> ecs-cli compose scale
> ecs-cli compose service scale
http://amzn.to/1jBf45a
![Page 20: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/20.jpg)
Logging & monitoring
![Page 21: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/21.jpg)
Logging and monitoring on Amazon ECS
• Amazon CloudWatch Logs
• Amazon CloudTrail
• Partners & third party tools
![Page 22: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/22.jpg)
Logging with Amazon CloudWatch Logs
• Centralized logs
• Collect, set up metrics, alarms
• View as graphs
• No need to modify your containers
• One additional container:
• rsyslog
• CloudWatch Logs agent
![Page 23: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/23.jpg)
Logging Amazon ECS API with AWS CloudTrail
{
"eventVersion": "1.03",
"userIdentity": {…},
"eventTime": "2015-10-12T13:57:33Z",
"eventSource": "ecs.amazonaws.com",
"eventName": "CreateCluster",
"awsRegion": "eu-west-1",
"sourceIPAddress": "54.240.197.227",
"userAgent": "console.amazonaws.com",
"requestParameters": {
"clusterName": "ecs-cli"
},
http://amzn.to/1LjJT8N
![Page 24: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/24.jpg)
Logging Amazon ECS API with AWS CloudTrail
"responseElements": {
"cluster": {
"clusterArn": "arn:aws:ecs:eu-west-1:560846014933:cluster/ecs-cli",
"pendingTasksCount": 0,
"registeredContainerInstancesCount": 0,
"status": "ACTIVE",
"runningTasksCount": 0,
"clusterName": "ecs-cli",
"activeServicesCount": 0
}
},
[…]
http://amzn.to/1LjJT8N
![Page 27: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/27.jpg)
Service discovery
![Page 28: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/28.jpg)
Service discovery on Amazon ECS
• Amazon ECS Service Scheduler
• Amazon Route 53 private zone
• Partners & third party tools
![Page 32: Amazon EC2 Container Service: Deep Dive](https://reader034.vdocuments.net/reader034/viewer/2022042611/586fb4671a28abe57d8b7111/html5/thumbnails/32.jpg)
Daniele Stroppa
AWS Solutions Architect
@moviolone
Thank you!