DEV Community

Cover image for Day 14: Advanced ECS Features: Secrets Management, Volumes, and Fargate Spot
Pragnesh Patel
Pragnesh Patel

Posted on

Day 14: Advanced ECS Features: Secrets Management, Volumes, and Fargate Spot

Building on Day 13, add pro features.

Secrets Management

Use AWS Secrets Manager: Create secret, reference in task def:

"secrets": [
  { "name": "MY_SECRET", "valueFrom": "arn:aws:secretsmanager:region:account:secret:my-secret" }
]
Enter fullscreen mode Exit fullscreen mode

Access in code: process.env.MY_SECRET

Secret

Volumes

For persistence, use EFS: Create file system, mount in task:

"volumes": [
  { "name": "efs-vol", "efsVolumeConfiguration": { "fileSystemId": "fs-id" } }
],
"mountPoints": [{ "sourceVolume": "efs-vol", "containerPath": "/data" }]
Enter fullscreen mode Exit fullscreen mode

Fargate Spot

For cost savings: In service, use capacity provider strategy with Fargate Spot.

Pros: Up to 70% cheaper; Cons: Interruptible.

Today’s Takeaway

Advanced and optimized!

What’s Next?
In Day 15, we’ll wrap up with best practices.

Top comments (0)