aws s3api put-bucket-versioning --bucket <bucket-name> --versioning-configuration Status=Enabled
aws s3api put-public-access-block --bucket <bucket-name> --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
aws s3api put-bucket-encryption --bucket <bucket-name> --server-side-encryption-configuration '{"Rules": [{"ApplyServerSideEncryptionByDefault": {"SSEAlgorithm": "AES256"}}]}'
boto3
library in Python to interact with the AWS S3 service.list_buckets()
method.get_bucket_encryption()
method.put_bucket_encryption()
method to enable server-side encryption.boto3
library in Python to interact with the AWS S3 service.list_buckets()
method.get_bucket_versioning()
method.put_bucket_versioning()
method to enable versioning.boto3
library in Python to interact with the AWS S3 service.list_buckets()
method.get_bucket_logging()
method.put_bucket_logging()
method to enable logging.'your-logging-bucket'
with the name of the bucket where you want to store the logs.