Professional Documents
Culture Documents
Lab 12
Lab 12
Lab 12
bucket.
Create another bucket
Again Come to create function
import boto3
source_bucket = event['Records'][0]['s3']['bucket']['name']
destination_bucket = 'outputs3bucket4654'
# Create an S3 client
s3 = boto3.client('s3')
try:
response = s3.list_objects(Bucket=source_bucket)
if 'Contents' in response:
# Iterate through the objects and copy each to the destination bucket
object_key = obj['Key']
return {
'statusCode': 200,
else:
return {
'statusCode': 200,
except Exception as e:
return {
'statusCode': 500,
}
Json code
"Records": [
"s3":
"s3SchemaVersion": "1.0",
"bucket":
"name": "inputs3bucket4654"
}
Delection: