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): ECS Exec Support

See original GitHub issue

Add ECS Exec Support to the higher level constructs in ecs-patterns

Use Case

As a user, I want to set the flag enableExecuteCommand: true in my aws-ecs-patterns.ApplicationLoadBalancedFargateService construct.

Proposed Solution

This is currently possible with the ecs module but not the ecs-patterns (see https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ecs-readme.html#ecs-exec-command)

Relevant PRs: https://github.com/aws/aws-cdk/issues/13618 https://github.com/aws/aws-cdk/pull/14670

Solution would be to enable this flag in the higher level ecs-patterns constructs as well.


This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:33
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
camharriscommented, Jul 30, 2021

Here’s how I handled this in typescript, maybe it’s helpful for others. I added the AWS managed police for ssmmessages.

        const ecsDeployment = new ecs_patterns.ApplicationLoadBalancedFargateService(this, 'EcsPattern', {
          ....
        });

        // Add need policy for EnabledExecuteCommand
        ecsDeployment.taskDefinition.taskRole.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSSMManagedInstanceCore'))

        // Use escape hatch to add EnabledExecuteCommand to cf template
        const cfnService = ecsDeployment.service.node.defaultChild as ecs.CfnService;
        cfnService.addPropertyOverride('EnableExecuteCommand', true)
 
6reactions
ghostcommented, Jun 18, 2021

FYI, I found a workaround using Escape Hatches https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html

My workaround is (Python) :

cfn_service = self.web_service.service.node.default_child
cfn_service.add_override("Properties.EnableExecuteCommand", True)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Amazon ECS Exec for debugging - AWS Documentation
ECS Exec is supported for AWS Fargate, external instances (ECS Anywhere), Linux containers hosted on Amazon EC2 and the following Windows Amazon ...
Read more >
@aws-cdk/aws-ecs - npm
Amazon Elastic Container Service (Amazon ECS) is a fully managed container ... common ECS architectural patterns, see the @aws-cdk/aws-ecs-patterns package.
Read more >
awsecspatterns - Go Packages
A Fargate service running on an ECS cluster fronted by an application load balancer. Example: var cluster cluster loadBalancedFargateService := ecsPatterns.
Read more >
Deploying a containerized web application with AWS Cloud ...
can help you see errors faster ... @aws-cdk/aws-ecs-patterns: Launch load balanced service ... Execute the container based on a scheduled time or rate....
Read more >
AWS CDK の aws-ecs-patterns で ECS Exec を使う - Zenn
AWS CDK の aws-ecs-patterns で ECS Exec を使う ... StackProps) { super(scope, id, props); const service = new ecs_patterns.
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