AWS Certified Developer – Associate (DVA-C02) — Question 183
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 need to be specified in the task definition to ensure they are available to the container when it starts. Options A and D incorrectly place the environment variables in the service definition, which does not pass them to the container. Option C incorrectly suggests using the entryPoint parameter, which is not intended for defining environment variables.