1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
2
Hi, if you simply want to get the number of threads in a task, you can run the following command.
root@ip-172-31-1-51:/usr/local/apache2# python3 -c 'import os; print(os.cpu_count())' 2
If you definitely want to get the number of vCPUs, you need to run aws ecs describe-task-definition
command to fetch the vCPU info.
root@ip-172-31-1-51:/usr/local/apache2# PAGER=cat aws ecs describe-task-definition --task-definition MyTaskDefinition --query "taskDefinition.cpu" --output text 256
답변함 8달 전
관련 콘텐츠
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 일 년 전
Yes, section ContainerDefinitions provides what you are after: "containerDefinitions": [ { "environment": [], "name": "wordpress", "links": [ "mysql" ], "mountPoints": [], "image": "wordpress", "essential": true, "portMappings": [ { "containerPort": 80, "hostPort": 80 } ], "memory": 500, "cpu": 10, "volumesFrom": [] },
Thank you. It looks like the Python command you suggest would do the trick, assuming you mean that it can execute inside the container.
The other answer will be trickier since I want to fetch this information from inside the container itself, without requiring direct AWS API access.