๐Ÿ“š AWS 1x1 - ๐—˜๐—–๐—ฆ

Easily run, stop, and manage containers in the cloud.

All you need to know about tasks, task definitions, clusters & containers โ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐˜„ ๐Ÿงต

โ€ข About Docker
โ€ข Fundamentals
โ€ข Task Definitions
โ€ข Tasks
โ€ข Services
โ€ข Clusters
โ€ข Container Instances vs. Fargate

{ 1/17 }
๐——๐—ผ๐—ฐ๐—ธ๐—ฒ๐—ฟ

Before getting started with ECS, you need to understand Docker, because it's one of the basic building blocks.

Docker helps to create environments to run your application, regardless of the underlying operating system.

{ 2/17 }
This lightweight environment is called a ๐——๐—ผ๐—ฐ๐—ธ๐—ฒ๐—ฟ ๐—ฐ๐—ผ๐—ป๐˜๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฟ and contains everything that is needed to run your application, e.g. certain versions of a library or language.

You can even run multiple containers on the same machine.

{ 3/17 }
Containers can even communicate with each other when needed.

You may have already guessed: looking at a growing application, there will be soon challenges in managing all those containers: deployments, scheduling, scaling and more will be a tedious task.

{ 4/17 }
That's where you'll be in need of a ๐—ฐ๐—ผ๐—ป๐˜๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฟ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ.

It's another abstracting layer helping you to easily manage your containerized applications and reduce your operational tasks.

That's where ECS comes in!

{ 5/17 }
Amazons ๐—˜lastic ๐—–ontainer ๐—ฆervice is a highly scalable & fast container management service.

It allows you to view & manage the state of your clusters from a centralized service. Easily schedule based on resource needs & availability requirements.

{ 6/17 }
Let's have a look at two different areas of responsibility:
โ€ข Lifecycle management of your tasks
โ€ข Actually running your containers

ECS does not actually execute or run your containers. It only provides the management pane for controlling your tasks.

{ 7/17 }
So finally to the important question: which services actually run our containers?

You can either pick from using ๐—˜๐—–๐Ÿฎ ๐—ถ๐—ป๐˜€๐˜๐—ฎ๐—ป๐—ฐ๐—ฒ๐˜€ (that have the ECS Container Agent running) or ๐—™๐—ฎ๐—ฟ๐—ด๐—ฎ๐˜๐—ฒ Launch Type

So it's not ECS ๐—ผ๐—ฟ Fargate, but ECS ๐—ฎ๐—ป๐—ฑ Fargate.

{ 8/17 }
Let's dig into ECS' ๐—ž๐—ฒ๐˜† ๐—ง๐—ฒ๐—ฟ๐—บ๐˜€, which can be confusing at first but are crucial to understanding how it's internally working:

โ€ข Task Definition
โ€ข Task
โ€ข Service
โ€ข Cluster

{ 9/17 }
A ๐—ง๐—ฎ๐˜€๐—ธ ๐——๐—ฒ๐—ณ๐—ถ๐—ป๐—ถ๐˜๐—ถ๐—ผ๐—ป is a blueprint of your container. It includes things like

โ€ข the image to use (e.g. exakt ECR URL)
โ€ข CPU & memory allocation
โ€ข secrets & environment vars
โ€ข logging configuration
โ€ข exposed ports

{ 10/17 }
A ๐—ง๐—ฎ๐˜€๐—ธ is an actual instance that runs the containers that are defined in your definition.

You can run multiple tasks from the same definition if this is required (e.g. for redundancy or traffic demands).

{ 11/17 }
๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ

As we can have several tasks for the same definition, we need some boundaries and management. This is where the service comes in.

It defines how auto-scaling & load distribution is handled and what are the minimum & maximum tasks.

{ 12/17 }
Auto-Scaling rules can be for example that a new task is started if the CPU load exceeds a certain threshold for a defined period of time - or when an existing task is gracefully stopped if the load is too low.

{ 13/17 }
A ๐—–๐—น๐˜‚๐˜€๐˜๐—ฒ๐—ฟ is a logical grouping of tasks or services which run on infrastructure that is registered to such a cluster.

If you're using EC2 launch types, it's a set of container instances you manage. If using Fargate, infrastructure capacity is provided by AWS.

