feat(s3-legacy): use param store to retrieve attachment bucket name#1779
Open
benjaminpaige wants to merge 2 commits intomainfrom
Open
feat(s3-legacy): use param store to retrieve attachment bucket name#1779benjaminpaige wants to merge 2 commits intomainfrom
benjaminpaige wants to merge 2 commits intomainfrom
Conversation
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
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.
Implement Shared Attachment Bucket Strategy with SSM Parameter Store Configuration
Overview
This PR implements a shared attachment bucket strategy to optimize resource usage and simplify infrastructure management for the MacPro-MAKO application. The change moves bucket name configuration from hardcoded construction to SSM Parameter Store and introduces intelligent environment-based bucket sharing for ephemeral development branches.
Problem
The previous implementation had several limitations:
Resource Proliferation: Every ephemeral development branch created its own S3 bucket, leading to:
Configuration Rigidity: Bucket names were constructed dynamically using a pattern (
${project}-${stage}-attachments-${accountId}), making it:Migration Complexity: As part of the larger cross-account bucket migration effort, the hardcoded naming prevented flexible bucket reassignment and fallback strategies.
Solution
This PR introduces a centralized configuration approach with environment-aware bucket management:
1. SSM Parameter Store Configuration
Bucket names are now loaded from AWS Systems Manager Parameter Store with the following hierarchy:
/{project}/{stage}/attachmentsBucketName(for permanent environments)/{project}/main/attachmentsBucketName(for ephemeral branches)2. Environment-Based Bucket Strategy
Permanent Environments (main, val, production):
RETAINremoval policy to preserve data on stack deletionDevelopment/Ephemeral Environments:
3. Graceful Fallback Logic
For ephemeral branches without stage-specific SSM parameters:
Changes Made
Configuration Layer (
lib/config/deployment-config.ts)attachmentsBucketNameproperty toInjectedConfigPropertiesinterfaceloadBucketName()method with SSM Parameter Store integrationInfrastructure Layer (
lib/stacks/parent.ts)attachmentsBucketNamefrom configuration to uploads stackUploads Stack (
lib/stacks/uploads.ts)attachmentsBucketNameas stack propertyModified Files
Technical Details
SSM Parameter Store Schema
Example Values:
/mako/main/attachmentsBucketName→mako-main-attachments-116229642442/mako/val/attachmentsBucketName→mako-val-attachments-116229642442/mako/production/attachmentsBucketName→mako-production-attachments-116229642442Bucket Creation vs Import Logic
Non-Dev Environments (
isDev: false):Dev Environments (
isDev: true):Security Posture
The following security controls remain enforced for all created buckets:
Imported buckets (dev environments) rely on manually configured policies from the main bucket.
Deployment Considerations
Prerequisites:
SSM parameters must be created before stack deployment:
For ephemeral branches, no parameter is required (automatic fallback to main)
Migration Path:
Testing Strategy
Related Documentation (these documents can be found in the jira work item)
ATTACHMENT_BUCKET_MIGRATION.mdfor broader migration contextATTACHMENT_BUCKET_MIGRATION_RUNBOOK.mdfor operational proceduresBenefits
Migration Status: This PR is part of the larger attachment bucket migration initiative. It establishes the infrastructure foundation for consolidating attachment storage and eventual decommissioning of legacy cross-account access.