Is there a way to automatically email a user when a certain file is uploaded to S3? We have a spreadsheet with contact information as well as a file name associated with that person. Once a person's file is uploaded, is there a way to send that user an automated email?
Yes. You can use AWS API Gateway to create an endpoint that accepts the file to upload and then, using AWS Lambda, upload it to S3 and trigger an event to send the email using mailchimp or AWS SES. Check this: https://codehabitude.com/2016/04/05/forms-to-emails-using-aws-lambda-api-gateway/
You could:
Configure an Amazon S3 event to trigger a Lambda function when a file is uploaded
Code the AWS Lambda function to lookup who should receive the notification and then send the message via Amazon SES (Simple Email Service)
Related
is there a way to push newly uploaded file from S3 to an FTP or SFTP server within AWS Services?
my s3 looks something like this:
s3-bucket/some_path/yyyymm/yyyymmdd/file_yyymmdd.csv.gz
and everytime we generate a new file based on date, we need to upload or transfer to FTP server
You can have S3 send event notifications to other AWS services when a new object is uploaded to a bucket.
You could have that trigger a Lambda function each time a new object is uploaded. The Lambda function would receive an event object with information about the S3 bucket and the path of the object in the bucket. It can use that info to download the file from S3, and upload it to an FTP server.
I would recommend having S3 send the events to an SQS queue, and having your Lambda function pull events from the queue, that way you have both built-in error handling, and concurrency throttling of your Lambda function invocations.
If you don't want to use a Lambda function for this, you could have S3 send the events to SQS, and then run some code that polls SQS anywhere, such as on an EC2 server, or in an ECS task.
Is there a direct way after saving something in a S3 bucket to send the content as attachment by SNS (via email) or do i have create a lambda function in order to tell SNS, what i want to send?
S3 bucket -> SNS -> Email (my preferred way, if possible)
or is this not possible without lambda?
The event that S3 sends to Lambda, SNS or SQS only contains a reference to the item that was created, not the actual content.
If you want to pass on the content, you have to download it in whichever code responds to that event and then send it to your destination.
There is no mechanism that sends the content of a newly uploaded object to an SNS topic.
I would like to configure a bucket notification on an S3 bucket so that every time a notification from a file being uploaded, it sends a message to an SNS topic with a pre signed url in the message so that file can be downloaded when consumed from an email.
File gets uploaded -> notification sent to SNS containing presigned url to recently updated object -> to SNS topic -> to email -> to user
I have tried setting up a topic, but couldn't get a presigned url inside the message, is there a way of setting this up without using a lambda or queue or other AWS services as intermediates?
You can't do this without additional services.
S3 is a storage service, as such it doesn't to much computation if any.
The simplest way would be to create a Lambda that gets triggered on S3 put object, generates the presigned url and sends a message to an SQS or SNS topic.
You'll need to use a Lambda for this unfortunately, it shouldn't be too much additional work.
I have SNS notification for a S3 bucket. I wanted to push that SNS notification with attachment
We have a S3 bucket namely like SDD-XXX-YYY. Once if any file is getting arrived in that bucket, we have configured SNS to receive email notification.
Now we need email notification with content of the file which we are receiving in S3 or as attachment in our email.
Example: We are receiving some "error.log" file S3, here we need to push the error.log in email or else content of error.log file.
Please help me to achieve it.
Do we need to write lambda here? or we can manage it in SNS itself?
The SNS S3 notification will only give you information about the newly created object.
You can see the structure of the event in Event Message Structure.
If you want to send the file via email you will have to write this logic in a Lambda function: you will use the information from the event (bucket and key) to download the object and then send it via email.
This function could subscribe to SNS or directly to S3.
I want to extract an email attachment and save that attachment into an S3 bucket. I have configured SES to intercept my incoming emails.
I am guessing I need to create a SES rule which would have an action to trigger a Lambda function that extracts the email attachment and stores it to S3. I am not sure how to write this Lambda function.