连接存储池
from boto3.session import Session
import boto3
from botocore.client import Config
session = Session(aws_access_key_id="xxxxx-xxxxxx-xxxxxx", aws_secret_access_key="xxxx-xxxxx-xxxxxxx-xxxxxxxxxxxxxxx")
s3_client = session.client('s3', endpoint_url="xxxxx-xxxxx", config=Config(signature_version='s3'))
创建bucket
user0_bucket = s3_client.create_bucket(Bucket="user0-bucket")
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a5aeeeb8ff6ec2144f968ec64c382018.png)
向bucket中写入file object
f = open("/root/platform/public/test.zip","rb")
s3_client.put_object(Body=f,Bucket="user0-bucket",Key="/root/platform/public/test.zip")
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/6f36577e5529f42cdc27ad3e832921f5.png)
向bucket中写入string object
s3_client.put_object(Body="good job haha",Bucket="user0-bucket",Key="good1")
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7e6186726009deab8169b969a88e5912.png)