All practice questions
1542 questions
A developer is updating a serverless API backend running on AWS Lambda. The deployment must minimize user-facing impact by routing of the incoming traffic to the new Lambda version for a test window of minutes, while monitoring a CloudWatch alarm. If the alarm remains green, the remaining of traffic must shift to the new version immediately. If the alarm is triggered, the deployment must revert to the original version. Which AWS CodeDeploy configuration meets these requirements?
A developer is running a Python application locally using the AWS SDK for Python (Boto3) to retrieve objects from an Amazon S3 bucket.
The developer's local terminal has the following environment variables configured:
bash
export AWS_ACCESS_KEY_ID=AKIA111111111EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_PROFILE=staging
The shared AWS credentials file (`~/.aws/credentials`) contains:
ini
[staging]
aws_access_key_id = AKIA222222222EXAMPLE
aws_secret_access_key = userSecretKeyStagingExample
The application code is initialized as follows:
python
import boto3
s3 = boto3.client('s3')
response = s3.list_objects_v2(Bucket='my-staging-bucket')
When the developer runs the application, it fails with an `AccessDenied` error. The IAM user represented by `AKIA111111111EXAMPLE` does not have access to the S3 bucket, but the IAM user in the `staging` profile (`AKIA222222222EXAMPLE`) has full S3 permissions.
What is the reason for this failure, and how should the developer resolve it?
A developer is setting up an AWS CodeBuild project for a microservice located in a subdirectory (`services/order-service`) of a monorepo. The build process needs to run tests that require a database password stored in AWS Secrets Manager, and it must use a custom build specification file located at `services/order-service/buildspec.yml`. During the initial build run, the build fails immediately because the build specification file cannot be found, and the developer realizes that the application also lacks permission to fetch the database password.
Which combination of actions must the developer take to resolve these issues? (Select two.)
Select all that apply
A developer is building an enterprise web application. The application must authenticate corporate users using an external SAML 2.0 Identity Provider (IdP) and provide them with access to two resources: a secure REST API hosted on Amazon API Gateway, and a private Amazon S3 bucket for uploading reports directly from the client.
Which TWO configurations are required to meet these requirements? (Select TWO.)
Select all that apply
A developer is troubleshooting an AWS Lambda function that is configured to access an Amazon RDS DB instance inside a private subnet of a custom VPC. The function also needs to call an external billing API over the public internet. During testing, the developer observes two issues: the function cannot establish a connection to the external billing API, and the database experiences connection exhaustion due to a high volume of database connections being created during peak traffic. Which two actions should the developer take to resolve these configuration and performance issues? (Select TWO.)
Select all that apply
A development team manages their application infrastructure using an AWS CloudFormation stack. A developer needs to update the stack to change the instance type of an Amazon EC2 instance. However, drift detection reveals that the security group attached to the EC2 instance was manually modified out-of-band in the AWS Management Console to allow traffic on port . In addition, the developer needs to reference a database password that must be automatically rotated.
Which combination of steps should the developer take to resolve the drift and retrieve the password securely and cost-effectively? (Select TWO.)
Select all that apply
A developer is troubleshooting a serverless application where an Amazon API Gateway stage triggers an AWS Lambda function written in Python. The function processes incoming requests and retrieves secrets from AWS Secrets Manager using the `boto3` library. Active tracing is enabled on both the API Gateway stage and the Lambda function. However, the AWS X-Ray trace map shows the segments for API Gateway and the Lambda function, but does not display any segments for the calls to AWS Secrets Manager. How should the developer resolve this issue to ensure the Secrets Manager calls are visible in the trace map?
A developer is configuring a build project in AWS CodeBuild to package an application. The build process requires retrieving a non-sensitive database port number that rarely changes, and a database password that must be automatically rotated every 30 days. To optimize for cost, operational efficiency, and security, which configuration should the developer implement?
A developer is designing a high-traffic web application that will be deployed on Amazon ECS. The application requires a highly available session state store that can handle complex data structures, such as lists and sets, with sub-millisecond latency. The session data must be replicated across multiple Availability Zones, and any session that is inactive for more than 2 hours must be automatically removed.
Which TWO solutions or configurations should the developer implement to meet these requirements?
Select all that apply
A developer is creating an AWS CloudFormation template to deploy a web application. The application requires access to two configuration values:
1. A database connection password that must support automatic rotation every 30 days.
2. A public API endpoint URL for a third-party service that is non-sensitive and updated infrequently.
To follow security best practices and optimize costs, how should the developer store and reference these values in the CloudFormation template?
VoltMetric is a utility analytics platform that processes electricity usage metrics from millions of smart meters. The application writes high-frequency meter readings to an Amazon DynamoDB table configured with provisioned write throughput. The table uses `ZipCode` as the partition key and `Timestamp` as the sort key. During a heatwave, the application experiences a surge in writes from a highly populated urban zip code, leading to numerous `ProvisionedThroughputExceededException` errors in the ingest client logs. An analysis reveals that the total table write capacity is underutilized, but requests to this specific zip code are being throttled.
Which TWO actions should a developer take to resolve the write throttling and optimize the table's performance? (Select TWO.)
Select all that apply
A gaming company is experiencing high read latency on a metadata table in Amazon DynamoDB, which is causing slow response times in their mobile leaderboard application. The read latency needs to be reduced from single-digit milliseconds to microseconds to support a real-time user experience. Which of the following caching solutions is the most appropriate to resolve this latency bottleneck?
A developer is troubleshooting a local Node.js application running inside a Docker container. The application uses the AWS SDK for JavaScript (v3) to read data from an Amazon DynamoDB table. The application is configured to run under a non-root user named `node` with a home directory at `/home/node`. The developer wants the containerized application to use the AWS credentials defined in the `dev-profile` profile from the host machine's `~/.aws/credentials` file. Which combination of actions will allow the application in the container to successfully authenticate using the `dev-profile` credentials? (Select TWO.)
Select all that apply
A client-side Next.js web portal hosted on https://portal.ecocharge.net sends a POST request to an Amazon API Gateway REST API configured with a Lambda Proxy integration to register new users. The API Gateway has CORS enabled on the resource. The web portal console shows a CORS error stating that the 'Access-Control-Allow-Origin' header is missing on the requested resource after the browser successfully completes the OPTIONS preflight request. Which of the following is the correct action to resolve this issue?
A developer needs to deploy a new version of an application to an active AWS Elastic Beanstalk environment. The application must maintain 100% of its instance capacity to handle traffic during the deployment process. The deployment must be completed within the existing environment without creating a second, separate Elastic Beanstalk environment. Which two deployment strategies will meet these requirements? (Select two.)
Select all that apply
A developer is containerizing a Go application that retrieves messages from an Amazon SQS queue. For local testing, the application runs inside a Docker container on a local workstation. The developer has configured the AWS CLI on the host workstation with a default profile, and the CLI successfully connects to SQS. However, when the containerized application runs, it fails with a credentials provider error indicating that no credentials could be found. Which of the following is the most secure and appropriate way to resolve this credential error in the local development environment?
A developer is building a high-traffic e-commerce application that stores product catalog data in an Amazon DynamoDB table. The application experiences frequent spikes in read requests for a few highly popular products, causing a ProvisionedThroughputExceededException even though the total read capacity of the table is within limits. The product details are read-intensive and updated infrequently. The developer wants to resolve the throttling issues and reduce read latency to sub-millisecond levels with minimal code changes. Which solution should the developer implement?
A developer is building a web application where users sign in via social identity providers. The application needs to call a backend REST API on Amazon API Gateway, and also allow users to upload user profile photos directly to a private Amazon S3 bucket.
Which Cognito configuration meets these requirements with the least operational overhead?
A developer is configuring an AWS CodeBuild project that runs as a stage in an AWS CodePipeline. During the build execution, a script generates a dynamic version identifier based on the current git commit hash. The developer needs to pass this dynamically generated version identifier directly to a subsequent deployment stage in the pipeline without creating external dependencies. Which configuration in the `buildspec.yml` file will achieve this?
A developer is building a weather forecasting web application that retrieves current weather conditions from an Amazon DynamoDB table based on a postal code. The application experiences a large number of duplicate read requests for the same popular postal codes, resulting in high latency and read throttling. The developer wants to optimize the application's read performance with minimal changes to the application code. Which action should the developer take to resolve this issue?