How to create S3 bucket using AWS Lambda python?

Viewed 5009

I am creating a AWS Lambda function using Python. I want to create S3 bucket but I am getting error as the bucket name provided by me is not JSON serializable.

Here is the code I used for creating a bucket with Lambda:

import boto from boto 
import s3 from boto.s3.connection 
import S3Connection

def lambda_handler(event, context):
  conn = S3Connection('access_key','secret_access_key')
  print "Connection:",conn
  bucket = conn.create_bucket('bucketname')
  print bucket
  return bucket
1 Answers
Related