Skip to content

feat: enhances deploy/validation scripts, adds manual removal script [#73]#74

Merged
robert-7 merged 7 commits into
mainfrom
iac-enhancements
Apr 16, 2026
Merged

feat: enhances deploy/validation scripts, adds manual removal script [#73]#74
robert-7 merged 7 commits into
mainfrom
iac-enhancements

Conversation

@robert-7

@robert-7 robert-7 commented Apr 16, 2026

Copy link
Copy Markdown
Owner

Summary

This PR turns the manual-removal work into a real cutover toolkit for moving the AWS deployment from the old hand-built environment to the new CDK-owned stack.

The final scope ended up being broader than just adding a teardown script. During the live cutover we found and fixed several real issues in the rebuild path: hidden console-created CloudFormation stacks that still owned ECS resource names, CDK bootstrap missing in the target account, reuse of the existing GitHub OIDC provider, slow/recursive Docker asset packaging, and ECS service creation racing ahead of ALB listener attachment.

What changed

  • Added a dedicated infra/manual-removal/ toolkit:
    • remove_manual_stack.sh
    • validate_stack_is_up.sh
    • validate_manual_stack_teardown_completed.sh
    • validate_cdk_predeploy.sh
    • common_manual_stack_vars.sh
    • common_manual_stack_helpers.sh
    • manual-stack-teardown.md
  • Updated the teardown flow to also remove leftover console-created CloudFormation stacks for the ECS cluster/service, not just the raw AWS resources.
  • Improved the predeploy validator so it now checks:
    • AWS account alignment with infra/.env
    • Docker availability
    • teardown completion
    • ACM certificate status
    • CDK bootstrap presence
    • GitHub OIDC provider reuse configuration
    • cdk synth
  • Updated the CDK stack so it can reuse an existing GitHub OIDC provider via CDK_GITHUB_OIDC_PROVIDER_ARN.
  • Updated the CDK bootstrap image path so the first rebuild deploy is practical from a local Docker build.
  • Reduced the bootstrap Docker asset context so CDK does not drag large local artifacts like infra/.venv, node_modules, and report output into the asset build.
  • Fixed stack ordering so the ECS service waits for the ALB/listener/target group attachment before creation.
  • Updated the AWS architecture and teardown docs to match the real cutover process.

Live cutover work completed

The rebuilt stack was actually brought up during this work:

  • removed the old manual stack resources
  • removed leftover console-created CloudFormation stacks that still owned ECS names
  • bootstrapped the AWS account/region for CDK
  • deployed CourseEnrollmentAppStack successfully
  • validated the rebuilt stack in AWS

Validation performed

  • bash infra/manual-removal/remove_manual_stack.sh --yes
  • bash infra/manual-removal/validate_manual_stack_teardown_completed.sh
  • bash infra/manual-removal/validate_cdk_predeploy.sh
  • cd infra && cdk bootstrap aws://334348504030/us-east-1 --require-approval never
  • cd infra && cdk deploy CourseEnrollmentAppStack --output /tmp/course-enrollment-app-cdk-out-deploy --require-approval never
  • bash infra/manual-removal/validate_stack_is_up.sh
  • curl -I http://course-enrollment-app-alb-1547360316.us-east-1.elb.amazonaws.com/index
  • curl -k -I https://course-enrollment-app-alb-1547360316.us-east-1.elb.amazonaws.com/index

Follow-up

  • Namecheap still needs to point course-enrollment-app.robertlech.com at the new ALB DNS name course-enrollment-app-alb-1547360316.us-east-1.elb.amazonaws.com.

@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@robert-7 robert-7 changed the title feat: enhances script, adds manual removal script feat: enhances deploy/validation scripts, adds manual removal script Apr 16, 2026
@robert-7 robert-7 changed the title feat: enhances deploy/validation scripts, adds manual removal script feat: enhances deploy/validation scripts, adds manual removal script [#73] Apr 16, 2026
@robert-7 robert-7 merged commit edff74a into main Apr 16, 2026
6 checks passed
@robert-7 robert-7 deleted the iac-enhancements branch April 16, 2026 17:49
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.

Runbook: remove the pre-CDK manual AWS stack and perform first CDK deploy

1 participant