A payments service runs as Amazon ECS tasks that use an IAM role named payments-task.
It must call one method of an Amazon API Gateway REST API in the same account, and only tasks using that role may invoke the method. The team does not want to create or rotate any tokens, passwords or API keys.
Which TWO actions should the developer take? (Choose two.)
Choose two answers.
AA. Set the method's authorization type to AWS_IAM.
BB. Create an API key, attach it to a usage plan and place the key in the task definition's environment variables.
CC. Allow execute-api:Invoke on the method's ARN in the task role, and sign the service's requests with Signature Version 4.
DD. Create a Cognito user pool authorizer and send the task role's ARN in the Authorization header on each call.
EE. Add a VPC link to the method so that only traffic from the ECS service's subnets reaches the integration.
B. Wrong: API keys identify callers for throttling and quotas, not for authorization, and the key would be a secret that the team must create and rotate. This goes against the stated requirement. Learn more: Controlling access to REST APIs (opens in a new tab)
C. Right: Correct. The caller's role must be allowed to invoke the method, and each request must be signed with the role's temporary credentials. The AWS SDKs and signing libraries do this using the credentials that ECS provides to the task. Learn more: Controlling access with IAM permissions (opens in a new tab)
D. Wrong: A user pool authorizer expects a token issued by the user pool, and a role ARN is just text that anyone could copy. It would prove nothing about the caller.
E. Wrong: A VPC link lets API Gateway reach private backends; it does not control who can call the API. It does nothing to restrict callers to one role.
Explanation
IAM authorization needs two settings: the method must use the AWS_IAM authorization type, and the caller's role must be allowed execute-api:Invoke on the method and sign requests with Signature Version 4. No tokens or keys are created or rotated. API keys, user pool authorizers and VPC links do not identify an IAM role.
Want more on API authorization and tokens? The 5 full-length practice sets have 15 more API authorization and tokens questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →