How to enable my Task scale-in protection endpoint

0

When I try to start a task running on EC2, I use SSH to log into the container and use

curl --request PUT --header 'Content-Type: application/json' ${ECS_AGENT_URI}/task-protection/v1/state --data '{"ProtectionEnabled":true}'

to enable the Task scale-in protection endpoint. However, I found that the ECS_AGENT_URI is not in my environment variables. result is

curl: (3) URL rejected: No host part in the URL
storm
質問済み 4ヶ月前388ビュー
1回答
1

Does the ECS task role have a policy which allows the 2 following IAM Permissions?

  • ecs:GetTaskProtection:
  • ecs:UpdateTaskProtection

What version of the ECS Container agent are you running? It needs to be 1.65.0 or later

How To:- https://www.trendmicro.com/cloudoneconformity-staging/knowledge-base/aws/ECS/latest-agent-version.html

profile picture
エキスパート
回答済み 4ヶ月前
  • thanks. I have try to add the policy:

    {
    	"Version": "2012-10-17",
    	"Statement": [
    		{
    			"Effect": "Allow",
    			"Action": [
    				"ecs:GetTaskProtection",
    				"ecs:UpdateTaskProtection"
    			],
    			"Resource": "*"
    		}
    	]
    }
    

    into my ec2 ECS task role and definition task role , but still

    [root@47a50edab60a ~]# curl --request PUT --header 'Content-Type: application/json' ${ECS_AGENT_URI}/task-protection/v1/state --data '{"ProtectionEnabled":true}'
    curl: (3) URL rejected: No host part in the URL
    

    my ecs-agent version is 1.79.2 and the doc mentioned with the "This operation is only supported for tasks belonging to an Amazon ECS service. Invoking this operation for a standalone task will result in an TASK_NOT_VALID failure." https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateTaskProtection.html maybe my task is standalone task? But my task is running as ecs task in ec2 auto scaling.

  • EC2 AutoScaling is for launching instances into your cluster. You can then either launch standalone tasks onto those cluster instances, or create an ECS Service to manage multiple tasks for the same Task Definition. If you went through the workflow of launching a single task, its a standalone task.

    However, I don't think shouldn't be causing the error you see now (it might cause an error after this first one is fixed, but your failure is earlier in the process)

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