{ 14/17 }
You can even provide your on-premise virtual machines as compute capacities for your cluster.

Additionally, it's possible to have a cluster with ๐—บ๐—ถ๐˜…๐—ฒ๐—ฑ tasks hosted on Fargate, EC2 instances, or even external instances.

{ 15/17 }
ECS Container Instance vs. Fargate

If you have very high computation requirements, you should know that Fargate is way more restrictive regarding what capacities are possible within a single task.

โ€ข ๐˜ƒ๐—–๐—ฃ๐—จ๐˜€: 448 vs. 4
โ€ข ๐— ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†: 26TB vs. 30 GB

{ 16/17 }
Even if you're a big serverless fan, knowing about ECS is crucial because you'll bump into it almost everywhere.

Considering the abstraction layer of ECS in combination with Fargate, it's considered a serverless technology.

{ 17/17 }
That's it for the fundamentals - thank you for reading!

If you've liked this thread, โ™ป๏ธ or โ™ฅ๏ธthe initial post & follow me for more regular cloud content ๐ŸŒค

Also, comment or drop me a message about topics you're interested in! ๐Ÿ“จ

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Tobias Schmidt

Tobias Schmidt Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @tpschmidt_

5 Nov
๐Ÿ“š AWS 1x1 - ๐—ฉ๐—ฃ๐—– & ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ๐—ถ๐—ป๐—ด

Your logically isolated virtual network in the cloud.

From Security Groups, over Route Tables to VPC Peering โ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐Ÿงต

โ€ข VPCs & Subnets
โ€ข Route Tables
โ€ข Internet Gateway
โ€ข NAT Gateways & Instances
โ€ข Security Groups
โ€ข Network Access Control Lists
โ€ข VPC Peering

{ 1/14 }
Maybe you didn't know, but Amazon ๐—ฉirtual ๐—ฃrivate ๐—กetwork is the networking layer for EC2.

This virtual network imitates your local data center, but with all the benefits of the cloud's scalable infrastructure.

Knowing about VPC & networking is crucial.

{ 2/14 }
Read 16 tweets
4 Nov
๐Ÿ“š AWS 1x1 - ๐— ๐—ผ๐—ป๐—ถ๐˜๐—ผ๐—ฟ๐—ถ๐—ป๐—ด & ๐—”๐˜‚๐—ฑ๐—ถ๐˜๐—ถ๐—ป๐—ด ๐—Ÿ๐—ฎ๐—บ๐—ฏ๐—ฑ๐—ฎ

There's a lot that comes out of the box to gain insights into how well your serverless app is performing

A quick overview to get you started โ†“
1๏ธโƒฃ Amazon CloudWatch

CloudWatch automatically monitors your functions on your behalf. It reports a lot of useful metrics:

โ€ข number of invocations
โ€ข execution durations
โ€ข occurred errors
โ€ข function throttles

Everything is exposed on a function level!
2๏ธโƒฃ Amazon CloudTrail

CloudTrail offers you governance, compliance & auditing features for several services, including Lambda.
It enables you to log all (encryption supported!) actions taken regarding your infrastructure, regardless if it's via the console UI or AWS SDK!
Read 6 tweets
3 Nov
๐Ÿ“š ๐—”๐—ช๐—ฆ ๐Ÿญ๐˜…๐Ÿญ - ๐—ฆ๐—ค๐—ฆ

Your fully managed message queue service & a serverless fan's best friend.

From queue types, over visibility timeouts to message groups โ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐Ÿงต

โ€ข Introduction
โ€ข Importance of Messaging Systems
โ€ข Fundamentals
โ€ข Queue Types
โ€ข Visibility Timeouts
โ€ข Retention Periods
โ€ข Limitations

{ 1/22 }
๐—œ๐—ป๐˜๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜๐—ถ๐—ผ๐—ป

Believe it or not: SQS was the ๐—ณ๐—ถ๐—ฟ๐˜€๐˜ publicly launched service by AWS!

Quoting Jeff Bar:
"We launched the Simple Queue Service in ๐—น๐—ฎ๐˜๐—ฒ ๐Ÿฎ๐Ÿฌ๐Ÿฌ๐Ÿฐ, Amazon S3 in early 2006, and Amazon EC2 later that summer."

