You're developing an application that will need to do the following. · Upload images via a front end from users. · Store the images in S3. · Add the location of the images to a DynamoDB table. Which of the following two options would be part of the implementation process? Please choose two correct answers.
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - A and C.
The ideal approach would be to automate the entire flow using AWS Lambda.
Ensure that the Lambda function has a role to access data in the DynamoDB table.
The AWS Documentation also mentions the following.
You can write Lambda functions to process S3 bucket events, such as the object-created or object-deleted events.
For example, when a user uploads a photo to a bucket, you might want Amazon S3 to invoke your Lambda function so that it reads the image and creates a thumbnail for the photo.
You can use the bucket notification configuration feature in Amazon S3 to configure the event source mapping, identifying the bucket events that you want Amazon S3 to publish and which Lambda function to invoke.
Options B and D would not be the ideal combination for this sort of requirement.
For more information on AWS Lambda, please refer to the below URL-
https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.htmlTo implement the given requirements, the following steps are necessary:
Create an S3 bucket: The first step is to create an S3 bucket to store the uploaded images.
Create a DynamoDB table: The second step is to create a DynamoDB table to store the metadata about the uploaded images. The table can have attributes such as Image ID, Image Name, S3 Object Key, and S3 Bucket Name.
Create an IAM Role: The third step is to create an IAM role that the Lambda function will assume. This role should have permissions to write to the DynamoDB table.
Create a Lambda Function: The fourth step is to create a Lambda function that will be triggered by S3 events whenever a new image is uploaded to the S3 bucket. The Lambda function will read the metadata of the uploaded image and write it to the DynamoDB table.
Ensure Lambda function has access to DynamoDB table: The fifth step is to ensure that the Lambda function has access to the DynamoDB table by assigning the IAM role created in step 3 to the Lambda function.
(Optional) Add an SQS Queue: An additional step could be to add an SQS queue to ensure that there is no data loss if the Lambda function fails. If an SQS queue is added, the Lambda function can write a message to the queue after the object is inserted into the bucket. Another Lambda function can read messages from the queue and process them independently.
Ensure SQS service has access to DynamoDB table: If an SQS queue is added, it is necessary to ensure that the SQS service has access to the DynamoDB table. This can be done by modifying the IAM policy of the role assigned to the Lambda function to allow the SQS service to write to the DynamoDB table.
In conclusion, the correct answers are A and C. Answer A is correct because adding a Lambda function that responds to events in S3 is necessary to trigger the function whenever a new image is uploaded. Answer C is correct because it is necessary to ensure that the Lambda function has access to the DynamoDB table in order to write the metadata about the uploaded images. Answer B is incorrect because adding a message to an SQS queue is optional, and answer D is incorrect because it is unnecessary to give the SQS service access to the DynamoDB table if an SQS queue is not used.