DVA-C02 exam dumps

DVA-C02 practice question 348 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 348

Single answer

You are developing a serverless application using AWS Lambda and the AWS SDK for Python (boto3). During execution, your function makes a call to get an object from an S3 bucket. However, the function occasionally fails with an error. Upon investigation, you notice the error message: 'botocore.exceptions.ClientError: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.' What could be the most likely cause of this error?

  1. A

    The S3 bucket does not exist.

  2. B

    The IAM role attached to the Lambda function does not have sufficient permissions to access the S3 bucket.

  3. C

    The object key specified in the GetObject request does not exist in the S3 bucket.

  4. D

    The Lambda function exceeded its timeout limit while making the GetObject API call.

Show answer and explanation

Correct answer: C

Explanation

The 'NoSuchKey' error occurs when the specified object key does not exist in the S3 bucket. In this case, the Lambda function is attempting to retrieve an object using a key that either was not uploaded or was incorrectly specified in the request. This is a common exception generated by the AWS SDK when interacting with S3.

  • A. Incorrect.

    This is incorrect because the error is related to the object key, not the bucket itself. If the bucket did not exist, a different error, such as 'NoSuchBucket,' would be returned.

  • B. Incorrect.

    This is incorrect because insufficient permissions would result in an 'AccessDenied' error, not 'NoSuchKey.'

  • C. Correct.

    This is correct because the 'NoSuchKey' error explicitly indicates that the object key specified in the GetObject request does not exist in the bucket.

  • D. Incorrect.

    This is incorrect because a timeout error would result in a different exception, such as a 'TimeoutError' or 'ThrottlingException,' not 'NoSuchKey.'

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam