All practice questions
1542 questions
A developer is implementing a decoupled transaction processing system. Transaction event messages are published to an Amazon SNS FIFO topic. An Amazon SQS FIFO queue is subscribed to the topic, and an AWS Lambda function consumes messages from the queue.
The system must satisfy these requirements:
- Transactions for the same bank account must be processed in the exact order they are received.
- If duplicate transactions with the exact same payload are published within a -minute window, only the first transaction should be processed.
- The AWS Lambda function takes up to seconds to process a single transaction.
During testing, the developer notices two issues:
1. Transactions for the same bank account are sometimes processed out of order.
2. Transactions that take longer than seconds to process are occasionally processed a second time by another Lambda invocation.
Which two of the following configuration changes will resolve these issues? (Select TWO.)
Select all that apply
A developer is troubleshooting a serverless application where an AWS Lambda function is triggered by an Amazon SQS queue to process incoming batch jobs. The Lambda function has a configured timeout of minutes. The Amazon SQS queue has a visibility timeout of seconds. During testing, the developer observes that messages are frequently being processed multiple times by parallel Lambda invocations before being successfully deleted.
Which configuration change will resolve this issue?
An organization is exposing a database via a REST API using Amazon API Gateway. The developer configures an AWS Service Integration to retrieve user records directly from an Amazon DynamoDB table without using a compute layer like AWS Lambda. The API must receive requests containing a username path parameter, query the DynamoDB table, and return a simplified JSON payload to the client instead of the standard DynamoDB attribute-value JSON format. Which two configuration steps must the developer perform in API Gateway to meet these requirements?
Select all that apply
A smart-home application stores hourly temperature readings from thousands of devices in an Amazon DynamoDB table. The table is configured with DeviceID as the partition key and Timestamp as the sort key. A developer needs to retrieve all temperature readings for a specific device, 'device-123', that were recorded over the last 24 hours. Which DynamoDB API operation and configuration should the developer use to perform this retrieval with the lowest latency and cost?
A logistics company uses a fleet of Amazon ECS tasks to process shipment tracking updates. The tasks poll messages from an Amazon SQS standard queue, retrieve the payload, and update an Amazon RDS database. The queue's default visibility timeout is configured to seconds. Most updates are processed within seconds; however, updates requiring complex database transactions can take up to seconds. During peak hours, the developer notices that complex updates are processed multiple times, causing duplicate entries in the database. Which solution will resolve this issue in the most efficient and resilient manner?
A developer is configuring a REST API in Amazon API Gateway using an HTTP custom (non-proxy) integration to connect to a legacy backend HTTP service. The API must map the backend service's Service Unavailable response to a Gateway Timeout client response. Additionally, the backend service requires the client's IP address to be sent in a custom header named `X-Forwarded-For-IP` derived from the API Gateway context. Which TWO configuration steps must the developer perform in API Gateway to meet these requirements?
Select all that apply
A developer is writing an AWS Lambda function in Node.js to calculate order discounts. The developer declares a helper array, `appliedDiscounts`, outside of the handler function to store the discount codes applied during execution. During testing, the developer notices that subsequent invocations of the function return incorrect discounts because they contain discount codes from previous invocations. Which of the following actions should the developer take to resolve this issue?
A developer is configuring an AWS Lambda function to process user upload notifications from an Amazon SQS standard queue. The Lambda function timeout is configured to seconds. However, the SQS queue's default visibility timeout is set to seconds. During performance tests, the developer notices that some upload messages are processed multiple times by different Lambda instances. Which action should the developer take to resolve this duplication issue?
A developer is deploying an AWS Lambda function that processes user sessions. The function must retrieve user profile data from an Amazon ElastiCache for Redis cluster located in a private subnet of a custom VPC. Additionally, the Lambda function needs to call the public AWS Secrets Manager API to retrieve database credentials. The developer configures the Lambda function's VPC settings with the private subnets and the security group of the VPC. During testing, the Lambda function successfully queries ElastiCache but times out when trying to call Secrets Manager. There are currently no VPC endpoints configured in the VPC.
How should the developer configure the VPC and Lambda settings to resolve this timeout issue?
An organization has a REST API exposed via Amazon API Gateway that routes client requests to a backend AWS Lambda function. To reduce Lambda invocation costs, the developer needs to validate that incoming JSON request payloads contain a required `accountId` string field before the requests are forwarded to the backend. If a request is invalid, API Gateway must return an HTTP 400 Bad Request response directly to the client without invoking the backend function.
Which configuration steps should the developer perform to meet these requirements?
A developer is transitioning an Amazon API Gateway REST API from a Lambda custom (non-proxy) integration to a Lambda proxy integration. The backend Lambda function needs to access the client's IP address and a query string parameter named `version` that were previously mapped via a Velocity Template Language (VTL) mapping template. The Lambda function also must return a custom HTTP status code of `201 Created` along with a JSON payload.
Which TWO actions must the developer take to accomplish this transition successfully? (Select TWO.)
Select all that apply
A developer is implementing a financial ledger application where transaction updates must be processed in the exact order they are received, without duplicates. The developer configures a client application to publish transaction events to an Amazon SNS FIFO topic, which is subscribed to an Amazon SQS FIFO queue.
During testing, the developer observes that when a user performs two different transactions (a deposit followed by a withdrawal) within a -minute window, only the first transaction is successfully written to the ledger database. The second transaction message is never delivered to the SQS queue, and no errors are logged by the publisher or consumer. The SNS FIFO topic has Content-Based Deduplication disabled, and the developer is manually setting the `MessageDeduplicationId` to the user's account ID for both messages.
Which configuration change should the developer make to ensure that both transaction messages are successfully delivered and processed in the correct order?
An application is running on an Amazon EC2 instance in Account A (111111111111). The application needs to read data from an Amazon DynamoDB table in Account B (222222222222) by assuming an IAM role named CrossAccountDynamoDBRole in Account B. The EC2 instance is launched with an IAM instance profile associated with the IAM role EC2AppRole in Account A.
Which IAM trust policy must be attached to the CrossAccountDynamoDBRole in Account B to allow the EC2 application to assume it?
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:role/EC2AppRole"
},
"Action": "sts:AssumeRole"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:instance-profile/EC2AppInstanceProfile"
},
"Action": "sts:AssumeRole"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:role/EC2AppRole"
},
"Action": "dynamodb:GetItem"
}
]
}
A developer is building a serverless data processing application. A Lambda function is triggered by an Amazon S3 object upload event. The function must download the uploaded file (which can be up to in size), process the contents, and send the results to a third-party payment gateway endpoint on the public internet. The function also needs to log transaction details to an Amazon RDS PostgreSQL database instance located inside a private subnet of a custom VPC. To optimize performance and security, which of the following actions should the developer take when configuring and developing the Lambda function? (Select TWO.)
Select all that apply
An application processes file uploads from an Amazon S3 bucket using an AWS Lambda function. The function needs to write data to an Amazon RDS database located in a private subnet of an Amazon VPC, and also send status updates to an external third-party API. The function is configured to run inside the same private VPC subnet. During testing, the function successfully writes to the database but fails with network timeouts when calling the external API. Which configuration change will resolve this issue?
A developer is configuring an Amazon API Gateway REST API with an HTTP custom (non-proxy) integration that connects to an on-premises backend service. The backend service always returns an HTTP 200 OK status code, even when an application-level error occurs. When such an error occurs, the backend JSON response body contains the field "errorCode": "INVALID_PARAMETERS". The developer needs the API Gateway to return an HTTP 400 Bad Request status code to the client instead of HTTP 200 OK when this error is present.
Which configuration strategy should the developer use to achieve this?
An enterprise transaction processing application uses a decoupled architecture where a core system publishes high-priority financial transaction messages to an Amazon SNS FIFO topic. Two downstream services consume these messages:
- Service A: Runs on AWS Lambda, consumes messages via an Amazon SQS FIFO queue subscribed to the SNS FIFO topic, and updates account balances in an Amazon DynamoDB table. The Lambda function has a maximum concurrency of 5 and can take up to 20 seconds to process a batch of messages.
- Service B: Runs on Amazon ECS Fargate and consumes messages via a separate Amazon SQS FIFO queue subscribed to the SNS FIFO topic for audit logging.
During peak transaction hours, the developer observes two issues:
1. Service A experiences occasional transaction processing failures due to DynamoDB ProvisionedThroughputExceededException. The developer wants to retry only the failed transactions within a batch rather than reprocessing the entire batch, while maintaining the processing order of the remaining messages.
2. Service B occasionally processes duplicate transaction logs. This happens because the publishing system retries sending messages to the SNS FIFO topic when it encounters temporary network timeouts before receiving a publish acknowledgment from SNS.
Which two actions should the developer take to resolve these issues? (Select TWO.)
Select all that apply
A developer is building a serverless web portal for a medical scheduling system. Users must authenticate using their corporate Google Workspace accounts through OpenID Connect (OIDC). Once authenticated, the web portal must invoke private API routes hosted on Amazon API Gateway. The developer needs to validate the user session token at the API Gateway layer with the least operational overhead and without writing custom validation code.
Which solution meets these requirements?
A developer is troubleshooting an application that processes message payloads from an Amazon SQS queue. The application requires an average of 45 seconds to successfully process and delete each message. Currently, the same messages are being received and processed multiple times by the application. Which configuration change will prevent this behavior?
A developer is designing a REST API using Amazon API Gateway that routes client requests to an AWS Lambda backend. The API must satisfy the following development requirements:
1. Authenticate and validate JSON Web Tokens (JWTs) issued by an Amazon Cognito User Pool at the gateway level before forwarding requests.
2. Pass the complete HTTPS request details (including path parameters, headers, and query strings) directly to the Lambda function without the developer having to configure or maintain mapping templates.
Which two actions should the developer take to meet these requirements?
Select all that apply