How to add triggers on aws lambda alias

0

Hi all,

I am facing issue while adding triggers to the lambda function alias using command line. could you please help to resolve this issue. s3_trigger.json file below. { "LambdaFunctionConfigurations": [ { "LambdaFunctionArn": "arn:aws:lambda:us-east-1:Account_id:function:my_lambda:my_lambda_alias", "Events": [ "s3:ObjectCreated:*" ], "Filter": { "Key": { "FilterRules": [ { "Name": "Prefix", "Value": "incoming-file/" }, { "Name": "Suffix", "Value": ".json" } ] } } } ] }

aws s3api put-bucket-notification-configuration
--bucket "$env-$clientname-raw"
--notification-configuration file://s3_trigger.json

An error occurred (InvalidArgument) when calling the PutBucketNotificationConfiguration operation: Unable to validate the following destination configurations.

Thanks, Ankit

ankit
asked 3 months ago126 views
1 Answer
0

Hello.

Is the following policy set in Lambda's access policy?
https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html
https://repost.aws/knowledge-center/lambda-invoke-error-s3-bucket-permission

{
    "Version": "2012-10-17",
    "Id": "example-ID",
    "Statement": [
        {
            "Sid": "s3invoke",
            "Effect": "Allow",
            "Principal": {
                "Service": "s3.amazonaws.com"
            },
            "Action": "lambda:InvokeFunction",
            "Resource": "arn:aws:lambda:Region:account-id:function:function-name",
            "Condition": {
                "StringEquals": {
                    "AWS:SourceAccount": "bucket-owner-account-id"
                },
                "ArnLike": {
                    "AWS:SourceArn": "arn:aws:s3:::awsexamplebucket1"
                }
            }
        }
    ]
}
profile picture
EXPERT
answered 3 months ago
  • Thanks for your revert, My question is that can we add triggers to lambda function alias using command line.

  • Yes, it is possible to set triggers using commands. And I think the error you shared may occur when there is a problem with Lambda's resource-based policy, so I think you need to check it.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions