AWS Certified Developer - Associate (DVA-C03) free question 6 / 10 · Domain 2: Security
An application on Amazon ECS uses an AWS SDK. Its container has two environment variables set: AWS_CONTAINER_CREDENTIALS_RELATIVE_URI with the value /get-credentials?a=1 and AWS_CONTAINER_CREDENTIALS_FULL_URI with the value http://localhost:8080/get-credentials. From which endpoint does the SDK request credentials?
- http://169.254.170.2/get-credentials?a=1, the default Amazon ECS hostname with the relative URI appended
- http://169.254.169.254/latest/meta-data/iam/security-credentials/, the instance metadata service of the host
- The two endpoints in turn, with the first successful response used as the credentials of the application
- http://localhost:8080/get-credentials, the more specific of the two settings and therefore the one the SDK prefers
Show the answer and explanation
Answer: A
Why this is correct
The container credential provider fetches credentials from an HTTP endpoint through a GET request. The value of AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is appended to the default Amazon ECS hostname 169.254.170.2, so the request goes to http://169.254.170.2/get-credentials?a=1. AWS_CONTAINER_CREDENTIALS_FULL_URI is an alternative setting that is used only if the relative URI is not set, so the localhost address is ignored here. The instance metadata service belongs to a different credential provider.
Why the other options are wrong
"http://localhost:8080/get-credentials, the more specific of the two settings and therefore the one the SDK prefers" … The page says AWS_CONTAINER_CREDENTIALS_FULL_URI is an alternative to the relative URI and will only be used if the relative URI is not set. Specificity does not decide.
"The two endpoints in turn, with the first successful response used as the credentials of the application" … The page makes the full URI an alternative setting that is used when the relative URI is not set, so the SDK does not try both endpoints in turn.
"http://169.254.169.254/latest/meta-data/iam/security-credentials/, the instance metadata service of the host" … The container credential provider loads credentials from the HTTP endpoint named by these variables through a GET request. The instance metadata service belongs to a different credential provider.
Key points
Container credential provider: the relative URI is appended to 169.254.170.2, and the full URI is used only when the relative URI is not set.