AWS Certified Developer – Associate — Question 30
A developer needs to deploy an application running on AWS Fargate using Amazon ECS. The application has environment variables that must be passed to a container for the application to initialize.
How should the environment variables be passed to the container?
Answer options
- A. Define an array that includes the environment variables under the environment parameter within the service definition.
- B. Define an array that includes the environment variables under the environment parameter within the task definition.
- C. Define an array that includes the environment variables under the entryPoint parameter within the task definition.
- D. Define an array that includes the environment variables under the entryPoint parameter within the service definition.
Correct answer: B
Explanation
The correct answer is B because environment variables must be defined in the task definition to be available to the container at runtime. Options A, C, and D are incorrect as they either refer to the incorrect definition context or use the wrong parameter for passing environment variables.