Skip to content

Commit be03f4a

Browse files
committed
feat(deploy-on-aws): improve EB skill with IAM scanning hint and doc links
Add guidance for agents to scan source code for AWS SDK usage to determine instance profile permissions. Rewrite configuration.md to patterns + public doc links for maintainability. Fix option settings precedence (remove platform hooks), switch secrets example to native environmentsecrets namespace.
1 parent 4daf999 commit be03f4a

2 files changed

Lines changed: 42 additions & 41 deletions

File tree

plugins/deploy-on-aws/skills/elastic-beanstalk/SKILL.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ Apply these automatically:
132132
- Web server instances in private subnets behind ALB
133133
- Worker instances in private subnets with NAT Gateway for outbound
134134
- HTTPS via ACM certificate on ALB (web server environments)
135-
- IAM instance profile with least-privilege permissions
135+
- IAM instance profile with least-privilege permissions — scan source code for
136+
AWS SDK client usage to determine required actions (e.g.,
137+
`AmazonBedrockRuntimeClient``bedrock:InvokeModel`,
138+
`AmazonS3Client``s3:GetObject`/`s3:PutObject` on specific buckets)
136139
- Enhanced health reporting enabled
137140
- Managed platform updates enabled
138141
- Security groups: ALB accepts 443, instances accept only from ALB

plugins/deploy-on-aws/skills/elastic-beanstalk/references/configuration.md

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,22 @@
22

33
## Configuration Hierarchy
44

5-
Elastic Beanstalk configuration is applied in this order (later overrides earlier
6-
for option settings):
5+
Option settings are applied in this order (later overrides earlier):
76

87
1. Platform defaults (managed by AWS)
98
2. Saved configurations (reusable templates)
109
3. `.ebextensions/*.config` files (in source bundle)
11-
4. Platform hooks (`/platform/hooks/prebuild/`, `predeploy/`, `postdeploy/`)
12-
5. Environment properties (set via console/CLI/API)
10+
4. Environment properties (set via console/CLI/API)
1311

14-
For option settings, later sources override earlier ones. `.ebextensions` and
15-
platform hooks also support resource declarations and deploy-time commands that
16-
are not expressible as option settings.
12+
Platform hooks (`/platform/hooks/prebuild/`, `predeploy/`, `postdeploy/`) run
13+
shell scripts during deployment lifecycle but do not set option settings.
14+
They are the preferred customization mechanism on AL2023 for non-option-setting
15+
tasks. Use `.ebextensions/` for option settings and resource declarations.
1716

18-
Platform hooks are the preferred customization mechanism on AL2023. Use
19-
`.ebextensions/` for option settings and resource declarations; use platform
20-
hooks for shell scripts that run during deployment lifecycle.
17+
See [Configuration options precedence](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html#configuration-options-precedence)
18+
for full details.
2119

22-
## `.ebextensions/` Patterns
23-
24-
Place YAML `.config` files in `.ebextensions/` at the source bundle root.
25-
Common patterns:
26-
27-
### Install system packages
28-
29-
```yaml
30-
packages:
31-
yum:
32-
ImageMagick: []
33-
postgresql-devel: []
34-
```
20+
## Key Patterns
3521

3622
### Run commands on deploy
3723

@@ -45,7 +31,7 @@ container_commands:
4531
Use `leader_only: true` for commands that should run on only one instance
4632
(database migrations, cache warmup).
4733

48-
## Procfile
34+
### Procfile
4935

5036
Define the process to run. EB uses this instead of platform defaults:
5137

@@ -59,19 +45,23 @@ HTTP, not a message broker SDK).
5945

6046
## Environment Properties and Secrets
6147

62-
Set application configuration as environment variables. Never hardcode secrets
63-
in `.ebextensions/` or source code. Reference secrets via Secrets Manager:
48+
Non-secret config uses `aws:elasticbeanstalk:application:environment`. For
49+
secrets, use the native secrets integration which injects Secrets Manager
50+
values as environment variables without application-side SDK calls:
6451

6552
```yaml
6653
option_settings:
6754
aws:elasticbeanstalk:application:environment:
68-
DB_SECRET_ARN: arn:aws:secretsmanager:us-east-1:123456789:secret:myapp/db
6955
APP_ENV: production
56+
aws:elasticbeanstalk:application:environmentsecrets:
57+
DB_PASSWORD: arn:aws:secretsmanager:us-east-1:123456789:secret:myapp/db
7058
```
7159

72-
The application reads the secret value at runtime using the Secrets Manager SDK.
73-
Provision databases and secrets as separate resources (via CDK, Terraform, or
74-
console) — not coupled to the EB environment lifecycle.
60+
Never hardcode secrets in `.ebextensions/` or source code. Provision databases
61+
and secrets as separate resources — not coupled to the EB environment lifecycle.
62+
63+
See [Environment secrets](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuration-envvars.html#configuration-envvars-secrets)
64+
for supported secret sources.
7565

7666
## Deployment Policies
7767

@@ -84,21 +74,29 @@ console) — not coupled to the EB environment lifecycle.
8474

8575
Default: All at once for dev, Rolling with additional batch for production.
8676

87-
## Health Check Configuration
77+
See [Deployment policies and settings](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.rolling-version-deploy.html)
78+
for configuration details.
8879

89-
```yaml
90-
option_settings:
91-
aws:elasticbeanstalk:environment:process:default:
92-
HealthCheckPath: /health
93-
HealthCheckInterval: '15'
94-
HealthyThresholdCount: '3'
95-
UnhealthyThresholdCount: '5'
96-
```
80+
## Health Check
9781

9882
Always configure a dedicated health check endpoint. Do not use `/` if it
9983
performs database queries or heavy computation.
10084

101-
The agent should verify that the application exposes a health check endpoint
85+
The agent should verify that the application exposes a health endpoint
10286
(default: `/health`). If no health route exists, scaffold a minimal one that
10387
returns 200 OK. The ALB health check will fail without this, causing deployment
10488
to roll back.
89+
90+
See [Health check setting](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-alb.html#environments-cfg-alb-health)
91+
for ALB health check configuration.
92+
93+
## Heroku Migration
94+
95+
When migrating from Heroku/Render/Railway, audit for these patterns:
96+
97+
- `DATABASE_URL` → Provision RDS/Aurora separately, pass via environment secrets
98+
- `REDIS_URL` → Provision ElastiCache, pass endpoint via environment properties
99+
- Add-on env vars (e.g., `SENDGRID_API_KEY`) → Store in Secrets Manager
100+
- `PORT` → EB sets this automatically, no change needed
101+
- `Procfile` → Works as-is (same format)
102+
- Explicit AWS credentials → Remove; use IAM instance profile instead

0 commit comments

Comments
 (0)