All practice questions
1542 questions
A developer is deploying a serverless application using AWS SAM. The application features a Lambda function triggered by an API Gateway HTTP API. After using the AWS SAM CLI to package and deploy the application, the developer observes two issues:
1. The CloudFormation stack deployment fails with an error indicating that the Lambda service is unauthorized to assume the execution role associated with the function.
2. After manual role adjustment, a test request to the API Gateway endpoint fails with a 502 Bad Gateway error, even though the Lambda function executes successfully without code exceptions.
Which TWO actions should the developer take to resolve these issues?
Select all that apply
An engineering team is developing a serverless application using the AWS Serverless Application Model (SAM). The team wants to define a default timeout of 15 seconds that automatically applies to all Lambda functions declared in the template, rather than specifying the timeout property individually for each function resource. Which of the following approaches should the team use to meet this requirement?
A developer is evaluating deployment strategies for an internal web application hosted on an AWS Elastic Beanstalk environment. The application can tolerate temporary downtime or reduced capacity during the update process. The primary constraint is to avoid any additional costs or the provisioning of temporary instances. Which two deployment strategies should the developer consider? (Select two.)
Select all that apply
A serverless application running on AWS Lambda needs to retrieve configuration data. This includes a database hostname, which is a non-sensitive configuration parameter, and a database password, which is a sensitive credential that must be rotated automatically every month. Which two options describe the most secure and cost-effective locations to store these values? (Select TWO.)
Select all that apply
A developer is deploying a serverless application using AWS SAM. The developer needs to deploy a Lambda function that retrieves a database credential from AWS Secrets Manager. The developer writes the following template (`template.yaml`):
yaml
Resources:
DBSecret:
Type: AWS::SecretsManager::Secret
Properties:
Name: my-db-secret
SecretString: '{"password":"mypassword"}'
RetrieveSecretFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs18.x
CodeUri: ./src
Policies:
- AWSSecretsManagerGetSecretValuePolicy:
SecretArn: !Ref DBSecret
Environment:
Variables:
SECRET_NAME: !Ref DBSecret
When attempting to deploy this template using the AWS CLI `aws cloudformation deploy` command, the deployment fails with the error: `Template format error: Unrecognized resource type: AWS::Serverless::Function`. Additionally, the Lambda function code is incorrectly configured to retrieve the database credential using the Systems Manager Parameter Store SDK API client.
Which two actions must the developer take to resolve the deployment failure and ensure the Lambda function can retrieve the database credential?
Select all that apply
A developer is configuring a custom IAM role named `ApplicationLogWriterRole` for a new AWS Lambda function that must write logs to an Amazon S3 bucket. The developer attempts to define both the trust relationship and the S3 permissions in a single policy document when creating the role. The developer applies the following JSON document as the role's trust policy (Assume Role Policy):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": [
"sts:AssumeRole",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::app-logs-2026/*"
}
]
}
No other policies are attached to the IAM role. When the Lambda function executes and attempts to upload a log file to the S3 bucket, it receives an `AccessDenied` error. How should the developer resolve this issue?
A developer is managing an AWS CloudFormation stack for a production backend application. During a stack update, the deployment fails, and the stack enters the UPDATE_ROLLBACK_FAILED state because an IAM role referenced by the template was manually deleted out-of-band. The developer has corrected the template and needs to apply the update to the stack. Which action should the developer take to resolve the stack state and successfully deploy the update?
A developer is configuring an AWS Lambda function that must run inside a private subnet of a custom VPC. The Lambda function needs to retrieve database credentials from AWS Secrets Manager without the traffic traversing the public internet, and it must also call a public API endpoint on the internet to validate transactions. Which of the following network configuration steps are required to allow the Lambda function to perform these tasks? (Select TWO)
Select all that apply
An organization receives large, encrypted backup archives from an external partner. The partner encrypts these archives using envelope encryption with an AWS KMS customer managed key (CMK). Along with each archive, the partner provides the encrypted data key (ciphertext data key). Which sequence of actions must a developer implement in the decryption utility to retrieve the original plaintext data?
A developer is configuring a continuous integration pipeline using AWS CodeBuild to compile a Node.js application, run unit tests, and push the resulting container image to an Amazon Elastic Container Registry (ECR) repository. The developer needs to configure the build process to meet the following requirements:
* The unit tests must run during the build process. If they fail, the build must stop immediately and mark the build run as failed.
* A cleanup script must execute to remove temporary files, regardless of whether the unit tests succeed or fail.
* The Docker image must only be built and pushed to Amazon ECR if all unit tests pass.
Which configuration should the developer use to meet these requirements?
A developer is configuring a blue/green deployment for an Amazon ECS service using AWS CodeDeploy. The deployment must meet the following requirements:
- Provide zero downtime for users during updates.
- Run automated integration tests to validate the replacement task set (Green) using a test port before any production traffic is shifted.
- Automatically and immediately roll back the deployment if the validation tests fail, or if a CloudWatch alarm for HTTP 5xx errors is triggered.
- Shift 10% of the production traffic to the new version initially, and shift the remaining 90% after a 15-minute soak period.
Which two configurations or lifecycle hooks should the developer use to meet these requirements? (Select TWO.)
Select all that apply
A developer is configuring a blue/green deployment for a containerized microservice running on Amazon ECS using AWS CodeDeploy. The deployment must execute a database schema migration before the replacement task set is created. Additionally, after the replacement task set is provisioned and test traffic is routed to it via a test listener, the developer must run integration tests against the test port to validate the deployment before shifting production traffic.
Which of the following configurations should the developer implement in the AppSpec file to meet these requirements? (Select TWO.)
Select all that apply
An application hosted on an Amazon EC2 instance needs to securely retrieve configuration settings from an Amazon S3 bucket. A developer is tasked with setting up the necessary IAM permissions using security best practices. Which configuration steps should the developer perform to grant the application access to the S3 bucket? (Select TWO.)
Select all that apply
A developer is testing a Go application locally that reads messages from an Amazon SQS queue. The developer intends to run the application using a specific AWS CLI profile named `dev-profile` defined in the `~/.aws/credentials` file. However, when executing the application in the terminal, the application connects using credentials from a different AWS account. The developer notices that the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are currently set in the active terminal session. Which of the following actions will resolve this issue and force the Go SDK to use the configuration from `dev-profile`?
A developer is updating a microservice hosted on Amazon ECS. Due to budget constraints, the developer cannot provision any additional container instances in the ECS cluster. The application is currently running at its desired task count and must remain at least 50% operational during the deployment. Which deployment configuration for minimum healthy percent and maximum percent will allow the deployment to succeed under these constraints?
A developer is configuring an Amazon ECS task definition to deploy a microservice to AWS Fargate. The container image is stored in a private Amazon ECR repository. During startup, the containerized application must read database credentials from AWS Secrets Manager. The developer wants to inject these credentials as container environment variables without exposing them in plaintext or embedding them in the container image.
Which two actions should the developer take to configure the task definition and IAM roles for this deployment? (Select TWO.)
Select all that apply
A developer is designing an AWS CloudFormation template to deploy a microservice. The microservice requires access to a database password that must be automatically rotated every 30 days, as well as a non-sensitive API endpoint URL for an external service. Which two configuration strategies should the developer use to reference these values in the CloudFormation template to ensure security, rotation support, and cost-efficiency? (Select TWO.)
Select all that apply
A developer is configuring a backend worker application to run on Amazon ECS using the AWS Fargate launch type. The application code running inside the container needs to read and write items in an Amazon DynamoDB table. The container image is hosted in a private Amazon ECR repository located in a separate, central shared AWS account. Additionally, the task definition retrieves sensitive database credentials stored in encrypted AWS Systems Manager Parameter Store parameters and injects them as environment variables at task startup. Which of the following configuration steps are required to successfully deploy the task and run the application? (Select TWO.)
Select all that apply
To comply with security audits, the database password for an Amazon Aurora MySQL database must be stored securely and rotated automatically on a recurring schedule. Which AWS service should a developer use to manage this password and its automatic rotation?
An IoT analytics platform receives telemetry batches of approximately in size from edge gateways. The data must be encrypted client-side before it is transmitted to Amazon S3. A developer is tasked with implementing this encryption using a Customer Managed Key (CMK) in AWS KMS. Which two actions must the developer perform to successfully implement this encryption workflow? (Select TWO.)
Select all that apply