Skip to content

Conversation

@YutaOkoshi
Copy link

@YutaOkoshi YutaOkoshi commented Sep 27, 2025

Summary

Adds ECS Service Linked Role (AWSServiceRoleForECS) to sandbox account resources to resolve ECS cluster creation failures

Screenshot from 2025-09-27 10-08-57

Changes

  • Add CfnServiceLinkedRole for ECS service in IsbSandboxAccountResources
  • Configure proper cleanup exclusion for IAMServiceLinkedRole in nuke-config.yaml
  • Add cfn-guard suppression using direct metadata approach

Problem Solved

Fixes "Unable to assume the service linked role" error when creating ECS clusters in sandbox accounts.

Testing

  • ✅ Build successful
  • ✅ Infrastructure tests pass
  • ✅ Snapshots updated

Ensures ECS clusters can be created in the sandbox account without permission issues by adding the ECS service-linked role to the Nuke configuration. This prevents Nuke from deleting the role and causing issues when creating ECS clusters.
Simplifies the creation of the ECS service-linked role by using `CfnServiceLinkedRole` instead of manually defining the role and its policies.

This change also removes unnecessary suppressions for cfn-guard, as the `CfnServiceLinkedRole` doesn't support `cfnOptions`.
The nuke config is also updated to reflect the changes.
@YutaOkoshi
Copy link
Author

Hi @aws-khargita !
I imagine many people test-run ECS clusters in Sandbox environments, so if you'd be so kind, I'd appreciate your review.

@smartberry1122
Copy link

Help needed

- property: RoleName
type: glob
value: aws-controltower-*
IAMServiceLinkedRole:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this will cause any customizations to the nuke configuration to be rolled back on update. This is how CloudFormation behaves with the HostedConfiguration resource.

We are planning on making some changes to preserve any customizations in the configuration files while still allowing updates like this, but unfortunately we can not merge this in it's current state.

Sorry for the inconvenience, we will get this sorted out in the future.

@aws-khargita
Copy link
Member

@smartberry1122, @YutaOkoshi

Hi, I appreciate you opening this pull request. Unfortunately, the change to the nuke config will result in the AppConfig configuration being rolled back to the default content on stack update, which may cause issues for users updating the solution.

We are planning to address this upgrade issue in the next release, where we can hopefully incorporate this change.

In the meantime, if you are deploying from source, the changes made here should allow for the creation of ECS clusters. Apologies for any inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants