Created
April 22, 2023 17:27
-
-
Save saswata-dutta/0390312e505f94dc44c12550514f861b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
s3_client = boto3.client('s3') | |
def lambda_handler(event, context): | |
# Extract the S3 bucket and object key from the event | |
bucket = event['Records'][0]['s3']['bucket']['name'] | |
key = event['Records'][0]['s3']['object']['key'] | |
# Perform desired actions on the uploaded file | |
process_uploaded_file(bucket, key) | |
return { | |
"statusCode": 200, | |
"body": json.dumps({ | |
"message": f"File {key} in bucket {bucket} processed successfully" | |
}) | |
} | |
def process_uploaded_file(bucket, key): | |
# Implement your file processing logic here | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment