All practice questions
1542 questions
A developer is designing a containerized microservice that runs on Amazon ECS. The microservice must store sensitive customer data in an Amazon DynamoDB table. Due to compliance requirements, the data must be encrypted client-side before it is sent to DynamoDB. The developer wants to use envelope encryption with an AWS KMS customer managed key to minimize KMS API calls and encrypt the data efficiently. Which two API operations must the developer implement in the microservice code to manage the keys for this client-side encryption and decryption workflow? (Select TWO.)
Select all that apply
A developer is configuring an AWS CodeBuild project that runs integration tests. These tests require credentials to access an Amazon RDS PostgreSQL database. The database credentials must be rotated automatically every days. How should the developer store and retrieve these credentials to meet the requirements with the least operational overhead?
A client-side SvelteKit dashboard application hosted on `https://admin.service.internal` sends a `DELETE` request to an Amazon API Gateway REST API. The request fails, and the browser console displays a CORS preflight error indicating that the `Access-Control-Allow-Origin` header is missing. The REST API is configured with a Lambda Proxy Integration and a custom Lambda Authorizer on the `DELETE` method. The developer has already used the API Gateway Console to enable CORS on the resource, which created an `OPTIONS` method. Which two actions must the developer take to resolve this issue?
Select all that apply
A health tracking application named FitPulse records real-time heart rate data from millions of user devices. The application writes telemetry records directly to an Amazon DynamoDB table configured with provisioned write capacity. The table uses `DeviceType` (with values such as `Watch`, `Band`, or `Ring`) as the partition key and `Timestamp` as the sort key. During a global fitness event, write activity surges, and the application receives a high volume of `ProvisionedThroughputExceededException` errors. CloudWatch metrics show that the total consumed Write Capacity Units (WCUs) are well below the table's total provisioned WCU limit. Which of the following is the most effective solution to resolve this throttling issue and ensure even write distribution across the partitions?
A developer is configuring a machine learning pipeline in Amazon SageMaker. The pipeline needs to retrieve a personal access token (PAT) to pull training code from a private Git repository. This PAT must be rotated monthly and accessed by pipelines running across multiple AWS accounts in the same organization. Additionally, the pipeline needs to retrieve non-sensitive training hyperparameters (such as learning rate and batch size) that are only used within the local AWS account. How should the developer store these values to meet the requirements securely and cost-effectively?
A developer is setting up an in-place deployment of a web application to Amazon EC2 instances using AWS CodeDeploy. The application revision bundle is stored in a private Amazon S3 bucket. During the deployment, the process fails during the DownloadBundle lifecycle event with an Access Denied error. Which action should the developer take to resolve this failure?
An AWS Lambda function in Account A () is configured to download files from an Amazon S3 bucket located in Account B (). The S3 bucket is encrypted using an AWS KMS customer managed key also located in Account B. The Lambda function's IAM execution role in Account A has an identity-based policy that grants permission for the `s3:GetObject` and `kms:Decrypt` actions. When the Lambda function runs, it fails to retrieve objects and receives an Access Denied error. Which two actions must be taken in Account B to resolve this authorization failure?
Select all that apply
A developer is configuring a serverless application where an AWS Lambda function processes messages from an Amazon SQS queue. The function performs CPU-intensive video transcoding that takes up to minutes to complete per message. During initial testing, the Lambda function's timeout is set to the default of seconds, resulting in execution timeouts. Additionally, the developer needs to prevent messages from being received and processed multiple times by other concurrent Lambda invocations while a message is currently being processed. Which configuration changes will resolve the execution timeouts and prevent duplicate message processing?
A developer is migrating a Python application from an Amazon EC2 instance to an Amazon EKS cluster. The application uses the AWS SDK for Python (Boto3) to access an Amazon DynamoDB table. On the EC2 instance, the application successfully used the instance profile credentials. In the EKS cluster, the application fails to authenticate, resulting in a NoCredentialsError.
The EKS ServiceAccount has been annotated with the role ARN arn:aws:iam::123456789012:role/my-dynamodb-role, and the environment variables AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE are correctly injected into the container. However, the application code initializes the client using boto3.Session(aws_access_key_id=access_key, aws_secret_access_key=secret_key) where the keys are read from a configuration file that is not present on EKS.
Which two changes should the developer make to resolve this authentication issue and securely run the application on EKS? (Select two.)
Select all that apply
A developer is implementing a new backend service using an Amazon API Gateway REST API with a Lambda proxy integration. To ensure that API Gateway can successfully process the response and forward it to the client, the Lambda function must return a JSON payload with a specific structure. Which JSON payload structure must the Lambda function return to represent a successful HTTP response?
{
"isBase64Encoded": false,
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": "{\"message\": \"Success\"}"
}
{
"statusCode": 200,
"body": {
"message": "Success"
}
}
{
"httpStatus": 200,
"message": "Success"
}
{
"headers": {
"Content-Type": "application/json"
},
"body": "{\"message\": \"Success\"}"
}
A developer is implementing a serverless worker using an AWS Lambda function triggered by an Amazon SQS queue. During performance testing, the developer observes that messages are frequently being processed multiple times by parallel Lambda executions. The Lambda function has an execution timeout of seconds, whereas the SQS queue has a visibility timeout of seconds. Which modification will prevent the messages from being processed multiple times?
A backend application running on Amazon EC2 instances must access an Amazon DynamoDB table using the AWS SDK. The developer needs to configure the application to retrieve temporary credentials automatically without using any long-lived credentials. Which configuration should the developer implement?
A developer is building a serverless web API using Amazon API Gateway and AWS Lambda with a Lambda Proxy integration. Which two actions must the developer take to ensure the Lambda function correctly receives client requests and returns successful responses? (Select TWO.)
Select all that apply
A developer is configuring a REST API in Amazon API Gateway using a Lambda proxy integration with a backend AWS Lambda function. Which two requirements or behaviors apply to this integration type? (Select TWO.)
Select all that apply
A developer is locally testing a Node.js microservice that integrates with Amazon S3. The developer wants the service to run using the AWS credentials of a development account, which are configured under a custom profile named `[dev]` in the local `~/.aws/credentials` file.
The developer's workstation also has the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` set to credentials representing a secondary testing AWS account.
The client is initialized as follows:
javascript
import { S3Client } from "@aws-sdk/client-s3";
const s3Client = new S3Client({ profile: "dev" });
During test execution, the developer notices that S3 requests are being sent to the secondary testing account instead of the development account.
Why is the S3 client using the incorrect credentials, and how should this be resolved?
A developer is configuring an Amazon API Gateway REST API with a Lambda proxy integration. The backend AWS Lambda function needs to return a custom HTTP status code of 201 (Created), a custom header, and a JSON payload to the client. How must the developer structure the response returned by the Lambda function?
A developer is deploying a new AWS Lambda function that reads data from an Amazon DynamoDB table. What is the AWS-recommended best practice for authorizing the Lambda function to perform this action?
A developer is writing a Node.js application that uses the AWS SDK for JavaScript to read data from an Amazon DynamoDB table. The application must run on the developer's local workstation during development and on an AWS Lambda function in the production environment. Which two configurations should the developer use to manage credentials securely and ensure the application works in both environments without code modifications?
Select all that apply
An e-commerce company is migrating their legacy billing system to a serverless architecture. They choose to expose their backend AWS Lambda function using an Amazon API Gateway REST API with a Lambda proxy integration. To ensure that the client application receives a valid JSON response from the API, what specific output requirements must the Lambda function adhere to? (Select TWO.)
Select all that apply
An application contains an AWS Lambda function that retrieves configuration files from Amazon S3 and writes audit logs to Amazon DynamoDB. The function's latency is higher than expected due to client initialization and S3 downloads occurring on every invocation. Which two actions will optimize the performance of this function by leveraging execution context reuse? (Select TWO.)
Select all that apply