ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 263 - SCS-C02 discussion

Report
Export

A security engineer is troubleshooting an AWS Lambda function that is named MyLambdaFunction. The function is encountering an error when the function attempts to read the objects in an Amazon S3 bucket that is named DOC-EXAMPLE-BUCKET. The S3 bucket has the following bucket policy:

Which change should the security engineer make to the policy to ensure that the Lambda function can read the bucket objects?

A.
Remove the Condition element. Change the Principal element to the following: { ''AWS'': ''arn 'aws' ::: lambda ::: function:MyLambdaFunction'' }
Answers
A.
Remove the Condition element. Change the Principal element to the following: { ''AWS'': ''arn 'aws' ::: lambda ::: function:MyLambdaFunction'' }
B.
Change the Action element to the following: ' s3:GetObject*' ' s3:GetBucket*'
Answers
B.
Change the Action element to the following: ' s3:GetObject*' ' s3:GetBucket*'
C.
Change the Resource element to 'arn:aws:s3:::DOC-EXAMPLE-BUCKET/*'.
Answers
C.
Change the Resource element to 'arn:aws:s3:::DOC-EXAMPLE-BUCKET/*'.
D.
Change the Resource element to 'arn:aws:lambda:::function:MyLambdaFunction'. Change the Principal element to the following: { ''Service'': ''s3.amazonaws.com'' }
Answers
D.
Change the Resource element to 'arn:aws:lambda:::function:MyLambdaFunction'. Change the Principal element to the following: { ''Service'': ''s3.amazonaws.com'' }
Suggested answer: C

Explanation:

The correct answer is C. Change the Resource element to ''arn:aws:s3:::DOC-EXAMPLE-BUCKET/*''.

The reason is that the Resource element in the bucket policy specifies which objects in the bucket are affected by the policy. In this case, the policy only applies to the bucket itself, not the objects inside it. Therefore, the Lambda function cannot access the objects with the s3:GetObject permission. To fix this, the Resource element should include a wildcard (*) to match all objects in the bucket. This way, the policy grants the Lambda function permission to read any object in the bucket.

The other options are incorrect for the following reasons:

A) Removing the Condition element would not help, because it only restricts access based on the source IP address of the request. The Principal element should not be changed to the Lambda function ARN, because it specifies who is allowed or denied access by the policy. The policy should allow access to any principal ('*') and rely on IAM roles or policies to control access to the Lambda function.

B) Changing the Action element to include s3:GetBucket* would not help, because it would grant additional permissions that are not needed by the Lambda function, such as s3:GetBucketAcl or s3:GetBucketPolicy. The s3:GetObject* permission is sufficient for reading objects in the bucket.

D) Changing the Resource element to the Lambda function ARN would not make sense, because it would mean that the policy applies to the Lambda function itself, not the bucket or its objects. The Principal element should not be changed to s3.amazonaws.com, because it would grant access to any AWS service that uses S3, not just Lambda.

asked 16/09/2024
Harri Jaakkonen
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first