Home > database >  How to all S3 bucket configuration settings from the CLI?
How to all S3 bucket configuration settings from the CLI?

Time:11-05

I would like to pull all of the configuration values for an S3 bucket, for example encryption settings, ACL lists, etc from the command line.

Unfortunately, aws s3api doesn't seem to have a unified view of configuration, instead you have to query each configuration type individually, for example:

aws s3api get-bucket-accelerate-configuration --bucket my-bucket >> my-bucket-config
aws s3api get-bucket-acl --bucket my-bucket >> my-bucket-config
aws s3api get-bucket-cors --bucket my-bucket >> my-bucket-config
# ....and many, many more

Is there another API, or method that provides a uniform view of how an S3 bucket is configured from the CLI?

CodePudding user response:

The AWS Config service can provide this type of aggregate configuration information in JSON form.

For example:

aws configservice get-resource-config-history \
    --resource-type AWS::S3::Bucket \
    --resource-id mybucket
  • Related