All practice questions
1542 questions
A developer is implementing a secure report retrieval feature for a corporate intranet portal. The portal's users authenticate using an Amazon Cognito User Pool. Once authenticated, the portal's client-side application needs to download private reports directly from an Amazon S3 bucket. To optimize performance and cost, the architecture must not route the file downloads through an intermediate API Gateway or Lambda function. The solution must grant users direct, short-lived access to the reports using the least privilege principle.
Which TWO configuration steps should the developer perform to meet these requirements?
Select all that apply
A frontend web application hosted on `https://app.company.internal` receives a `403 Forbidden` error with the message 'User is not authorized to access this resource' when sending requests to various endpoints of a private Amazon API Gateway REST API. The API uses a custom Lambda Authorizer with caching enabled. The developer notes that the client's first API call to `GET /orders` succeeds, but a subsequent call to `POST /payments` by the same user within a five-minute window fails with the `403 Forbidden` error. The CloudWatch logs show the authorizer executes successfully only for the first request. Which of the following is the most likely cause of this error?
A developer is monitoring a web application that writes log events to an Amazon CloudWatch Logs log group in the following JSON format:
{
"requestPath": "/payment/process",
"responseCode": 502,
"responseTimeMs": 1500
}
The developer needs to configure a CloudWatch metric filter to count the occurrences of failed payment requests where the `responseCode` is and the `responseTimeMs` is greater than milliseconds.
Which of the following configurations are valid for this metric filter or represent correct troubleshooting actions to ensure the filter works as intended? (Select TWO.)
Select all that apply
A developer is building a backend application on AWS Lambda that integrates with a third-party payment gateway. The integration requires an API key that is rotated automatically every 30 days. The developer needs to store the API key securely, automate its rotation, and retrieve it in the Lambda function with minimal latency. Which storage and management approach should the developer use to meet these requirements with the least operational effort?
A developer is designing a web application that uses Amazon Cognito User Pools for user authentication and Amazon API Gateway REST APIs for the backend. The API endpoints must be secured so that only users with an 'Active' subscription can access them. The subscription status is stored in an external Amazon DynamoDB table and updated in real-time, which prevents it from being stored as a static attribute in the Cognito ID or access tokens. Which solution should the developer implement to secure the API Gateway endpoints?
A developer is testing a Java application locally that uses the AWS SDK for Java v2 to retrieve objects from an Amazon S3 bucket. The application initializes the S3 client using S3Client.create(). When running the application locally, it fails with a software.amazon.awssdk.core.exception.SdkClientException stating that it is unable to load credentials from any of the providers in the default chain. The developer has configured the credentials in the local ~/.aws/credentials file under a profile named developer-local.
Which two actions should the developer take to resolve this credentials loading issue? (Select two.)
Select all that apply
A `502 Bad Gateway` error occurs when a locally running Electron desktop application sends an HTTP `POST` request to an Amazon API Gateway REST API. The developer also notices a CORS failure message in the application logs: 'Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin'. The API Gateway endpoint uses a Lambda proxy integration. The backend Lambda function's logs in Amazon CloudWatch show that the function completes successfully and returns the following structure:
{
"status": 200,
"body": {
"message": "Data processed successfully",
"itemId": "12345"
}
}
Which changes must the developer make to resolve both the `502 Bad Gateway` error and the CORS block? (Select TWO.)
Select all that apply
A company runs a logistics tracking service on AWS Fargate. The application needs to retrieve a sensitive API key for a third-party shipping service dynamically at runtime. The API key is managed by a separate security team in a dedicated AWS account, where it must be rotated every 90 days. The Fargate tasks in the application account must access this key securely. To implement this configuration, which two steps should be performed? (Select TWO.)
Select all that apply
An IoT startup is developing a dashboard web application that allows users to authenticate using external social providers (Google and Apple) via Amazon Cognito. Once authenticated, the web application must interact with two backend systems:
1. Make authenticated requests to an Amazon API Gateway HTTP API that manages dashboard configurations.
2. Directly publish sensor telemetry data to an Amazon Kinesis Data Stream.
Which TWO configurations must the developer implement to secure access to these resources? (Select TWO.)
Select all that apply
A developer is troubleshooting an application locally on their workstation. They are running a Node.js application that uses the AWS SDK for JavaScript (v3) to upload objects to an Amazon S3 bucket.
The developer has configured a profile named `staging` in their local `~/.aws/credentials` file:
ini
[staging]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
They also set the following environment variables in their terminal session:
bash
export AWS_PROFILE=staging
export AWS_ACCESS_KEY_ID=AKIAIADSTESTINGEXAMPLE
export AWS_SECRET_ACCESS_KEY=mockKeyStagingExampleKey
When running the application, the developer receives access denied errors because the SDK attempts to authenticate using the `AKIAIADSTESTINGEXAMPLE` credentials (which are invalid) rather than the credentials specified in the `staging` profile.
Which action should the developer take to ensure the SDK uses the `staging` profile credentials?
A developer is configuring a blue/green deployment for a containerized application on Amazon ECS using AWS CodeDeploy. The deployment configuration utilizes an Application Load Balancer with two target groups and a test listener. The developer wants to run automated integration tests against the replacement task set via the test listener to validate the new version of the application before shifting any production traffic.
Which AppSpec lifecycle hook should the developer use to run these integration tests?
A developer is troubleshooting an application deployed on Amazon ECS that writes logs to an Amazon CloudWatch Logs log group. The developer created a CloudWatch subscription filter to route log events containing the phrase `CRITICAL_ERROR` to an AWS Lambda function for real-time alerting. Although the developer verified that `CRITICAL_ERROR` is present in the log streams, the Lambda function is never invoked. Which two configurations or troubleshooting steps should the developer verify to resolve this issue?
Select all that apply
A developer is using AWS Serverless Application Model (SAM) to deploy a database-backed API. The database password is saved as a SecureString in AWS Systems Manager Parameter Store. The developer attempts to reference this password in the SAM template's `Parameters` section as follows:
yaml
Parameters:
DbPassword:
Type: AWS::SSM::Parameter::Value<String>
Default: /prod/db/password
During the `sam deploy` process, AWS CloudFormation returns a validation error indicating that `AWS::SSM::Parameter::Value<String>` cannot reference SSM SecureString parameters.
How should the developer resolve this deployment failure while keeping the database password secure?
A developer is building a corporate portal where employees must sign in using their existing SAML 2.0 Identity Provider (IdP) credentials. The portal's backend API, hosted on Amazon API Gateway, requires custom user claims such as department and employee ID to perform fine-grained authorization. Which configuration will meet these requirements with the least development effort?
A developer is deploying a microservice to Amazon Elastic Container Service (Amazon ECS) on AWS Fargate. The microservice needs to read messages from an Amazon SQS queue and write records to an Amazon DynamoDB table. During startup, the ECS container agent must pull the container image from Amazon Elastic Container Registry (Amazon ECR) and send container logs to Amazon CloudWatch Logs. Which configuration of IAM roles should the developer specify in the task definition to satisfy these requirements with the least privilege?
A developer is deploying a web application to Amazon EC2 instances. The application requires access to a sensitive API key for a third-party marketing platform. The company's security policy mandates that the API key must be encrypted at rest and rotated every 90 days. The developer wants to implement a solution that supports automatic rotation with minimal custom code. Which service and configuration should the developer choose to store and manage the API key?
A CORS preflight blocked error is displayed in the browser console when a client-side SvelteKit application hosted on https://manager.fleet-ops.net sends a POST request to an Amazon API Gateway REST API. The request includes a custom HTTP header named X-Client-Session-ID. The developer had previously enabled CORS on the API Gateway resource, which created an OPTIONS method returning the standard headers Access-Control-Allow-Origin and Access-Control-Allow-Methods. Which action must the developer take to resolve this CORS validation error?
A developer is building a mobile application that needs to upload user-generated files directly to a private Amazon S3 bucket. The developer has configured an Amazon Cognito User Pool to handle user registration and sign-in. After successfully logging in, users receive JSON Web Tokens (JWTs), but the application receives an Access Denied error (HTTP 403) when attempting to upload files using the AWS SDK. Which two actions should the developer take to resolve this authorization failure? (Select TWO.)
Select all that apply
A client-side Angular dashboard hosted on https://dashboard.cloudflow.net is integrated with an Amazon API Gateway REST API. When sending a PUT request to update user preferences, the browser console displays a CORS preflight blocked error. The API Gateway is configured with a Lambda proxy integration. Which two actions must the developer perform to resolve this issue? (Select TWO.)
Select all that apply
An engineer is deploying a serverless application using a template that defines a Lambda function triggered by an Amazon S3 event. The function needs to execute with a custom IAM role. During the deployment, the stack fails to create the resources successfully. The relevant section of the template is structured as follows:
yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
ProcessFileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs20.x
Role: !GetAtt ProcessingRole.Arn
ProcessingRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: Service: s3.amazonaws.com
Action: sts:AssumeRole
Which of the following modifications will resolve the deployment failure and allow the Lambda function to assume the role?