SAP-C02 Continuous Improvement for Existing Solutions Practice Question
Exhibit
Refer to the exhibit.
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-unique-bucket-name
VersioningConfiguration:
Status: Enabled
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: !GetAtt LambdaExecutionRole.Arn
Code:
ZipFile: |
const AWS = require('aws-sdk');
exports.handler = async (event) => {
console.log('Processing event:', JSON.stringify(event));
return 'Success';
};
Runtime: nodejs14.x
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: LambdaPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: logs:CreateLogGroup
Resource: arn:aws:logs:*:*:*
- Effect: Allow
Action:
- logs:CreateLogStream
- logs:PutLogEvents
Resource: arn:aws:logs:*:*:*
BucketNotification:
Type: AWS::S3::BucketNotification
DependsOn: MyLambdaFunction
Properties:
Bucket: !Ref MyBucket
NotificationConfiguration:
LambdaFunctionConfigurations:
- LambdaFunctionArn: !GetAtt MyLambdaFunction.Arn
Events:
- s3:ObjectCreated:*A solutions architect deployed the above CloudFormation template. However, the Lambda function is not triggered when objects are uploaded to the S3 bucket. What is the most likely cause?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The Lambda function lacks a resource-based policy that allows S3 to invoke it.
The Lambda function requires a resource-based policy (also known as a function policy) that grants the S3 service permission to invoke the function. The CloudFormation template does not include such a policy, so S3 cannot trigger the Lambda function. Option A is incorrect because the BucketNotification resource is correctly configured to send events to the Lambda function, but the function itself lacks the invoke permission. Option C is incorrect because the Lambda execution role manages permissions for the function to access other services (like CloudWatch Logs), not for other services to invoke it. Option D is irrelevant because the trigger itself is the issue, not the function code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The BucketNotification resource depends on MyLambdaFunction, but the notification configuration is incorrect.
Why it's wrong here
The configuration appears correct.
- ✓
The Lambda function lacks a resource-based policy that allows S3 to invoke it.
Why this is correct
Without an 'InvokeFunction' permission for S3, the trigger will fail.
- ✗
The Lambda execution role does not have permission to access S3.
Why it's wrong here
The role only needs CloudWatch Logs permissions for logging; S3 trigger does not need S3 access.
- ✗
The Lambda function code does not read the S3 object content.
Why it's wrong here
The trigger works regardless of whether the function reads the object.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
One of 1,660 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.