All practice questions
1542 questions
A developer is troubleshooting a serverless application where an AWS Lambda function written in C# (.NET) processes order events. The Lambda function is invoked by an Amazon API Gateway REST API. The function makes downstream HTTP calls to a third-party payment gateway and performs read/write operations on an Amazon DynamoDB table. Active tracing is enabled on both the API Gateway stage and the Lambda function. However, when inspecting the AWS X-Ray console, the developer observes that while the API Gateway and Lambda function segments appear, the HTTP calls to the payment gateway and the DynamoDB operations are missing from the trace.
Which of the following actions should the developer take to record the downstream calls in the X-Ray traces?
A developer is setting up a blue/green deployment for a containerized application running on Amazon ECS using AWS CodeDeploy. The deployment must route of the production traffic to the new version of the application immediately. The remaining of the traffic must be routed to the new version only after a -minute validation period, during which the application's health is monitored. If any errors occur during this period, CodeDeploy must automatically roll back the deployment.
Which pre-defined CodeDeploy deployment configuration should the developer use to meet these requirements?
A developer deployed an Amazon EC2 instance and an associated security group using an AWS CloudFormation stack. Later, a network administrator manually added an inbound rule allowing TCP port 3389 (RDP) directly via the Amazon VPC Console to troubleshoot a connection issue. The developer runs drift detection on the stack and confirms that the security group is in a drifted state. The developer wants to restore the security group to the exact configuration defined in the CloudFormation template. Which of the following is the correct method to resolve this drift?
A developer is troubleshooting a Python application on a local development workstation. The application uses the AWS SDK for Python (Boto3) to interact with AWS resources.
The developer has configured two profiles in the local `~/.aws/credentials` file: a `default` profile and a `custom-dev` profile.
To test the application locally, the developer runs the following commands in the terminal:
bash
export AWS_PROFILE=custom-dev
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
When the developer runs the application, they notice that the SDK uses the IAM credentials from the environment variables rather than the configuration defined for `custom-dev` in the credentials file.
Why does the AWS SDK execute the requests using the environment variable credentials instead of the `custom-dev` profile?
A developer is building a serverless mobile application for fitness tracking. The application needs to authenticate users using an external OpenID Connect (OIDC) identity provider. Once authenticated, the application must allow users to call an Amazon API Gateway REST API and upload workout logs directly to their own private folders in an Amazon S3 bucket. Which TWO configurations should the developer implement to meet these requirements?
Select all that apply
A company is deploying a microservices-based application on Amazon Elastic Container Service (Amazon ECS). The application requires access to two types of data: database credentials for an Amazon RDS database that must be rotated automatically every 14 days, and a non-sensitive configuration setting indicating the application's logging level. The developer wants to implement a secure solution that minimizes both management overhead and overall cost. Which of the following actions should the developer take to meet these requirements? (Select TWO.)
Select all that apply
An application running on an Amazon EC2 instance is designed to fetch daily configuration files from a private Amazon S3 bucket. During deployment, the application throws an Access Denied exception when attempting to call the `s3:GetObject` API operation. The developer has attached a policy with the required S3 permissions to an IAM role called `S3ReaderRole`, which is associated with the instance profile. Upon inspecting the role's trust policy, the developer finds the following configuration:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Which of the following modifications should the developer make to resolve this access issue?
A ticket booking application named TicketSwift records concert reservations in an Amazon DynamoDB table. The table uses ConcertID as the partition key and BookingTimestamp as the sort key. During major ticket releases, the application experiences a surge in ProvisionedThroughputExceededException errors, even though the total read and write capacity units (RCUs and WCUs) are auto-scaled and remain well below the table-level limits. An analysis shows that millions of requests are targeting a single popular concert within a few minutes. Which combination of actions will resolve this throttling issue and optimize key distribution? (Select TWO.)
Select all that apply
A developer is troubleshooting a serverless application deployed on AWS Lambda. The application logs events in a structured JSON format to Amazon CloudWatch Logs. The developer needs to configure CloudWatch metric filters to monitor two separate issues:
1. Lambda function execution timeouts, which generate service-level log lines containing the string: `Task timed out after`
2. Application API failures, where the log events are JSON objects containing a key `statusCode` with a value of 500 or greater.
Which two configurations should the developer implement to achieve this? (Select TWO.)
Select all that apply
A developer is writing an AWS CloudFormation template to deploy an Amazon EC2 instance that runs a web server. The developer wants to ensure that the EC2 instance is not marked as CREATE_COMPLETE until the web server application package is successfully installed and the service is started. If the installation fails or does not complete within 15 minutes, the stack creation should fail and rollback. Which TWO actions must the developer perform in the CloudFormation template and instance configuration to meet these requirements?
Select all that apply
A developer is building a serverless orchestration workflow using AWS Step Functions. One of the workflow's task states invokes an AWS Lambda function that integrates with a third-party merchant API. The merchant API requires a secure API key for authentication. The company's security policy requires that this API key be rotated every 30 days. Which solution meets these requirements with the least operational overhead?
A developer is setting up an AWS Lambda function that needs to retrieve and write items to an Amazon DynamoDB table in the same AWS account. The developer creates an IAM role named `LambdaDbAccessRole` to be used as the function's execution role. However, when attempting to save the Lambda function configuration, the developer receives an error stating that the AWS Lambda service is not authorized to assume the role. The developer checks the trust policy currently attached to `LambdaDbAccessRole` and finds the following document:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem"
],
"Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Products"
}
]
}
How should the developer resolve this issue to allow the Lambda function to execute and interact with the DynamoDB table?
A developer is configuring an AWS CodeBuild project to compile and package a Java application. The buildspec.yml file is placed in the root of the source repository and contains a valid artifacts section listing the target JAR file. The build execution completes with a status of SUCCEEDED, but no artifacts are uploaded to the destination Amazon S3 bucket. Which of the following is the most likely cause of this issue?
RideFlow is a ride-sharing platform that logs completed trips to an Amazon DynamoDB table. The table is configured with provisioned write capacity. The table's partition key is CityID and the sort key is TripTimestamp. During peak commute times, the platform experiences a high volume of writes for the city code NYC. As a result, the application logs ProvisionedThroughputExceededException errors, even though the total consumed write capacity units (WCUs) for the entire table are significantly below the provisioned threshold. Which strategy should a developer implement to resolve this throttling issue?
An application deployed on Amazon ECS writes JSON-formatted logs to Amazon CloudWatch Logs. A sample log event is shown below:
{
"statusCode": 500,
"errorType": "DatabaseTimeoutException",
"message": "Connection to database timed out."
}
The developer needs to create a CloudWatch Metric Filter to count the occurrences of this specific database timeout error. Which filter pattern should the developer use to match logs where the statusCode is 500 and the errorType is exactly DatabaseTimeoutException?
A software engineer is configuring security for a web application where clients send requests to a REST API hosted on Amazon API Gateway. The application uses an Amazon Cognito User Pool for user authentication. The engineer must restrict access to the REST API so that only authenticated users with a valid JSON Web Token (JWT) can call the endpoints, without writing custom code to decode or validate the tokens. Which solution meets these requirements with the least operational overhead?
A developer is deploying a new version of a critical web application to AWS Elastic Beanstalk. The deployment must satisfy the following constraints:
- The application must maintain of its serving capacity throughout the deployment process to handle high user traffic without performance degradation.
- In the event of a deployment failure, the application must support an immediate rollback to the previous version without requiring a rolling update of the older version.
- The development team has approved a temporary increase in resource capacity to allow up to twice the normal instance count during the deployment.
Which deployment strategy will meet these requirements?
A developer is containerizing a Go application that retrieves database credentials from AWS Secrets Manager using the AWS SDK for Go v2. During local development, the application is run in a Docker container using a non-root user (UID 1000) for security compliance. The developer mounts the host's `~/.aws` folder to `/home/appuser/.aws` inside the container. When the container starts, the application fails to authenticate with AWS and logs a credentials-not-found error.
*Security Notice: Writing plaintext credentials in code or container image definitions is strictly prohibited.*
Which action will resolve this local development credential issue?
A developer is configuring a blue/green deployment for an Amazon ECS service using AWS CodeDeploy. The developer wants to run a validation script to perform smoke tests before production traffic is routed to the new task set. The developer creates the following `appspec.yaml` file:
yaml
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: "arn:aws:ecs:us-east-1:123456789012:task-definition/my-app:1"
LoadBalancerInfo:
ContainerName: "my-app-container"
ContainerPort: 8080
Hooks:
- BeforeAllowTraffic:
- location: scripts/run-smoke-tests.sh
timeout: 300
During deployment, the CodeDeploy agent fails to parse the AppSpec file. How should the developer modify the AppSpec file to resolve this issue?
A company is updating an infrastructure stack deployed via AWS CloudFormation. The template contains an Amazon DynamoDB table that needs to be modified. The planned modification requires CloudFormation to replace the DynamoDB resource. The developer wants to ensure that the database's existing data is preserved and the resource is not deleted during this replacement, as well as if the stack is deleted in the future. Which configuration should the developer apply to the DynamoDB resource in the template?