AWS Certified Developer – Associate — Question 436
A company is adding items to an Amazon DynamoDB table from an AWS Lambda function that is written in Python. A developer needs to implement a solution that inserts records in the DynamoDB table and performs automatic retry when the insert fails.
Which solution meets these requirements with MINIMUM code changes?
Answer options
- A. Configure the Python code to run the AWS CLI through shell to call the PutItem operation
- B. Call the PutItem operation from Python by using the DynamoDB HTTP API
- C. Queue the items in AWS Glue, which will put them into the DynamoDB table
- D. Use the AWS software development kit (SDK) for Python (boto3) to call the PutItem operation
Correct answer: D
Explanation
Using the AWS SDK for Python (boto3) is the optimal choice because it includes built-in, automatic retry logic for standard AWS service errors, achieving the requirement with minimal developer effort. Making direct HTTP API calls would require custom, complex retry logic, while invoking the AWS CLI via Python shell commands is inefficient and adds unnecessary overhead. AWS Glue is an ETL service and is not intended to act as a real-time queuing system for Lambda writes to DynamoDB.