All practice questions
1542 questions
A developer is building a serverless application using an Amazon API Gateway REST API with a Lambda custom (non-proxy) integration backend. The developer configures a custom Lambda authorizer to authenticate incoming requests. The authorizer successfully validates the bearer token and returns an IAM policy along with a context map containing key-value pairs, including a custom property named `tenantId`. However, the backend Lambda function receives `null` for the `tenantId` parameter during invocation.
Which configuration change must the developer implement to resolve this issue?
A developer is testing an application locally that uses the AWS SDK for JavaScript. The developer wants to ensure the SDK uses the correct IAM permissions. The following configurations exist on the developer's workstation:
* The environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set to valid credentials for Developer A.
* The shared credentials file (~/.aws/credentials) contains a [default] profile for Developer B and a [testing] profile for Developer C.
* The environment variable AWS_PROFILE is set to testing.
The SDK client is initialized in the code without any custom credential configuration arguments. Which credentials will the AWS SDK use when making API calls?
A developer has deployed a containerized Node.js application inside a Docker container running on an Amazon EC2 instance. The application uses the AWS SDK for JavaScript to query an Amazon DynamoDB table. An IAM role with the necessary permissions is attached to the EC2 instance via an IAM instance profile. The EC2 instance is configured to require Instance Metadata Service Version 2 (IMDSv2).
While the application successfully accesses DynamoDB when executed directly on the EC2 host, it fails with a credential initialization error when running inside the Docker container. The container is running on the default bridge network.
Which of the following actions should the developer take to resolve this credential issue? (Select TWO.)
Select all that apply
A developer is configuring a REST API in Amazon API Gateway to integrate with a backend AWS Lambda function. The API client requires a custom header named `X-Custom-Header` in the HTTP response, and the response body must be formatted in JSON. The developer decides to use a Lambda proxy integration to minimize API Gateway configuration overhead. Which two actions must the developer perform to ensure the client receives the expected response?
Select all that apply
A developer is configuring a REST API in Amazon API Gateway using a Lambda custom (non-proxy) integration. The API is secured by a custom Lambda authorizer that outputs a context variable named `tenantId`. The backend Lambda function needs to receive both the client's source IP address and the `tenantId` in its input payload. Furthermore, when the backend Lambda function throws an exception containing the string `EntityNotFound`, the API must return a Not Found status code to the client.
How should the developer configure API Gateway to meet these requirements?
An AWS Lambda function is configured to run inside private subnets of a VPC in order to securely read data from an Amazon RDS DB instance. The function must also fetch data from a public weather API endpoint on the internet. Although database queries succeed, all HTTP requests to the public weather API fail with a timeout. Which of the following networking configurations will resolve this issue?
A developer is deploying a containerized application to Amazon ECS on Amazon EC2. The application uses the AWS SDK to write data to an Amazon DynamoDB table. During local testing, the developer used a shared credentials file located at `~/.aws/credentials` inside the container. After deployment, the application fails to authenticate with DynamoDB because the SDK is still using the expired local credentials instead of the assigned ECS Task Role.
Which two actions should the developer take to resolve this issue and ensure the application correctly and securely utilizes IAM roles for authentication? (Select TWO.)
Select all that apply
A retail company has developed a mobile application where users authenticate using Amazon Cognito User Pools. The backend services are exposed through an Amazon API Gateway REST API. The company needs to restrict API access so that only authenticated users with a valid JSON Web Token (JWT) can invoke the API methods. The developer wants to implement this validation with the lowest development effort and without writing any custom authorization code. Which configuration should the developer choose to secure the API?
A developer is configuring an AWS Lambda function inside a private subnet of a VPC. The Lambda function needs to read messages from an Amazon SQS queue and write records to an Amazon ElastiCache for Redis cluster located in another private subnet within the same VPC. The Lambda function is successfully writing to ElastiCache but is unable to connect to the Amazon SQS service. Which configuration change should the developer make to resolve this connectivity issue in the most secure manner?
A developer is designing a REST API using Amazon API Gateway. The API must support two distinct clients: a mobile application where users authenticate and receive JSON Web Tokens (JWTs) from Amazon Cognito, and a legacy third-party application that sends custom tokens that must be validated against an external database.
Which two authorization mechanisms should the developer configure on API Gateway to secure these client requests? (Select TWO.)
Select all that apply
A developer is implementing a cross-account continuous delivery pipeline in AWS CodePipeline. The pipeline is located in Account A and uses an Amazon S3 bucket in Account A to store artifacts. The deployment stage is configured to deploy resources into Account B using an AWS CloudFormation action. During pipeline execution, the CloudFormation action in Account B fails with an Access Denied error when trying to retrieve the input artifact zip file from the S3 bucket in Account A. The IAM role used for the CloudFormation deployment in Account B has been granted read permission to the S3 bucket in Account A, and the S3 bucket policy in Account A permits access from Account B's deployment role.
Which configuration change is required to resolve this deployment failure?
A developer needs to audit a production environment deployed via AWS CloudFormation because some resources may have been modified manually outside of the stack template. The developer wants to identify these out-of-band changes.
Which of the following actions should the developer perform to detect these modifications? (Select TWO.)
Select all that apply
A developer is building a mobile application that allows employees to sign in using either their corporate SAML Identity Provider (IdP) or a local email-based account. Once authenticated, the application must download customized settings files directly from a private Amazon S3 bucket.
Which combination of Cognito resources and configurations is required to support this architecture? (Select TWO.)
Select all that apply
A developer is configuring an AWS Lambda function to retrieve messages from an Amazon SQS queue. To follow the security principle of least privilege, the developer decides to create a custom IAM role for the Lambda function. Which of the following configurations are required to establish this access? (Select TWO.)
Select all that apply
A developer is configuring an AWS CodeBuild project for a repository that contains multiple build configurations. The developer needs the project to use a custom build specification file named `buildspec-dev.yml` located inside a nested folder named `config`. How should the developer configure CodeBuild to locate this file?
A developer is designing a serverless document management system where users upload sensitive documents of approximately each. The application must perform client-side envelope encryption on these documents before uploading them to an Amazon S3 bucket. The developer wants to use an AWS KMS customer managed key for this process.
Which of the following actions must the developer perform to encrypt the documents and prepare them for storage? (Select TWO.)
Select all that apply
A developer is configuring an Amazon ECS task definition to deploy a microservice on AWS Fargate. The microservice retrieves database credentials from AWS Secrets Manager by referencing the secret's ARN in the container definition's `secrets` parameter. Additionally, the application code inside the container reads messages from an Amazon SQS queue. The container uses the `awslogs` log driver to send standard output logs to Amazon CloudWatch Logs. Which configuration of IAM roles correctly implements the principle of least privilege for this deployment?
A developer needs to encrypt database backup files, each approximately in size, before uploading them to an Amazon S3 bucket. The security policy requires client-side encryption using a customer managed key in AWS KMS. Which of the following actions must the developer perform to implement client-side envelope encryption for these files? (Select TWO.)
Select all that apply
A developer is deploying a containerized microservice to Amazon ECS using the Amazon EC2 launch type. The microservice application code needs to write records to an Amazon DynamoDB table and publish notifications to an Amazon SNS topic. The container also needs to send its standard output and error logs to Amazon CloudWatch Logs. How should the developer configure the IAM roles in the task definition to achieve this configuration securely?
A developer is writing an AWS Lambda function that retrieves database configurations from an external database on every invocation. The database queries are slow, causing high latency and occasionally leading to function timeouts. Which approach should the developer use to optimize the function's performance by caching the configurations across invocations?