A developer needs to deploy the code for a new application on an AWS Lambda function. The application needs a dependency file that is 500 MB to run the business logic.
Which solution will meet these requirements?
A. Compress the application code and dependencies into a .zip file. Directly upload the .zip file as a deployment package for the Lambda function instead of copying the code.
B. Compress the application code and dependencies into a .zip file. Upload the .zip file to an Amazon S3 bucket. Configure the Lambda function to run the code from the .zip file in the S3 bucket.
C. Package the application code and dependencies into a container image. Upload the image to an Amazon S3 bucket. Configure the Lambda function to run the code in the image.
D. Package the application code and dependencies into a container image. Push the image to an Amazon Elastic Container Registry (Amazon ECR) repository. Deploy the image to the Lambda function.
Show Answer
Correct Answer: D
Explanation: AWS Lambda deployment packages using .zip files have size limits (50 MB direct upload, 250 MB uncompressed). A 500 MB dependency exceeds these limits. Lambda supports container images up to 10 GB, which must be stored in Amazon ECR and then deployed to Lambda. Therefore, packaging the application and dependencies as a container image and pushing it to ECR is the correct solution.
Question 133
A developer has built an application running on AWS Lambda using AWS Serverless Application Model (AWS SAM).
What is the correct sequence of steps to successfully deploy the application?
A. 1. Build the SAM template in Amazon EC2. 2. Package the SAM template to Amazon EBS storage. 3. Deploy the SAM template from Amazon EBS.
B. 1. Build the SAM template locally. 2. Package the SAM template onto Amazon S3. 3. Deploy the SAM template from Amazon S3.
C. 1. Build the SAM template locally. 2. Deploy the SAM template from Amazon S3. 3. Package the SAM template for use.
D. 1. Build the SAM template locally. 2. Package the SAM template from AWS CodeCommit. 3. Deploy the SAM template to CodeCommit.
Show Answer
Correct Answer: B
Explanation: AWS SAM applications are typically built locally using the SAM CLI. The `sam package` step bundles the code and dependencies and uploads them to Amazon S3. Finally, the `sam deploy` step deploys the packaged template from S3 via AWS CloudFormation. The other options reference incorrect services or an invalid sequence.
Question 134
A company has an application that uses an AWS Lambda function to consume messages from an Amazon Simple Queue Service (Amazon SQS) queue. The SQS queue is configured with a dead-letter queue. Due to a defect in the application, AWS Lambda failed to process some messages. A developer fixed the bug and wants to process the failed messages again.
How should the developer resolve this issue?
A. Use the SendMessageBatch API to send messages from the dead-letter queue to the original SQS queue.
B. Use the ChangeMessageVisibility API to configure messages in the dead-letter queue to be visible in the original SQS queue.
C. Use the StartMessageMoveTask API to move messages from the dead-letter queue to the original SQS queue.
D. Use the PurgeQueue API to remove messages from the dead-letter queue and return the messages to the original SQS queue.
Show Answer
Correct Answer: C
Explanation: Amazon SQS provides the StartMessageMoveTask API specifically to move messages from a dead-letter queue back to the source queue (or another queue) after issues are resolved. It safely re-drives failed messages for reprocessing without manual resend logic. Other options are incorrect because ChangeMessageVisibility cannot move messages between queues, PurgeQueue deletes messages permanently, and SendMessageBatch would require custom logic and does not preserve DLQ handling automatically.
Question 135
A developer is creating a script to automate the deployment process for a serverless application. The developer wants to use an existing AWS Serverless Application Model (AWS SAM) template for the application.
What should the developer use for the project? (Choose two.)
A. Call aws cloudformation package to create the deployment package. Call aws cloudformation deploy to deploy the package afterward.
B. Call sam package to create the deployment package. Call sam deploy to deploy the package afterward.
C. Call aws s3 cp to upload the AWS SAM template to Amazon S3. Call aws lambda update-function-code to create the application.
D. Create a ZIP package locally and call aws serverlessrepo create-applicatiion to create the application.
E. Create a ZIP package and upload it to Amazon S3. Call aws cloudformation create-stack to create the application.
Show Answer
Correct Answer: A, B
Explanation: AWS SAM templates are deployed through CloudFormation. You can either use the native CloudFormation workflow (aws cloudformation package followed by aws cloudformation deploy), which fully supports SAM templates, or use the AWS SAM CLI (sam package and sam deploy), which is purpose-built to package artifacts and deploy SAM applications. The other options bypass SAM features or misuse services and are not appropriate for deploying an existing SAM template.
Question 136
A developer is troubleshooting an application. The application includes several AWS Lambda functions that invoke an Amazon API Gateway API. The API Gateway's method request is set up to use an Amazon Cognito authorizer for authentication.
All the Lambda functions pass the user ID as part of the Authorization header to the API Gateway API. The API Gateway API returns a 403 status code for all GET requests.
How should the developer resolve this issue?
A. Modify the client GET request to include a valid API key in the Authorization header.
B. Modify the client GET request to include a valid token in the Authorization header.
C. Update the resource policy for the API Gateway API to allow the execute-api:Invoke action.
D. Modify the client to send an OPTIONS preflight request before the GET request.
Show Answer
Correct Answer: B
Explanation: The API Gateway method uses an Amazon Cognito authorizer, which requires a valid Cognito JWT (ID or access token) to be passed in the Authorization header. Passing only a user ID is insufficient and causes API Gateway to reject the request with a 403 error. Modifying the client to include a valid Cognito token in the Authorization header resolves the authentication failure.
Question 137
A company processes incoming documents from an Amazon S3 bucket. Users upload documents to an S3 bucket using a web user interface. Upon receiving files in S3, an AWS Lambda function is invoked to process the files, but the Lambda function times out intermittently.
If the Lambda function is configured with the default settings, what will happen to the S3 event when there is a timeout exception?
A. Notification of a failed S3 event is sent as an email through Amazon SNS.
B. The S3 event is sent to the default Dead Letter Queue.
C. The S3 event is processed until it is successful.
D. The S3 event is discarded after the event is retried twice.
Show Answer
Correct Answer: D
Explanation: Amazon S3 invokes Lambda functions asynchronously. With default settings, if the function times out or otherwise fails, Lambda automatically retries the event two additional times (for a total of three attempts). If all retries fail and no Dead Letter Queue or on-failure destination is configured, the event is discarded.
Question 138
A company has an application that is deployed on AWS Elastic Beanstalk. The application generates user-specific PDFs and stores the PDFs in an Amazon S3 bucket. The application then uses Amazon Simple Email Service (Amazon SES) to send the PDFs by email to subscribers.
Users no longer access the PDFs 90 days after the PDFs are generated. The S3 bucket is not versioned and contains many obsolete PDFs.
A developer must reduce the number of files in the S3 bucket by removing PDFs that are older than 90 days.
Which solution will meet this requirement with the LEAST development effort?
A. Update the application code. In the code, add a rule to scan all the objects in the S3 bucket every day and to delete objects after 90 days.
B. Create an AWS Lambda function. Program the Lambda function to scan all the objects in the S3 bucket every day and to delete objects after 90 days.
C. Create an S3 Lifecycle rule for the S3 bucket to expire objects after 90 days.
D. Partition the S3 objects with a / / key prefix. Create an AWS Lambda function to remove objects that have prefixes that have reached the expiration date.
Show Answer
Correct Answer: C
Explanation: An S3 Lifecycle rule can automatically expire (delete) objects after a specified number of days without any custom code. This is a built-in, fully managed feature and requires the least development effort compared to scanning and deleting objects via application code or Lambda functions.
Question 139
A developer is deploying an application on Amazon EC2 instances that run in Account A. The application needs to read data from an existing Amazon Kinesis data stream in Account B.
Which actions should the developer take to provide the application with access to the stream? (Choose two.)
A. Update the instance profile role in Account A with stream read permissions.
B. Create an IAM role with stream read permissions in Account
C. Add a trust policy to the instance profile role and IAM role in Account B to allow the instance profile role to assume the IAM role.
D. Add a trust policy to the instance profile role and IAM role in Account B to allow reads from the stream.
E. Add a resource-based policy in Account B to allow read access from the instance profile role.
Show Answer
Correct Answer: B, C
Explanation: This is a cross-account access scenario. The standard and recommended approach is to use cross-account role assumption. In Account B, create an IAM role that has permissions to read from the Kinesis data stream. Then add a trust policy on that role allowing the EC2 instance profile role from Account A to assume it. The application on EC2 assumes the role in Account B via STS and uses the temporary credentials to read from the stream. Updating only the instance profile (A) is insufficient, and while Kinesis supports resource-based policies, the question’s best-practice solution aligns with role assumption.
Question 140
A development team wants to immediately build and deploy an application whenever there is a change to the source code.
Which approaches could be used to trigger the deployment? (Choose two.)
A. Store the source code in an Amazon S3 bucket. Configure AWS CodePipeline to start whenever a file in the bucket changes.
B. Store the source code in an encrypted Amazon EBS volume. Configure AWS CodePipeline to start whenever a file in the volume changes.
C. Store the source code in an AWS CodeCommit repository. Configure AWS CodePipeline to start whenever a change is committed to the repository.
D. Store the source code in an Amazon S3 bucket. Configure AWS CodePipeline to start every 15 minutes.
E. Store the source code in an Amazon EC2 instance’s ephemeral storage. Configure the instance to start AWS CodePipeline whenever there are changes to the source code.
Show Answer
Correct Answer: A, C
Explanation: AWS CodePipeline can be automatically triggered by source changes from supported source providers. Amazon S3 can trigger a pipeline when objects change, and AWS CodeCommit can trigger a pipeline on code commits. The other options do not support native, event-driven triggers for CodePipeline.
Question 141
A developer is setting up the deployment of application stacks to new test environments by using the AWS Cloud Development Kit (AWS CDK). The application contains the code for several AWS Lambda functions that will be deployed as assets. Each Lambda function is defined by using the AWS CDK Lambda construct library.
The developer has already successfully deployed the application stacks to the alpha environment in the first account by using the AWS CDK CLI's cdk deploy command. The developer is preparing to deploy to the beta environment in a second account for the first time. The developer makes no significant changes to the CDK code between deployments, but the initial deployment in the second account is unsuccessful and returns a NoSuchBucket error.
Which command should the developer run before redeployment to resolve this error?
A. cdk synth
B. cdk bootstrap
C. cdk init
D. cdk destroy
Show Answer
Correct Answer: B
Explanation: The NoSuchBucket error during the first deployment to a new AWS account indicates that the AWS CDK bootstrap resources (including the S3 bucket used to store Lambda asset bundles) do not yet exist in that account. Running `cdk bootstrap` creates the required S3 bucket, IAM roles, and other resources needed for deploying assets. Once the environment is bootstrapped, `cdk deploy` will succeed.
$19
Get all 555 questions with detailed answers and explanations
Instant download HTML + PDF delivered the moment payment clears.
Secure Stripe checkout we never see or store your card details.
7-day refund if files are defective see our refund policy.