ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 246 - SCS-C01 discussion

Report
Export

A Lambda function reads metadata from an S3 object and stores the metadata in a DynamoDB table.

The function is triggered whenever an object is stored within the S3 bucket.

How should the Lambda function be given access to the DynamoDB table?

Please select:

A.
Create a VPC endpoint for DynamoDB within a VPC. Configure the Lambda function to access resources in the VPC.
Answers
A.
Create a VPC endpoint for DynamoDB within a VPC. Configure the Lambda function to access resources in the VPC.
B.
Create a resource policy that grants the Lambda function permissions to write to the DynamoDB table. Attach the poll to the DynamoDB table.
Answers
B.
Create a resource policy that grants the Lambda function permissions to write to the DynamoDB table. Attach the poll to the DynamoDB table.
C.
Create an IAM user with permissions to write to the DynamoDB table. Store an access key for that user in the Lambda environment variables.
Answers
C.
Create an IAM user with permissions to write to the DynamoDB table. Store an access key for that user in the Lambda environment variables.
D.
Create an IAM service role with permissions to write to the DynamoDB table. Associate that role with the Lambda function.
Answers
D.
Create an IAM service role with permissions to write to the DynamoDB table. Associate that role with the Lambda function.
Suggested answer: D

Explanation:

The ideal way is to create an IAM role which has the required permissions and then associate it with the Lambda function The AWS Documentation additionally mentions the following Each Lambda function has an IAM role (execution role) associated with it. You specify the IAM role when you create your Lambda function. Permissions you grant to this role determine what AWS Lambda can do when it assumes the role. There are two types of permissions that you grant to the IAM role:

If your Lambda function code accesses other AWS resources, such as to read an object from an S3 bucket or write logs to CloudWatch Logs, you need to grant permissions for relevant Amazon S3 and CloudWatch actions to the role. If the event source is stream-based (Amazon Kinesis Data Streams and DynamoDB streams), AWS Lambda polls these streams on your behalf. AWS Lambda needs permissions to poll the stream and read new records on the stream so you need to grant the relevant permissions to this role.

Option A is invalid because the VPC endpoint allows access instances in a private subnet to access DynamoDB Option B is invalid because resources policies are present for resources such as S3 and KMS, but not AWS Lambda Option C is invalid because AWS Roles should be used and not IAM Users For more information on the Lambda permission model, please visit the below URL:

https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.htmlThe correct answer is: Create an IAM service role with permissions to write to the DynamoDB table. Associate that role with the Lambda function.

Submit your Feedback/Queries to our Exp

asked 16/09/2024
Nicolas GARCIA
34 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first