AWS Certified Developer – Associate — Question 374
A developer is writing an application in Python. The application runs on AWS Lambda. The application generates a file and needs to upload this file to Amazon S3.
The developer must implement this upload functionality with the least possible change to the application code.
Which solution meets these requirements?
Answer options
- A. Make an HTTP request directly to the S3 API to upload the file.
- B. Include the AWS SDK for Python in the Lambda function. Use the SDK to upload the file.
- C. Use the AWS SDK for Python that is installed in the Lambda environment to upload the file.
- D. Use the AWS CLI that is installed in the Lambda environment to upload the file.
Correct answer: C
Explanation
The AWS SDK for Python (boto3) is pre-installed in the default AWS Lambda runtime environment for Python, allowing the developer to import it and upload the file with minimal code changes and without packaging external dependencies. Option B is unnecessary because the SDK is already present, while Option A requires complex manual request signing and Option D is incorrect because the AWS CLI is not pre-installed in standard Lambda runtimes.