[AWS - DA] ECS, ECR, Fargate
ECS
Steps to create a ECS
- Create Cluster: EC2 Linux + Networking
When you created ECS cluster, it comes with Auto Scaling Group, and with ASG, it comes with EC2 instances.
Also created Launch Configuration.
Also create IAM rule for ECS Instance Role.
2. Create ECS Task Definitions
- Tasks definitions are metadata in JSON form to tell ECS how to run a Docker Container.
- Contains crucial information around:
- Image Name
- Port Binding for Container and Host
- Memory and CPU required
- Environment variables
- Networking information
- Task Role: If doesn't come with Task Role, you cannot pull the image from ECR, cannot talk to EC2... It can be created automaticlly
- Container defination
"httpd:2.4": image + tag: ECR knows it comes from Docker Hub
- Port Mapping
- Can be static mapping
- Or dynamic mapping with ALB (set Host port to 0)
3. Create ECS Service
- Will run Task defination
- We can set tup Application Load Balancer
It use Dynamic port mapping, for Host Port, we can set 0.
ECR
Ref to ECR in Task defintion:
Fargate
- Create Cluster with Fargate
- Create Task Defination
- Create Service
- ECS need to use IAM role which attached to EC2 level to perform different action.
- Task Defination need to have ECS Task Role to perform acess different resource.
- When you add a new container, ECS service need to find out which EC2 instances to put new containers
- When remove EC2 isntance, need to find out which one to terminated
Cluster Capacity Provider can decide new Task should run on new EC2 instance or Fargate.
The main question is when should you put multiple containers into the same task definition versus deploying containers separately in multiple task definitions.
You should put muultiple containers in the same task definition if:
- Containers share a common lifecycle (they shoyl dbe alunched and terminated together)
- Containers are required to be run on the same underlying host
- You want your containers to share resources.
- You containers share data volumes
Otherwise, you should define your containers in separate tasks definitions so that you can scale, provision, and deprovision them separately.
"Shared memory"...
相关文章
- [AWS SAP] Architecture Patterns - Monitoring, Logging and Auditing
- [AWS Architecture Patterns] Security
- [AWS - DA - Guru] DynamoDB Exam Tips
- [AWS] Using APIGateway to validate API request
- [AWS DA GURU] IAM
- [AWS] Create a S3 bucket with CORS settings
- [AWS] EC2 - Create Auto Scaling group
- [AWS] Lab - Create and execute a Lambda
- [AWS - DA - Guru] DynamoDB Exam Tips
- [AWS] Signed URL partten
- [AWS] EC2 - Create Auto Scaling group
- [AWS DA - Cloud Fundamentals] 2.4 Security
- AWS负载均衡器的创建步骤
- 什么是AWS Lambda?——事件驱动的函数执行环境
- AWS Academy 简介
- AWS SAA-C02 数据库/数据仓库(RDS/Dynamodb/Redshift)相关考点整理
- 从Spring Boot信息泄露到AWS控制台劫持(攻破aws亚马逊服务器)