0 votes
in AWS by

change in the lambda versWhich of the following is the best way to update an S3 notification configuration when a ion needs to be referred by an S3 bucket after new objects are created in the bucket?

1 Answer

0 votes
by

Correct Answer - A.

When a Lambda Alias ARN is used in the notification configuration & a new version of the Lambda function is created, you need to update Alias ARN pointing to a new function.

No changes are required to be done at the Amazon S3 bucket.

Option B is incorrect.

When a Lambda Function ARN is used in the notification configuration, whenever there is a new Lambda Function created, you will need to update ARN in notification configuration to point to the latest version.

Option C is incorrect when a Lambda Qualified ARN is used in the notification configuration.

Whenever there is a new Lambda Function created, you will need to update ARN in the notification configuration to point to the latest version.

Option D is incorrect as there is nothing as $LATEST ARN.

$LATEST version has two ARN associated with it, Qualified ARN & Unqualified ARN.

For more information on AWS Lambda Aliases, refer to the following URL-

https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html

The correct answer is C. Specify Lambda Qualified ARN in the notification configuration.

When an S3 bucket event occurs, S3 can send a notification to an AWS Lambda function to invoke it. To specify the Lambda function to invoke, you need to provide an Amazon Resource Name (ARN) that identifies the function.

There are four different types of Lambda ARNs:

  • Lambda Function ARN (e.g. arn:aws:lambda:us-east-1:123456789012:function:my-function)
  • Lambda Version ARN (e.g. arn:aws:lambda:us-east-1:123456789012:function:my-function:1)
  • Lambda Alias ARN (e.g. arn:aws:lambda:us-east-1:123456789012:function:my-function:PROD)
  • Lambda $LATEST ARN (e.g. arn:aws:lambda:us-east-1:123456789012:function:my-function:$LATEST)

The Lambda Function ARN is the ARN of the specific version of the Lambda function that you want to invoke. If you specify a Lambda Function ARN in the S3 notification configuration and then create a new version of the function, the S3 notification configuration will continue to invoke the old version of the function until you manually update the notification configuration.

The Lambda Version ARN is the ARN of a specific version of the Lambda function. If you specify a Lambda Version ARN in the S3 notification configuration and then create a new version of the function, the S3 notification configuration will continue to invoke the same version of the function. You need to manually update the S3 notification configuration to invoke the new version of the function.

The Lambda Alias ARN is the ARN of a named alias for a Lambda function. If you specify a Lambda Alias ARN in the S3 notification configuration and then update the alias to point to a new version of the function, the S3 notification configuration will automatically start invoking the new version of the function.

The Lambda $LATEST ARN is the ARN of the most recent version of the Lambda function. If you specify a Lambda $LATEST ARN in the S3 notification configuration and then create a new version of the function, the S3 notification configuration will continue to invoke the old version of the function until you manually update the notification configuration.

Therefore, the best way to update an S3 notification configuration when a change in the lambda version needs to be referred by an S3 bucket after new objects are created in the bucket is to specify the Lambda Qualified ARN in the notification configuration. A Lambda Qualified ARN includes both the function version number and the function alias, so when you update the alias to point to a new version of the function, the S3 notification configuration will automatically start invoking the new version of the function.

...