All practice questions
1542 questions
A developer is building a document processing application that runs on an Amazon EC2 instance. The application needs to encrypt scanned PDF documents (each averaging in size) before sending them to a third-party storage system. Security policy requires that the files be encrypted using client-side envelope encryption with an AWS KMS customer managed key.
Which TWO steps should the developer take to implement this encryption workflow?
Select all that apply
A developer is optimizing a mobile news reader application that retrieves article metadata from an Amazon RDS MySQL database. When breaking news occurs, read traffic to the database spikes dramatically, causing latency issues. The article metadata is write-once and read-heavy. The developer wants to implement a caching solution using Amazon ElastiCache to mitigate database load, minimize memory usage by caching only the requested articles, and prevent the cache from running out of space.
Which TWO actions should the developer take to meet these requirements? (Select TWO.)
Select all that apply
A developer wants to create an Amazon CloudWatch metric filter to count occurrences of the term 'AccessDenied' in a plain text log group. The developer attempts to use the following CloudWatch Logs Insights query syntax as the metric filter pattern:
`fields @message | filter @message like /AccessDenied/`
However, the metric is not being incremented even when 'AccessDenied' appears in the logs.
Which of the following is the correct explanation and resolution for this issue?
A developer is using AWS CodeDeploy to deploy a Node.js web application to a fleet of Amazon EC2 instances. During the initial deployment run, the deployment fails.
The developer inspects the deployment console and identifies two root causes:
1. The CodeDeploy service is unable to interact with the EC2 instances to initiate the deployment.
2. A bash script specified in the `appspec.yml` file fails with an access denied error when attempting to retrieve database credentials from AWS Systems Manager Parameter Store.
The application's `appspec.yml` file is configured as follows:
yaml
version: 0.0
os: linux
files:
- source: /index.js
destination: /var/www/html/
hooks:
BeforeInstall:
- location: scripts/decrypt_creds.sh
timeout: 300
runas: dbadmin
Which two configurations must the developer implement to resolve these issues? (Select TWO.)
Select all that apply
A developer is writing an AWS CloudFormation template to deploy an application on Amazon EC2. The application requires two configurations: a database connection password that is sensitive and must be rotated automatically every 30 days, and an environment-specific application logging level (e.g., DEBUG or INFO) that is non-sensitive and updated frequently. Which configuration strategy should the developer implement in the template to meet these requirements securely and cost-effectively?
A developer is troubleshooting a distributed application. The flow begins with an Amazon API Gateway HTTP API that integrates with an AWS Lambda function. The Lambda function performs some processing and sends an HTTP request to an internal Java-based microservice running on Amazon ECS on AWS Fargate behind an Application Load Balancer (ALB). The Java microservice then writes records to an Amazon DynamoDB table.
Active tracing is enabled on both the API Gateway and the Lambda function. However, in the AWS X-Ray console, the developer observes that:
1. The trace map shows the Lambda function's execution segment, but the Java microservice and the subsequent DynamoDB calls are represented as a separate, disconnected trace map.
2. The DynamoDB calls themselves are missing from the X-Ray service map entirely.
Which two actions should the developer take to resolve these issues and establish continuous, end-to-end trace propagation?
Select all that apply
A developer is using Docker Compose to locally test a Python application that uses the AWS SDK (Boto3) to retrieve secrets from AWS Secrets Manager. The application runs inside the container under a non-root user account named `appuser` (with home directory `/home/appuser`).
On the host workstation, the developer has configured the AWS CLI with a profile named `local-dev` that contains the necessary IAM permissions. The container fails to authenticate with AWS, raising a `ClientError` indicating that no credentials can be found. The current `docker-compose.yml` file contains the following volume mount:
yaml
volumes:
- ~/.aws:/root/.aws:ro
Which two actions must the developer take to resolve this issue and ensure Boto3 uses the correct credentials? (Select two.)
Select all that apply
A containerized Node.js application is deployed on Amazon ECS using the AWS Fargate launch type. The application processes incoming HTTP requests and offloads compute-heavy processing and downstream database writes to asynchronous worker threads using the Node.js worker_threads module. The application uses the AWS X-Ray SDK to capture traces. The developer has enabled the AWS X-Ray daemon in a sidecar container and initialized the SDK using AWSXRay.captureAWS(AWS). However, the application logs show 'SegmentNotFoundException: Failed to get the current sub/segment from the context' during DynamoDB writes inside the worker threads, and these downstream calls are missing from the X-Ray traces. Which action should the developer take to resolve this issue?
A developer is integrating a third-party SaaS monitoring platform with their company's AWS account. The SaaS platform runs in AWS Account and needs to assume an IAM role in the developer's AWS Account to retrieve CloudWatch metric data. To prevent the confused deputy problem, the SaaS platform requires the developer to configure an External ID of `SaaS-Monitor-99x`.
Which two actions must the developer perform to establish this cross-account access securely? (Select TWO.)
Select all that apply
A developer has a Python application deployed on Amazon ECS with the AWS Fargate launch type. The application is instrumented using the AWS X-Ray SDK for Python, with `patch_all()` invoked at startup. To improve request throughput, the application uses a `ThreadPoolExecutor` from the `concurrent.futures` module to perform downstream HTTP requests using the `requests` library and write operations to Amazon DynamoDB in parallel worker threads. The X-Ray daemon runs as a sidecar container in the ECS task. When analyzing traces in the AWS X-Ray console, the developer observes that downstream HTTP calls and DynamoDB operations executed within the worker threads are not associated with the main request trace, showing up as separate traces or missing entirely. Which of the following actions should the developer take to resolve this tracing correlation issue?
A developer has deployed a Node.js-based AWS Lambda function that retrieves user profiles from an Amazon RDS PostgreSQL database. To minimize latency, the database connection client is declared and initialized globally outside the handler function. During load testing with high request volumes, the function performs correctly. However, during periods of low traffic, subsequent requests fail with database connection errors, causing the Lambda function to time out. Which of the following is the most likely cause of this issue?
A developer is building a serverless e-learning application where students log in using an Amazon Cognito User Pool. The application's frontend client needs to access course content through an Amazon API Gateway REST API. The developer needs to secure the API so that only authenticated students can access the resource, verifying their identity directly via their login session tokens. Which solution should the developer implement to meet these requirements with the least operational overhead?
A developer is hosting a single-page web application in an Amazon S3 bucket. The application makes API calls to an Amazon API Gateway endpoint that is integrated with a Lambda function using Lambda Proxy integration. During testing, the browser console displays a CORS error stating that the preflight request was blocked because the Access-Control-Allow-Origin header is missing. Which two steps must the developer take to resolve this CORS error? (Select TWO.)
Select all that apply
A developer is troubleshooting a hotel reservation system. A backend microservice runs an AWS Lambda function that processes booking requests. The function is configured to connect to an Amazon Aurora PostgreSQL database deployed in private subnets within a custom VPC. After successfully updating the database, the function makes an HTTPS call to a third-party SMS gateway to send confirmation messages. During testing, database updates succeed, but the Lambda function execution fails. The Amazon CloudWatch logs show that the HTTPS request to the external SMS gateway times out, leading to a function-level timeout error: `Task timed out after seconds`. The VPC configurations are as follows: the Lambda function is associated with the same private subnets as the Aurora database; an Internet Gateway is attached to the VPC; the route tables for the private subnets have a default route () pointing directly to the Internet Gateway; and the security group associated with the Lambda function allows all outbound traffic (). Which two actions should the developer take to resolve this network connectivity issue?
Select all that apply
A developer is creating an IAM role for an AWS Lambda function that needs to write logs to an Amazon S3 bucket named "my-app-logs-bucket". The developer has written the following permissions policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::my-app-logs-bucket/*"
}
]
}
Which two configuration steps must the developer perform to ensure the Lambda function has the necessary permissions to write to the S3 bucket?
Select all that apply
A developer is configuring a blue/green deployment for an Amazon Elastic Container Service (Amazon ECS) service using AWS CodeDeploy. The deployment must shift traffic to the new task set gradually to allow for monitoring, but the entire deployment process must finish shifting of the traffic in less than minutes.
Which TWO predefined deployment configurations will meet these requirements? (Select TWO.)
Select all that apply
A developer has a Java application running on Amazon EC2 instances. The developer has instrumented the application code using the AWS X-Ray SDK to trace incoming HTTP requests and downstream AWS service calls. However, no trace data is appearing in the AWS X-Ray console. Which TWO actions must the developer take to ensure that trace data is successfully sent to AWS X-Ray?
Select all that apply
A developer is maintaining a continuous delivery pipeline in AWS CodePipeline that consists of Source, Build, and Deploy stages. The Deploy stage uses AWS CodeDeploy to release updates to an Amazon ECS service. The developer needs to temporarily prevent new builds from being deployed to ECS while the production database undergoes a scheduled maintenance window. However, developers must still be able to commit code changes, and the pipeline must continue to run the Source and Build stages to validate the builds. Which configuration change should the developer make to achieve this goal with the least administrative effort?
A developer is deploying a Python application to AWS Elastic Beanstalk. The application needs to retrieve two values: a connection string password for a self-hosted PostgreSQL database running on an Amazon EC2 instance (which must be rotated every 45 days), and a payment gateway API endpoint URL (which is non-sensitive and static). To meet these requirements with the lowest cost and operational effort, which two configuration steps should the developer perform? (Select TWO.)
Select all that apply
A frontend Single Page Application (SPA) hosted at `https://dashboard.company.local` makes a cross-origin `POST` request to an Amazon API Gateway REST API configured with a Lambda Proxy Integration. In the browser developer tools, the developer observes that the preflight `OPTIONS` request succeeds with a `200 OK` status code, but the subsequent `POST` request is blocked. The browser console displays: `Access-Control-Allow-Origin 'https://dashboard.company.local' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource`. Additionally, the network tab shows that the `POST` request received a `502 Bad Gateway` status code from API Gateway. Which of the following is the most accurate explanation for this behavior, and what corrective actions should the developer take to resolve both issues?