question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

aws-ecs-patterns fail to deploy when not opted into ECS managed tags

See original GitHub issue

🐛 Bug Report

What is the problem?

Deploying an aws-ecs-patterns to an AWS tenant that is not opted into the ECS Managed Tags feature will fail. This is can be resolved by adding the feature to set the enableECSManagedTags property to false through the LoadBalancedServiceBaseProps.

Reproduction Steps

  1. (In my case) Deploy a LoadBalancedFargateService to an AWS tenant that is not opted into the ECS Managed Tags feature.
  2. Cloudformation will return the error “The new ARN and resource ID format must be enabled to work with ECS managed tags. Opt in to the new format and try again.” when deploying the ECS service.
  3. (Hacky solution) In load-balanced-fargate-service.js, add enableECSManagedTags: false to the “Service” props and the stack will deploy.

Verbose Log

The new ARN and resource ID format must be enabled to work with ECS managed tags. Opt in to the new format and try again. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: 91d4b3b3-8529-40b1-9b55-16f820f23743)
        new BaseService (/projects/fargate-pwa-starter-kit/server/node_modules/@aws-cdk/aws-ecs/lib/base/base-service.js:39:25)
        \_ new FargateService (/projects/fargate-pwa-starter-kit/server/node_modules/@aws-cdk/aws-ecs/lib/fargate/fargate-service.js:30:9)
        \_ new LoadBalancedFargateService (/projects/fargate-pwa-starter-kit/server/node_modules/@aws-cdk/aws-ecs-patterns/lib/fargate/load-balanced-fargate-service.js:30:24)
        \_ new BonjourFargate (/projects/fargate-pwa-starter-kit/server/dist/index.js:31:32)
        \_ Object.<anonymous> (/projects/fargate-pwa-starter-kit/server/dist/index.js:52:1)
        \_ Module._compile (module.js:653:30)
        \_ Object.Module._extensions..js (module.js:664:10)
        \_ Module.load (module.js:566:32)
        \_ tryModuleLoad (module.js:506:12)
        \_ Function.Module._load (module.js:498:3)
        \_ Function.Module.runMain (module.js:694:10)
        \_ startup (bootstrap_node.js:204:16)
        \_ bootstrap_node.js:625:3

Environment

  • CDK CLI Version: 1.6.0
  • Module Version: 1.6.0
  • OS: OSX Mojave
  • Language: TypeScript/all

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
NukaCodycommented, Sep 2, 2019

Opting in by default (at root level) for the lazy

#!/bin/bash
aws ecs put-account-setting-default --name serviceLongArnFormat --value enabled
aws ecs put-account-setting-default --name taskLongArnFormat --value enabled
aws ecs put-account-setting-default --name containerInstanceLongArnFormat --value enabled
aws ecs put-account-setting-default --name awsvpcTrunking --value enabled
aws ecs put-account-setting-default --name containerInsights --value enabled

If you are using CodePipeline, you have to attach a managed policy to your pipeline object as well as opting in.

devPipeline.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonEC2ContainerServiceforEC2Role'))

If that doesn’t work, and this is a dev env, try admin

devPipeline.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess'))

Reference: ECS: Migrating to new ARN

2reactions
claabscommented, Sep 9, 2019

I’m able to successfully deploy to a non-opted-in account on 1.7.0 thanks to #3887.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot issues related to tagging tasks in Amazon ECS
You're unable to add tags to your ECS resources due to missing AWS Identity and Access Management (IAM) permissions or tag restrictions.
Read more >
Best practices for CI/CD using AWS Fargate and Amazon ECS
Safe deployments. Page 57. Best practices for CI/CD. 3. Repeatable infrastructure changes. 1. Automated releases. 2. Safe.
Read more >
@aws-cdk/aws-ecs-patterns - npm
The CDK Construct Library for AWS::ECS. Latest version: 1.183.0, last published: 3 days ago. Start using @aws-cdk/aws-ecs-patterns in your ...
Read more >
8 - ECS Troubleshooting - Harness.io Docs
General troubleshooting steps for ECS deployments. ... If you have not opted into the new ECS ARN and resource ID format before you ......
Read more >
AWS ECS service error: Task long arn format must be enabled ...
It seems like you are Tagging Your Amazon ECS Resources but you did not opt-in to this feature so you have to opt-in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found