feat: enables aws teardown/setup as code [#60]#72
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
infra/that defines the current AWS deployment as a same-name rebuild stackWhat Changed
infra/app.py,infra/course_enrollment_stack.py,infra/requirements.txt,infra/cdk.json, andinfra/.env.exampleCourseEnrollmentAppStackthat creates the ECR repository, GitHub OIDC provider, GitHub Actions deploy role, ECS task execution role, CloudWatch log group, ECS cluster, ALB, target group, listeners, security groups, and ECS Fargate serviceCDK_VPC_ID,CDK_PUBLIC_SUBNET_IDS,CDK_CERTIFICATE_ARN) rather than creating a new VPC or certificateCDK_IMAGE_TAG, while leaving ongoing image rollouts to the existing GitHub Actions deployment workflow/course-enrollment-app/SECRET_KEYand/course-enrollment-app/MONGO_URIasSecureStringparametersmake aws-teardownto runcd infra && cdk destroy CourseEnrollmentAppStack --force.gitignorefor CDK artifacts and expandeddocs/aws-architecture.mdwith the rebuild workflow, required inputs, usage, and limitationsResource Shape
The CDK stack is aligned to the current deployment naming/behavior and creates:
course-enrollment-appGitHubActions-CourseEnrollmentAppECSTaskExecutionRole-CourseEnrollmentApp/ecs/course-enrollment-appcourse-enrollment-appcourse-enrollment-app-albcourse-enrollment-app-tgwith/indexhealth checksAPP_ENV=production, container port5000, desired count1, and SSM-backed secrets443using the provided ACM certificate ARN and HTTP80redirecting to HTTPSImportant Scope Notes
MONGO_URIsecret valueRequired Inputs
The documented CDK inputs are:
CDK_VPC_IDCDK_PUBLIC_SUBNET_IDSCDK_CERTIFICATE_ARNCDK_IMAGE_TAGCDK_SECRET_KEYCDK_MONGO_URIValidation
python3 -m py_compile infra/app.py infra/course_enrollment_stack.py✅pre-commit run --files infra/app.py infra/course_enrollment_stack.py infra/requirements.txt infra/cdk.json infra/.env.example Makefile .gitignore docs/aws-architecture.md✅cd infra && cdk synthcould not be completed in this environment because the CDK CLI is not installed (cdk: command not found)Follow-up / Operator Notes
infra/cd infra && cdk synthmake aws-teardownonly removes CDK-managed AWS resources and does not touch Atlas, Namecheap DNS, or other external prerequisitesCloses #60