An enterprise is deploying a REST API using Amazon API Gateway. The API will be accessed solely by internal server-to-server microservices running on Amazon EC2 instances within a private VPC. The security policy mandates that all communication must be encrypted, credentials must not be hardcoded in application code, and access must be restricted using IAM policies based on the principle of least privilege. Which configuration should a developer implement to secure the API Gateway with the least operational effort?
- Enable AWS_IAM authorization on the API Gateway methods. Associate an IAM role with the EC2 instances that grants permissions for the `execute-api:Invoke` action, and configure the clients to sign their API requests using Signature Version 4.Cevap
- BConfigure a Cognito User Pool Authorizer on the API Gateway methods. Use Amazon Cognito Identity Pools to exchange the EC2 instance role credentials for a JSON Web Token (JWT) to pass in the Authorization header.
- CCreate a custom Lambda authorizer for the API Gateway methods. Write code within the Lambda authorizer to validate the Signature Version 4 signature of incoming requests against IAM policies before allowing access.
- DSet up the API Gateway integration as a Lambda proxy integration. Configure the backend Lambda function to inspect the raw request headers, extract the access key, and verify permissions against an IAM policy before returning a response.
Cevap
Enable AWS_IAM authorization on the API Gateway methods, associate an IAM role with the EC2 instances granting the `execute-api:Invoke` action, and sign requests using Signature Version 4.
The correct option is to enable AWS_IAM authorization on the API Gateway methods, associate an IAM role with the EC2 instances, and configure the client to sign requests with Signature Version 4. This utilizes API Gateway's built-in capabilities to validate access using IAM roles without requiring custom authorization logic or external token providers, providing the least operational overhead.
Adım Adım Çözüm
Anahtar Kavram
AWS_IAM Authorization in API Gateway