constup/aws-secrets-bundle
Symfony bundle that loads parameters from AWS Secrets Manager into the service container. Supports Symfony 5/6 (v1/v2) and requires aws/aws-sdk-php. Configure region/credentials and reference secrets in config for environment-specific setups.
.env, config/app.php) by centralizing credentials in AWS Secrets Manager, reducing exposure to credential leaks in version control or deployment artifacts. Aligns with OWASP Top 10 (A02: Cryptographic Failures) by enabling automated secret rotation (e.g., database passwords, API keys) without application downtime..env file management across dev/staging/prod with environment-agnostic secret references (e.g., %env(aws:DB_PASSWORD)%). Integrates seamlessly with CI/CD pipelines (e.g., GitHub Actions, AWS CodePipeline) to inject secrets dynamically, reducing build failure rates from misconfigured credentials.dev-db-password only for development).AWS_SECRET=eu-central-1/db-password). Scales with AWS’s global infrastructure without local caching bottlenecks.DB_USERNAME, DB_PASSWORD, or DB_HOST from AWS Secrets (e.g., for RDS).ignore: true in config to bypass AWS calls locally while keeping secrets in sync with production..env files, config files, or environment variables and lacks a centralized secrets manager.aws:DATABASE_PASSWORD in Laravel config).incompass/aws-secrets-bundle or need a maintained alternative for Symfony 5.3+/6.0+.spatie/laravel-secrets-manager for multi-provider needs).| Use Case | Alternative Package | Pros | Cons |
|---|---|---|---|
| Multi-cloud secrets | spatie/laravel-secrets-manager |
Supports Vault, Azure Key Vault, etc. | Less AWS-native features. |
| Simple AWS secrets | AWS Parameter Store (via aws/aws-sdk-php) |
Cheaper, simpler. | No JSON payloads or rotation. |
| Laravel-native | Laravel Forge/Vapor | UI-driven secret management. | Ties you to Laravel ecosystem. |
| On-prem secrets | HashiCorp Vault | Dynamic secrets, multi-cloud. | Complex setup. |
"This package replaces insecure .env files with AWS Secrets Manager, delivering:
.env files in staging), saving $X/year in incident response.
Upfront cost: Minimal (~$0.40/month per 10K API calls). ROI: Lower security incidents and faster deployments with no code changes—just update AWS Secret names."*"This bundle lets us:
.env hacks with AWS Secrets Manager, so secrets are never checked into Git and can be rotated automatically.%env(aws:DB_PASSWORD)% in Laravel config, with zero code changes—just update the AWS Secret name.ignore: true in config, while keeping secrets in sync with prod.Tradeoffs:
cache: filesystem for local testing).Recommendation: Pilot in staging to validate the workflow before rolling out to prod. Estimated effort: 2 dev days for setup + 1 day for testing."*
"Key security benefits:
.env files, eliminating accidental leaks.dev-db-password only for dev).Risks to mitigate:
AWS_SECRET env vars aren’t logged in CI/CD (e.g., GitHub Actions masks them by default).cache: filesystem to avoid hitting AWS on every request during dev."*"How this changes your workflow:
✅ No more php artisan config:clear after .env changes—secrets are fetched dynamically.
✅ Local dev secrets: Set ignore: true in config/packages/aws_secrets.yaml to use local overrides.
✅ Type safety: Secrets are loaded as strings but can be cast to types (e.g., (int) $this->getParameter('aws:API_TIMEOUT')).
✅ Examples:
# config/services.php
'stripe_api_key' => env('aws:STRIPE_KEY'),
'db_password' => env('aws:RDS_PASSWORD', key: 'password'), // Nested JSON
Gotchas:
How can I help you explore Laravel packages today?