Interview Prep/AWS/ECS, EKS, Lambda and ECR

An application on Lambda needs a secret. Should you put it in environment variables?

IntermediateScenarioECS, EKS, Lambda and ECR
Answer

Situation read → Env vars are readable by anyone with lambda:GetFunctionConfiguration.

What I'd do →

  1. Store in Secrets Manager or SSM Parameter Store SecureString
  2. Fetch at init and cache, or use the Parameters and Secrets Lambda extension
  3. Grant secretsmanager:GetSecretValue on that secret
  4. Use KMS CMK for extra control

Why → Central storage gives rotation and audit.

Interview tip → Extension caches calls and cuts cost.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on ECS, EKS, Lambda and ECR