AWS - Batch 和 Fargate 都是 Amazon Web Services(AWS)提供的容器服务。它们都可以用于管理和运行容器应用程序,但有一些区别。
AWS - Batch:
Fargate:
下面给出一个基于 Fargate 的示例:
aws configure
version: '3'
services: app: image: amazon/amazon-ecs-sample memory: 1GB cpu: 1 vCPU network_mode: awsvpc logging: driver: awslogs options: awslogs-region: us-west-2 awslogs-group: my-ecs-app awslogs-stream-prefix: my-app
aws ecs create-cluster --cluster-name my-cluster
aws ecs create-service --cluster my-cluster --service-name my-service --task-definition my-task-definition.yaml --desired-count 1 --launch-type FARGATE --network-configuration "awsvpcConfiguration={subnets=[subnet-12345678],securityGroups=[sg-12345678],assignPublicIp=ENABLED}"
这将在 ECS