PythonでS3に接続

#!/usr/bin/env python3  Line 1
# -*- coding: utf-8 -*- Line 2

import boto3

client = boto3.client(
	's3',
	aws_access_key_id="",
	aws_secret_access_key="",
	region_name="ap-northeast-1"
)

print(client.list_buckets())

$ pip3 install python-dotenv

.env

AWS_ACCESS_KEY_ID=''
AWS_SECRET_ACCESS_KEY=''
REGION_NAME='ap-northeast-1'

Fileupload

import boto3
from dotenv import load_dotenv

load_dotenv()
client = boto3.client('s3')

Filename = "lock.txt"
Bucket = "hpscript"
Key = "lockfile.txt"
client.upload_file(Filename, Bucket, Key)
import boto3
from dotenv import load_dotenv
import datetime

load_dotenv()
client = boto3.client('s3')
dt = datetime.datetime.now()
client.put_object(Body="This is lockfile", Bucket = "hpscript", Key = dt.strftime("%Y-%m-%d") + ".txt")

これをlambdaで実行したい。