jeff-barr.com/2014/08/19/my-โ€ฆ

{ 2/22 }
Read 24 tweets
2 Nov
Thanks for all your interest in my AWS 1x1 threads! ๐Ÿ“š ๐Ÿ‘‹

The good news: ๐˜๐—ต๐—ฒ๐—ฟ๐—ฒ'๐˜€ ๐—ฎ ๐—น๐—ผ๐˜ ๐—บ๐—ผ๐—ฟ๐—ฒ ๐—ถ๐—ป ๐˜๐—ต๐—ฒ ๐—ฝ๐—ถ๐—ฝ๐—ฒ๐—น๐—ถ๐—ป๐—ฒ!
... also for Azure ๐Ÿ’™

Didn't see the previous ones yet?
๐—Ÿ๐—ถ๐—ป๐—ธ๐˜€ ๐˜๐—ผ ๐—ฎ๐—น๐—น ๐—บ๐˜† ๐—ฟ๐—ฒ๐—ฐ๐—ฒ๐—ป๐˜ ๐—ฝ๐—ผ๐˜€๐˜๐˜€ ๐—ฎ๐—ฟ๐—ฒ ๐—ฏ๐—ฒ๐—น๐—ผ๐˜„ โ†“
1๏ธโƒฃ ๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—ด๐—ฒ๐˜ ๐˜€๐˜๐—ฎ๐—ฟ๐˜๐—ฒ๐—ฑ ๐˜„๐—ถ๐˜๐—ต ๐—”๐—ช๐—ฆ

2๏ธโƒฃ ๐—ก๐—ผ๐˜ ๐—ณ๐—ฒ๐—ฎ๐—ฟ๐—ถ๐—ป๐—ด ๐—–๐—ผ๐˜€๐˜๐˜€ ๐—ผ๐—ณ ๐˜๐—ต๐—ฒ ๐—–๐—น๐—ผ๐˜‚๐—ฑ

Read 7 tweets
27 Oct
๐Ÿ“š AWS 1x1: ๐—ช๐—ต๐—ฎ๐˜ ๐—ฎ๐—ฟ๐—ฒ ๐—Ÿ๐—ฎ๐—บ๐—ฏ๐—ฑ๐—ฎ ๐˜๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ๐˜€?

For a function to execute, an event must occur.
Most know about API Gateway for REST services as an event source.

But a lot more AWS resources can trigger your Lambda โ†“
Almost anything that happens within your AWS account is an event.

โ€ข writing a record to DynamoDB
โ€ข uploading a file to S3
โ€ข queuing a message in SQS
โ€ข a viewer request to your CloudFront distribution

All of those events can be used to trigger a Lambda function.

{ 1/12 }
There are two different kinds of invocation types: ๐˜€๐˜†๐—ป๐—ฐ๐—ต๐—ฟ๐—ผ๐—ป๐—ผ๐˜‚๐˜€ & ๐—ฎ๐˜€๐˜†๐—ป๐—ฐ๐—ต๐—ฟ๐—ผ๐—ป๐—ผ๐˜‚๐˜€

Synchronous event sources need to wait for your Lambda function to return a response.
Asynchronous don't.

If invoking functions via the SDK, this can be specified!

{ 2/12 }
Read 14 tweets
26 Oct
๐Ÿ“š Cloud 1x1 - ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ๐—น๐—ฒ๐˜€๐˜€ ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฎ๐—น ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป๐˜€

You don't need to re-invent the wheel.
You can rely on field-tested patterns.

Let's explore some common ones โ†“
๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„

โ€ข Fan-in & Fan-out
โ€ข Simple Web Service
โ€ข Publish/Subscribe
โ€ข Strangler
โ€ข Aggregator

{ 1/7 }
๐—™๐—ฎ๐—ป-๐—ถ๐—ป & ๐—™๐—ฎ๐—ป-๐—ผ๐˜‚๐˜

Common problem: large tasks that are exceeding Lambda's execution time limit
With Fan-out, you're splitting those large tasks into small ones and delegating those to Lambda workers.
Afterward, results are aggregated (= Fan-in).

{ 2/7 }
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Thank you for your support!

Follow Us on Twitter!

:(