All practice questions
1542 questions
A developer is running a containerized Python application in Amazon ECS on AWS Fargate. The container needs to read messages from an Amazon SQS queue. The ECS Task Definition has an ECS Task Role assigned with the necessary SQS permissions. During deployment, the developer accidentally leaves the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set to developer-specific credentials that do not have permission to access SQS. When the application initializes the Boto3 client, which of the following describes the credential resolution behavior and the result of the API calls?
A developer is writing an AWS Lambda function that retrieves data from a database. To optimize performance and reduce latency, the developer wants to reuse the database connection client across multiple function executions. In which part of the code should the database connection client be initialized to achieve this goal?
A developer is creating a serverless microservice. The developer wants to expose an endpoint using Amazon API Gateway that passes the raw incoming HTTP request details, such as headers, query parameters, and request body, directly to a backend AWS Lambda function as a single JSON object. The solution must not require any request mapping templates. Which integration type should the developer configure in API Gateway?
A developer is configuring a Java-based backend service that uses the AWS SDK to read objects from an Amazon S3 bucket. The service will be deployed to Amazon Elastic Container Service (ECS) on Amazon EC2 container instances. During testing, the developer wants to ensure that the SDK retrieves credentials securely using the default credential provider chain.
Which two credential sources are checked by the default credential provider chain before it attempts to retrieve credentials from the Amazon EC2 Instance Metadata Service (IMDS)?
Select all that apply
A developer has deployed an AWS Lambda function that performs CPU-intensive image resizing. During testing, the function successfully processes small image files, but frequently times out when processing larger image files. The developer wants to increase the processing speed of the function to prevent these timeouts. Which configuration change should the developer make?
A developer has configured an AWS Lambda function to run inside a private subnet of a custom VPC to query an Amazon RDS PostgreSQL database. The function must also retrieve API keys from AWS Secrets Manager and call an external third-party payment gateway over the internet. During testing, the function consistently times out when attempting to call the Secrets Manager service and the payment gateway. Which combination of network and code configurations will resolve these timeouts while maintaining access to the RDS database?
A company wants to connect a serverless microservice to an Amazon ElastiCache cluster located in a private VPC subnet. The microservice is implemented as an AWS Lambda function that must also call a public third-party weather API over the internet.
Which two configurations are required to establish this network connectivity? (Select two.)
Select all that apply
An e-commerce application's user onboarding workflow relies on an AWS Lambda function. The function is placed inside a private subnet of a custom VPC to securely query an Amazon Aurora PostgreSQL database. During a high-traffic promotional campaign, the application experiences two issues: the function fails to establish database connections because the database's maximum connection limit is exceeded, and it cannot connect to an external third-party identity verification API, resulting in network connection timeouts. Which two configuration modifications will resolve these issues?
Select all that apply
A developer is deploying a Go application to Amazon ECS on AWS Fargate. The application needs to retrieve objects from an Amazon S3 bucket. During local testing, the developer initialized the AWS SDK client using static AWS access keys. For the production environment, the application must use the IAM permissions granted by the ECS task role. Which configuration change should the developer make to satisfy these requirements?
A company is deploying a REST API using Amazon API Gateway. The API routes client requests to a backend AWS Lambda function. The function needs to read the incoming HTTP request headers and query parameters, and it must also specify the response status code and response headers directly within its execution code. What configuration should the company choose to ensure that the raw request is passed intact to the function, and that the function's output determines the client's HTTP response?
A developer is packaging a serverless microservice to run on AWS Lambda. The developer wants to optimize the function's startup performance by reducing cold start latency. Which two actions should the developer take? (Select two.)
Select all that apply
A developer is troubleshooting an application that uses the AWS SDK to access Amazon S3. The application is running on an Amazon EC2 instance that has an IAM instance profile attached. However, the developer notices that the application is using outdated, static credentials instead of the temporary credentials provided by the instance profile. Which of the following could be the root causes of this behavior? (Select TWO.)
Select all that apply
A developer is designing a serverless application that integrates with a third-party billing API. The application uses an AWS Lambda function to send requests. The API key for the billing provider is stored in AWS Secrets Manager and is automatically rotated every hours. During initial load testing, retrieving the key from Secrets Manager on every function invocation significantly increases the execution latency and Secrets Manager API costs. The developer wants to optimize the retrieval process while ensuring the function always uses a valid, unexpired API key. Which approach meets these requirements with the lowest latency and cost?
A developer is running a Python script on a local workstation to test integration with Amazon S3. The workstation's shared credentials file (`~/.aws/credentials`) contains a profile named `test-profile` with valid access keys. Before executing the script, the developer sets the `AWS_PROFILE` environment variable to `test-profile` in the terminal. However, the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are also set in the same terminal session from a previous task. The script initializes the S3 client using the default constructor `boto3.client('s3')`. Which credentials will the AWS SDK use to authenticate the S3 requests?
A developer is designing a REST API using Amazon API Gateway. The API must restrict access to authenticated users who log in using an Amazon Cognito user pool. The developer wants to validate the JSON Web Tokens (JWTs) sent in the request authorization header with the minimum amount of custom code and maintenance overhead. Which of the following is the most appropriate method to authorize these requests?
An application uses an AWS Lambda function to process incoming messages. The function is configured to connect to an Amazon Aurora PostgreSQL database inside a private subnet of a VPC. The function also needs to call an external partner API on the public internet to validate user information. During load testing, the developer observes two issues: the Lambda function fails to connect to the external partner API, resulting in network connection timeouts, and the Aurora database frequently runs out of database connections during concurrent invocation spikes.
Which combination of actions should the developer take to resolve these issues? (Select two.)
Select all that apply
A developer is configuring a REST API using Amazon API Gateway with a backend AWS Lambda function using custom (non-proxy) integration. The Lambda function throws an error containing the string 'InvalidParameter' when the input is malformed, but the client receives an HTTP 200 OK status response with the error message in the payload. What configuration change is required in API Gateway to ensure the client receives an HTTP 400 Bad Request status code?
A developer is building a Go application that will run in local Docker containers during development and will eventually be deployed to Amazon ECS on AWS Fargate. The application needs to retrieve objects from an Amazon S3 bucket. The developer wants to ensure that the application uses a specific local AWS CLI profile named 'dev-profile' when running locally, but seamlessly falls back to the container's task role when deployed to AWS Fargate, without requiring any code changes.
Which two actions must the developer take to achieve this configuration? (Select TWO.)
Select all that apply
A developer is configuring an AWS Lambda function that reads data from an Amazon DynamoDB table. Currently, the function initializes the AWS SDK client inside the handler function on every invocation, and the DynamoDB table name is hardcoded in the function code. Which two actions should the developer take to improve performance and adhere to AWS development best practices? (Select two.)
Select all that apply
A developer is building a mobile application that stores user profile information in an Amazon DynamoDB table. The table uses UserId as the partition key. The developer needs to retrieve the profile details of a specific user with a known UserId in the most cost-effective and low-latency way possible.
Which two API operations or practices should the developer use to achieve this?
Select all that apply