Skip to content

Conversation

@zaro0508
Copy link
Contributor

@zaro0508 zaro0508 commented Oct 31, 2025

This PR adds a GuardDuty VPC endpoint to the network stack to prevent orphaned AWS-managed resources during stack deletion. When GuardDuty ECS Runtime Monitoring is enabled, AWS automatically creates VPC endpoints and security groups outside of CloudFormation, which block VPC deletion. By explicitly managing the GuardDuty VPC endpoint in the CDK stack, it can be properly destroyed with the rest of the infrastructure.

  • Adds GuardDuty VPC endpoint to NetworkStack with private subnet placement
  • Implements comprehensive test coverage for VPC endpoint creation, security configuration, and VPC integration
  • Documents the issue and solution in README with troubleshooting guidance

The CDK app now manages the GuardDuty VPC endpoint to ensure clean
stack deletion. In earlier versions, GuardDuty created AWS-managed
resources (VPC endpoints and security groups) outside of CloudFormation,
which blocked VPC deletion. These are now explicitly managed by the
CDK stack.
@zaro0508 zaro0508 requested review from a team as code owners October 31, 2025 22:30
@zaro0508 zaro0508 requested a review from Copilot October 31, 2025 22:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a GuardDuty VPC endpoint to the network stack to prevent orphaned AWS-managed resources during stack deletion. When GuardDuty ECS Runtime Monitoring is enabled, AWS automatically creates VPC endpoints and security groups outside of CloudFormation, which block VPC deletion. By explicitly managing the GuardDuty VPC endpoint in the CDK stack, it can be properly destroyed with the rest of the infrastructure.

  • Adds GuardDuty VPC endpoint to NetworkStack with private subnet placement
  • Implements comprehensive test coverage for VPC endpoint creation, security configuration, and VPC integration
  • Documents the issue and solution in README with troubleshooting guidance

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/network_stack.py Adds GuardDuty VPC endpoint with interface type, private DNS enabled, and placement in private subnets
tests/unit/test_network_stack.py Adds three test functions covering endpoint creation, security configuration, and VPC integration
README.md Documents the GuardDuty VPC endpoint issue, root cause, and solution for stack deletion problems

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fix typo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zaro0508 zaro0508 deleted the branch Sage-Bionetworks-IT:main October 31, 2025 23:14
@zaro0508 zaro0508 closed this Oct 31, 2025
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.

1 participant