All practice questions
1542 questions
A developer is writing an AWS Lambda function that retrieves data from an Amazon RDS database. To optimize the function's performance and minimize connection overhead, the developer wants to reuse the database connection across multiple function invocations. How should the developer structure the function code to achieve this?
An organization's order-fulfillment system uses an AWS Lambda function to process batch payloads and write them to an Amazon Aurora PostgreSQL database located in a private subnet of a VPC. The Lambda function is configured to access the database directly by running within the same private VPC subnets. Database credentials must be retrieved from AWS Secrets Manager on each execution. During load testing, the Lambda function experiences connection timeouts when trying to retrieve secrets from Secrets Manager. Additionally, high concurrency causes the database to reject connections due to reaching its maximum connection limit. Which combination of actions should the developer take to resolve these issues? (Select two.)
Select all that apply
A developer is building a mobile fitness application that stores daily user activity summaries in an Amazon DynamoDB table. The table is configured with UserId as the partition key and ActivityDate as the sort key. The developer needs to retrieve the activity summary for a specific user on a specific date in the most efficient and secure manner. Which two actions should the developer take?
Select all that apply
A developer is building a serverless API where an Amazon API Gateway REST API is integrated with an AWS Lambda function using Lambda proxy integration. The Lambda function processes user data and returns a response. During testing, clients receive a Bad Gateway error. The Lambda execution logs show that the function ran successfully and completed without error. Which two changes should the developer make to the Lambda function's response to resolve this issue? (Select two.)
Select all that apply
A development team has configured a telemetry analysis application where an Amazon SQS queue triggers an AWS Lambda function to process device payloads. During load testing, the team observes the following issues:
1. Telemetry payloads are occasionally processed multiple times by different concurrent executions of the Lambda function.
2. The Lambda function periodically fails with a 'No space left on device' error when downloading temporary configuration files for validation.
Which two changes should the developer implement to resolve these issues? (Select TWO.)
Select all that apply
A developer is building a serverless application where a frontend web application, hosted on a custom domain, interacts with a backend REST API. The backend is configured using Amazon API Gateway with a Lambda proxy integration. To support cross-origin requests, the developer enabled CORS on the API Gateway resource using the AWS Console, which successfully created the OPTIONS method. However, when the frontend application attempts to send a POST request, the browser console displays a CORS error indicating that the 'Access-Control-Allow-Origin' header is missing. What must the developer do to resolve this issue?
An online learning platform stores student registration records in an Amazon DynamoDB table. The table uses StudentID as the partition key. A new feature requires retrieving a list of all students who registered in the last days. Registration dates are stored in an attribute named RegistrationDate. Which approach should the developer use to retrieve these records with the lowest latency and minimal Read Capacity Unit (RCU) consumption?
A developer is building a REST API in Amazon API Gateway. To allow the frontend development team to test their application before the backend microservices are fully implemented, the developer wants to configure an endpoint to return a mock response with a static JSON payload and an HTTP 200 status code. Which two actions must the developer take to configure this Mock integration in API Gateway? (Select TWO.)
Select all that apply
An engineering team is building a REST API using Amazon API Gateway that integrates with a legacy HTTP backend service using an HTTP integration (non-proxy). When the legacy backend cannot find a record, it returns an HTTP status code 404 with a plain text error message. The team wants the API Gateway to intercept this 404 response and instead return an HTTP status code 200 to the client, containing a structured JSON payload: {"available": false, "reason": "Record not found"}. Which configuration steps must the developer perform in API Gateway to meet these requirements?
A developer is writing a backend service for a task management application. The application stores user tasks in an Amazon DynamoDB table with UserId as the partition key and TaskId as the sort key. The developer needs to retrieve all tasks associated with a specific UserId that have a status of 'Pending'. The developer wants to minimize latency and the consumption of Read Capacity Units (RCUs).
Which two actions should the developer take to retrieve the required items efficiently? (Select TWO.)
Select all that apply
A developer is implementing a serverless data processing application where an Amazon Kinesis data stream triggers an AWS Lambda function via an event source mapping. During high-traffic periods, temporary downstream database connection failures cause the Lambda function to fail when processing certain batches. This results in the entire batch of records being repeatedly retried, causing head-of-line blocking and redundant processing of valid records. The developer wants to isolate the failing records, avoid processing duplicates where possible, and capture failed records for offline analysis without stalling stream ingestion.
Which two configurations should the developer apply to the Lambda event source mapping to meet these requirements? (Select two.)
Select all that apply
A developer is working on an AWS Lambda function that retrieves transaction data from an Amazon RDS PostgreSQL database running in a private subnet of a VPC. The function must also send an HTTP request to a third-party payment processor endpoint on the public internet. The developer configures the Lambda function to run inside the same VPC and private subnets as the database. Testing reveals that the Lambda function successfully queries the database but times out when attempting to connect to the payment processor.
Which configuration change should the developer make to resolve this connection timeout?
A developer is designing a REST API in Amazon API Gateway that must secure access to its endpoints using an existing Amazon Cognito User Pool. The developer wants to validate the JSON Web Tokens (JWTs) passed in the `Authorization` header of client requests with the minimum amount of custom code and lowest latency. Which configuration should the developer implement in API Gateway?
A developer is configuring an Amazon SQS FIFO queue to process incoming order events. To ensure that duplicate orders are ignored during a 5-minute window and that orders are processed in the strict order they were received, which TWO configurations must the developer implement?
Select all that apply
A developer is configuring a REST API in Amazon API Gateway that integrates with an AWS Lambda function. The API must use a Lambda non-proxy (custom) integration to allow request transformation. The developer needs to pass the incoming client request header X-App-Tenant-Id as a JSON property named tenantId in the payload sent to Lambda. Additionally, if the Lambda function fails with an error message containing TenantSuspended, the API must return an HTTP 403 Forbidden status code and a custom JSON message to the client. Which two configurations are required to meet these requirements? (Select two.)
Select all that apply
A developer is implementing a transaction processing system using an Amazon SQS FIFO queue. The system must process transactions in the exact order they occur. During testing, the developer notices that when two different transactions with identical message bodies are sent within two minutes of each other, the second transaction is discarded. Content-based deduplication is disabled on the queue. How should the developer modify the application configuration or message attributes to ensure both transactions are processed?
A developer has implemented an AWS Lambda function that is triggered by an Amazon SQS queue. The function retrieves database credentials from AWS Secrets Manager, connects to an Amazon RDS PostgreSQL database in a private subnet, and processes messages. During load testing, the database experiences connection exhaustion, and some SQS messages are processed multiple times. Which TWO actions should the developer take to resolve these issues?
Select all that apply
A developer is building a backend service that retrieves user profile history records from an Amazon DynamoDB table. The table is configured with UserID as the partition key and LastUpdated as the sort key. The developer wants to retrieve all historical records for a specific UserID using the AWS SDK. Which approach should the developer use to perform this retrieve operation most efficiently and securely?
A developer is designing a real-time fleet logistics tracking system. The system stores shipment event logs in an Amazon DynamoDB table. The table has `CarrierID` (String) as the partition key and `EventID` (String) as the sort key. The application must support three operations:
1. Retrieve all event logs for a specific carrier within a specific timestamp window, ordered from the most recent to the oldest.
2. Retrieve a specific event log's details across all carriers using the unique `EventID`.
3. Update the status of up to 10 event logs simultaneously in a single transaction, ensuring all updates succeed or all fail together.
Which combination of DynamoDB configurations and API operations will meet these requirements most efficiently? (Select TWO.)
Select all that apply
A developer is building a mobile shopping application that stores product details in an Amazon DynamoDB table. The application currently retrieves products belonging to a specific department by performing a Scan operation on the base table and filtering the results using a FilterExpression on the Department attribute. This is causing high latency and excessive Read Capacity Unit (RCU) consumption. Which two actions should the developer take to retrieve the products efficiently while minimizing RCU consumption? (Select TWO.)
Select all that apply