Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ecs): ECS exec cannot be enabled for ECS Anywhere (ecs.ExternalService) #31374

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented Sep 9, 2024

Issue # (if applicable)

Closes #31181.

Reason for this change

In the ecs.ExternalService class (ECS Anywhere), the enableExecuteCommand property cannot be set to true, so it is not possible to enable ECS exec.
However, the documentation states that ECS Anywhere supports ECS Exec.

ECS Exec is supported for tasks that run on the following infrastructure:
Linux and Windows containers on external instances (Amazon ECS Anywhere)

Description of changes

Remove unnecessary if statement.

Description of how you validated changes

Fix an unit test.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team September 9, 2024 13:24
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Sep 9, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@mazyu36
Copy link
Contributor Author

mazyu36 commented Sep 9, 2024

Exemption Request: unable to execute integ test.

To complete the deployment, an external instance such as a VM is required, but I think this is very difficult in integ test.
In a previous PR for the ExternalService implementation, integ test wasn't inclueded.

#14931 (comment)

I tried running the integration test, but since the external instance did not exist, the deployment could not be completed.

スクリーンショット 2024-09-09 22 15 41

During the deployment, I confirmed that the enableExecuteCommand property of the ExternalService was set to true using the CLI, so I would like to consider this as an alternative.

 % aws ecs describe-services --cluster aws-ecs-integ-external-exec-command-ExternalCluster14BF29C2-1WgNGhaSCe6j --service aws-ecs-integ-external-exec-command-ExternalService9AC5437C-yEbQ87UFPByK  --region us-east-1                           
{
    "services": [
        {
            "serviceArn": "arn:aws:ecs:us-east-1:...
             // omit
            "enableExecuteCommand": true
             // omit
}

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Sep 9, 2024
Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Could you change the description (in your Ec2Service or FargateService) in README?

To enable the ECS Exec feature for your containers, set the boolean flag enableExecuteCommand to true in your Ec2Service or FargateService.

https://github.com/go-to-k/aws-cdk/blob/152f32d887baacecd95d4d3aea7703cb467b1771/packages/aws-cdk-lib/aws-ecs/README.md#ecs-exec-command

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 20, 2024
@mazyu36
Copy link
Contributor Author

mazyu36 commented Sep 20, 2024

@go-to-k
Thanks. I've updated.

Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Thank you.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: f3cefb2
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 20, 2024
@aws-cdk-automation
Copy link
Collaborator

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.
❌ The first word of the pull request title should not be capitalized. If the title starts with a CDK construct, it should be in backticks "``".

PRs must pass status checks before we can provide a meaningful review.

If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing Exemption Request and/or Clarification Request.

✅ A exemption request has been requested. Please wait for a maintainer's review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/small Small work item – less than a day of effort p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ecs.ExternalService: enableExecuteCommand is shown as not supported (while in fact it is supported)
3 participants