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

EREGCSC-2859 Migrate the site lambdas and database to CDK #1522

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

Conversation

addis-samtek
Copy link
Contributor

@addis-samtek addis-samtek commented Jan 20, 2025

Resolves EREGCSC-2858 and EREGCSC-2859

Description

This PR is the result of two JIRA stories:

  1. Migrating the Static Assets infrastructure from Serverless Framework to AWS CDK. (2858)
  2. Migrating the site lambdas and database to CDK. (2859)

This is part of our broader initiative to standardize our infrastructure as code using CDK.

This pull request changes:

From 2858:

  • Introduces new StaticAssetsStack CDK construct
  • Migrates CloudFront distribution configuration to CDK
  • Converts S3 bucket configuration for static assets
  • Implements WAF rules using CDK constructs
  • Configures proper resource naming using StageConfig
  • Implements cross-stack resource sharing (exports/imports)

CDK Migration: Backend Infrastructure and Static Assets
Resolves EREGCSC-2858 and EREGCSC-2859
Description
Migration of site lambdas and database infrastructure to CDK (EREGCSC-2859)

Site Lambda and Database Migration (EREGCSC-2859)

Migrated site lambdas to Docker-based deployments
Implemented Docker Lambda factory pattern for consistent configuration
Integrated AWS Secrets Manager for credential management
Configured VPC networking and security groups
Added WAF integration with API Gateway
Implemented proper IAM roles and permissions
Added support for non-prod environment authorizer lambda

Deploy the stack to the eph-1522 environment:
bashCopycdk deploy --app 'npx ts-node bin/app.ts' "*-eph-1522"

Verify successful creation of all stacks in CloudFormation:

Backend stack
Static assets stack
Parser stack
Text extractor stack

Functional Verification

Access the API Gateway endpoint:

Verify page loading
Test navigation and links
Confirm static asset delivery
Validate API functionality

Test Security Features:

Verify WAF rules
Test authentication flows
Validate secure asset access

Database Operations:

Verify database connections
Test CRUD operations
Validate migration scripts

Environment Variables
Ensure the following environment variables are properly set:
CopySTAGE_ENV=eph-1522
DEPLOY_NUMBER=[build_number]
Notes

This migration maintains backward compatibility with existing systems
Security groups are properly shared between ephemeral environments
All secrets have been migrated to AWS Secrets Manager
Cross-stack references are handled via CloudFormation exports

Copy link

github-actions bot commented Feb 5, 2025

✨ See the Django Site in action

@addis-samtek addis-samtek added the Needs Review This PR needs a code review label Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

✨ See the Django Site in action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review This PR needs a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants