devstack
devstack

Reputation: 19

Not able to add S3 as destination in lambda

I have created a lambda. And added API gateway as Add Triggers.

Now I want to add S3 bucket to Add destination so that S3 bucket can store the data which I will be posting through my API. But when I try to add S3 , It throws the error

The provided destination config DestinationConfig(onSuccess=OnSuccess(destination=arn:aws:s3:::mybucketname), onFailure=null) is invalid.

click to see error

Upvotes: 1

Views: 2320

Answers (2)

Aniket Kapdule
Aniket Kapdule

Reputation: 1

As Xanthos Symeou said:

You cannot use s3 directly as a destination from your lambda. The destination can be an SQS queue, SNS topic, Lambda function, or EventBridge event bus.

But he has provided a link for How to add S3 as a trigger. You want to add s3 as a destination so you can follow this link:

Use AWS Lambda to Append Daily Data to CSV File in S3 Bucket

Here in this tutorial. He has shown how to append, but if you don't want to append, you can make the changes into the code accordingly.

Upvotes: 0

Xanthos Symeou
Xanthos Symeou

Reputation: 694

You cannot use s3 directly as a destination from your lambda. Destination can be an SQS queue, SNS topic, Lambda function, or EventBridge event bus.

What you can do in order to store data to s3 from your lambda is to do that through your code inside lambda.

You can follow this tutorial:

https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html

Upvotes: 4

Related Questions