feat(ec2): disable api termination#30620
Conversation
aws-cdk-automation
left a comment
There was a problem hiding this comment.
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.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
nmussy
left a comment
There was a problem hiding this comment.
Thanks for the contribution. Just a couple of changes, let me know if you need help with the assertion 👍
| new IntegTest(app, 'instance-disable-api-termination', { | ||
| testCases: [testCase], | ||
| }); |
There was a problem hiding this comment.
Could you add a awsApiCall assertion to make sure that the property is being set? See INTEGRATION_TESTS and DescribeInstanceAttribute
| * If you set this parameter to true , you can't terminate the instance using the Amazon EC2 console, CLI, or API; | ||
| * | ||
| * otherwise, you can. To change this attribute after launch, use [ModifyInstanceAttribute](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). | ||
| * Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, you can terminate the instance | ||
| * by running the shutdown command from the instance. |
There was a problem hiding this comment.
Your wording and formatting seemed a bit off, but feel free to update my suggestion further. And just to be clear, is instanceInitiatedShutdownBehavior going to override this parameter? If that's the case, it should be made more explicit here.
| * If you set this parameter to true , you can't terminate the instance using the Amazon EC2 console, CLI, or API; | |
| * | |
| * otherwise, you can. To change this attribute after launch, use [ModifyInstanceAttribute](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). | |
| * Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, you can terminate the instance | |
| * by running the shutdown command from the instance. | |
| * If true, the instance will not be able to be terminated using the Amazon EC2 console, CLI, or API. | |
| * | |
| * To change this attribute after launch, use [ModifyInstanceAttribute](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html). | |
| * Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, you can terminate the instance | |
| * by running the shutdown command from the instance. |
mazyu36
left a comment
There was a problem hiding this comment.
Is it possible to re-run the integ test?
It seems the test is failing due to changes in the snapshot caused by #30108.
The issue should be resolved by running the integ test again and updating the snapshot.
@aws-cdk-testing/framework-integ: CHANGED aws-ec2/test/integ.instance-disable-api-termination 1.291s
@aws-cdk-testing/framework-integ: Mappings
@aws-cdk-testing/framework-integ: [~] Mapping LatestNodeRuntimeMap: {"af-south-1":{"value":"nodejs20.x"},"ap-east-1":{"value":"nodejs20.x"},"ap-northeast-1":{"value":"nodejs20.x"},"ap-northeast-2":{"value":"nodejs20.x"},"ap-northeast-3":{"value":"nodejs20.x"},"ap-south-1":{"value":"nodejs20.x"},"ap-south-2":{"value":"nodejs20.x"},"ap-southeast-1":{"value":"nodejs20.x"},"ap-southeast-2":{"value":"nodejs20.x"},"ap-southeast-3":{"value":"nodejs20.x"},"ap-southeast-4":{"value":"nodejs20.x"},"ca-central-1":{"value":"nodejs20.x"},"cn-north-1":{"value":"nodejs18.x"},"cn-northwest-1":{"value":"nodejs18.x"},"eu-central-1":{"value":"nodejs20.x"},"eu-central-2":{"value":"nodejs20.x"},"eu-north-1":{"value":"nodejs20.x"},"eu-south-1":{"value":"nodejs20.x"},"eu-south-2":{"value":"nodejs20.x"},"eu-west-1":{"value":"nodejs20.x"},"eu-west-2":{"value":"nodejs20.x"},"eu-west-3":{"value":"nodejs20.x"},"il-central-1":{"value":"nodejs20.x"},"me-central-1":{"value":"nodejs20.x"},"me-south-1":{"value":"nodejs20.x"},"sa-east-1":{"value":"nodejs20.x"},"us-east-1":{"value":"nodejs20.x"},"us-east-2":{"value":"nodejs20.x"},"us-gov-east-1":{"value":"nodejs18.x"},"us-gov-west-1":{"value":"nodejs18.x"},"us-iso-east-1":{"value":"nodejs18.x"},"us-iso-west-1":{"value":"nodejs18.x"},"us-isob-east-1":{"value":"nodejs18.x"},"us-west-1":{"value":"nodejs20.x"},"us-west-2":{"value":"nodejs20.x"}} to {"af-south-1":{"value":"nodejs20.x"},"ap-east-1":{"value":"nodejs20.x"},"ap-northeast-1":{"value":"nodejs20.x"},"ap-northeast-2":{"value":"nodejs20.x"},"ap-northeast-3":{"value":"nodejs20.x"},"ap-south-1":{"value":"nodejs20.x"},"ap-south-2":{"value":"nodejs20.x"},"ap-southeast-1":{"value":"nodejs20.x"},"ap-southeast-2":{"value":"nodejs20.x"},"ap-southeast-3":{"value":"nodejs20.x"},"ap-southeast-4":{"value":"nodejs20.x"},"ap-southeast-5":{"value":"nodejs20.x"},"ap-southeast-7":{"value":"nodejs20.x"},"ca-central-1":{"value":"nodejs20.x"},"ca-west-1":{"value":"nodejs20.x"},"cn-north-1":{"value":"nodejs18.x"},"cn-northwest-1":{"value":"nodejs18.x"},"eu-central-1":{"value":"nodejs20.x"},"eu-central-2":{"value":"nodejs20.x"},"eu-isoe-west-1":{"value":"nodejs18.x"},"eu-north-1":{"value":"nodejs20.x"},"eu-south-1":{"value":"nodejs20.x"},"eu-south-2":{"value":"nodejs20.x"},"eu-west-1":{"value":"nodejs20.x"},"eu-west-2":{"value":"nodejs20.x"},"eu-west-3":{"value":"nodejs20.x"},"il-central-1":{"value":"nodejs20.x"},"me-central-1":{"value":"nodejs20.x"},"me-south-1":{"value":"nodejs20.x"},"mx-central-1":{"value":"nodejs20.x"},"sa-east-1":{"value":"nodejs20.x"},"us-east-1":{"value":"nodejs20.x"},"us-east-2":{"value":"nodejs20.x"},"us-gov-east-1":{"value":"nodejs18.x"},"us-gov-west-1":{"value":"nodejs18.x"},"us-iso-east-1":{"value":"nodejs18.x"},"us-iso-west-1":{"value":"nodejs18.x"},"us-isob-east-1":{"value":"nodejs18.x"},"us-west-1":{"value":"nodejs20.x"},"us-west-2":{"value":"nodejs20.x"}}
GavinZZ
left a comment
There was a problem hiding this comment.
LGTM, thanks for contributing to CDK!
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
None
Reason for this change
Cloudformation has
disableApiTerminationproperty for turning on Termination Protection on EC2 Instance.This property is not configurable from L2.
Description of changes
Add
disableApiTerminationproperty to InstanceProps.Description of how you validated changes
I've added both unit and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license