DVA-C02 practice question 21 of 35
A developer has created an AWS Lambda function that is written in Python. The Lambda function reads data from objects in Amazon S3 and writes data to an Amazon DynamoDB table. The function is successfully invoked from an S3 event notification when an object is created. However, the function fails when it attempts to write to the DynamoDB table. What is the MOST likely cause of this issue?
Full set: 598 questionsDomain Development with AWS Services
AWS Lambda functions use an IAM execution role to get the necessary permissions to interact with other AWS services. The scenario states the function is invoked successfully by an S3 event but fails when writing to DynamoDB. This indicates the execution role has permissions for invocation by S3 but lacks the required permissions (e.g., dynamodb:PutItem, dynamodb:UpdateItem) to perform write operations on the target DynamoDB table. This is a common configuration error and the most direct cause for the described failure.
A. A concurrency limit being exceeded would typically result in a ThrottlingException, preventing the function from being invoked, rather than a failure during the execution of the function's code.
B. Global secondary indexes (GSIs) are used to speed up queries on non-key attributes. They are not a requirement for performing basic write operations like PutItem on a DynamoDB table.
D. Both AWS Lambda and Amazon DynamoDB are regional services. AWS manages their operation across multiple Availability Zones within a region for high availability, so an AZ mismatch is not a possible cause.
1. AWS Lambda Developer Guide
"AWS Lambda execution role": This document explains that a Lambda function's execution role grants it permission to access other AWS services and resources. It states
"You grant your function permissions to use other AWS services by attaching policies to its execution role." This supports the conclusion that missing permissions in the role is the cause.
2. Amazon DynamoDB Developer Guide
"Identity and Access Management for Amazon DynamoDB"
Section: "Actions": This section lists the specific API actions that can be permitted or denied for DynamoDB
such as dynamodb:PutItem. The failure to write implies this action is not allowed by the Lambda function's IAM policy.
3. AWS Lambda Developer Guide
"Managing concurrency for a Lambda function": This guide details that when invocations exceed the concurrency limit
Lambda throttles the requests. This confirms that a concurrency issue would manifest as an invocation failure
not a runtime error during a specific API call within the code.
4. Amazon DynamoDB Developer Guide
"Amazon DynamoDB core components"
Section: "Regions and Availability Zones": This document clarifies
"DynamoDB is available in multiple AWS Regions around the world. Each Region is independent and isolated... Data is replicated across multiple Availability Zones in each Region." This invalidates the premise of an AZ mismatch.
Keep practicing
Take the free DVA-C02 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DVA-C02 practice questions
- Question 1A company has a multi-node Windows legacy application that runs on premises. The applicat…
- Question 2A developer migrated a legacy application to an AWS Lambda function. The function uses a …
- Question 3A development learn has an Amazon API Gateway REST API that is backed by an AWS Lambda fu…
- Question 4A company is expanding the compatibility of its photo-snaring mobile app to hundreds of a…
- Question 5A company has an ecommerce application. To track product reviews, the company's developme…
- Question 6A social media company is designing a platform that allows users to upload data, which is…
