how to delete compute environment that is invalid ?

0

I run the command

aws batch delete-compute-environment --compute-environment batch-environment

It returns with no other messages but the compute environment still persist.

質問済み 2年前2835ビュー
3回答
0
承認された回答

Please check if service role of the compute environment exists. AWS Batch uses service roles to manage EC2 and ECS resources on your behalf. Is the role had been deleted prior to deleting the compute environment, then AWS Batch is not able to delete the compute resources and the enters INVALID state. In case if the role was deleted, then create service role again with the same name and try deleting the compute environment again.

回答済み 2年前
エキスパート
John_F
レビュー済み 2年前
  • Yes, the service role still exists.

    I have gone into the Batch web ui to look again and see this STATUS

    INVALID - CLIENT_ERROR - User: arn:aws:sts::xxxxxxxxxx:assumed-role/batch_role/aws-batch is not authorized to perform: ecs:ListClusters on resource: * because no identity-based policy allows the ecs:ListClusters action (Service: AmazonECS; Status Code: 400; Error Code: AccessDeniedException; Request ID: zzzzzzzzzzzzzzzzzzzzzzzzz; Proxy: null)

    Is the deletion problem due to the service role not having the right permissions ? If so, what permission should I set it to ?

  • Yes, it needs ecs:ListClusters action and some others. Please compare your role's permissions with those described in the documentation here https://docs.aws.amazon.com/batch/latest/userguide/service_IAM_role.html

0

If you don't have a Spot Fleet role, complete the following steps to create one for your compute environment:

  1. Open the IAM console.

  2. In the navigation pane, choose Roles.

  3. Choose Create role.

  4. Choose AWS service. Then, choose EC2 as the service that will use the role that you're creating.

  5. In the Select your use case section, choose EC2 Spot Fleet Role. Important: Don't choose the similarly named EC2 - Spot Fleet.

  6. Choose Next: Permissions.

  7. Choose Next: Tags. Then, choose Next: Review.

  8. For Role name, enter AmazonEC2SpotFleetRole.

  9. Choose Create role. Note: Use your new Spot Fleet role to create new compute environments. Existing compute environments can't change Spot Fleet roles. To get rid of the obsolete environment, deactivate and then delete that environment.

  10. Open the AWS Batch console.

  11. In the navigation pane, choose Compute environments.

  12. Choose the compute environment that's in the INVALID state. Then, choose Disable.

  13. Choose Delete.

Deactivate and delete your compute environment You must deactivate and delete your compute environment because the launch template associated with your compute environment doesn't exist. This means that you can't use the compute environment associated with your launch template. You must delete that compute environment, and then create a new compute environment.

  1. Open the AWS Batch console.

  2. In the navigation pane, choose Compute environments.

  3. Select the compute environment that's in the INVALID state. Then, choose Disable.

  4. Choose Delete.

  5. Create a new compute environment.

Deactivate and then activate your compute environment

  1. Open the AWS Batch console.

  2. In the navigation pane, choose Compute environments.

  3. Choose the compute environment that's in the INVALID state. Then, choose Disable.

  4. Choose the same compute environment from step 3. Then, choose Enable.

Related information

回答済み 2年前
0

The suggested steps:

  1. Open the AWS Batch console.
  2. In the navigation pane, choose Compute environments.
  3. Select the compute environment that's in the INVALID state. Then, choose Disable.
  4. Choose Delete.

did not work in my situation. The compute environment is still there.

Cheers

回答済み 2年前

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

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

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

関連するコンテンツ