pythonhmmm
pythonhmmm

Reputation: 923

Validate if s3 bucket encryption is enabled from cli

Is there any way I can find out using aws cli if encryption is enabled for the given bucket.

I tried using:

aws s3api get-bucket-policy --bucket my-bucket

and

aws s3api head-object --bucket YOURBUCKET --key KEYTOOBJECT

Not sure what key parameter should i pass.

I used : aws s3api head-object --bucket YOURBUCKET --key AES256

which returns me An error occurred (404) when calling the HeadObject operation: Not Found

Upvotes: 2

Views: 4639

Answers (1)

rgrey
rgrey

Reputation: 21

As of aws cli v1.14.11 you now have the get-bucket-encryption option available.

bob$ /usr/local/bin/aws s3api get-bucket-encryption --bucket "my-bucket-name"
{
    "ServerSideEncryptionConfiguration": {
        "Rules": [
            {
                "ApplyServerSideEncryptionByDefault": {
                    "SSEAlgorithm": "AES256"
                }
            }
        ]
    }
}

aws s3api get-bucket-encryption

Upvotes: 2

Related Questions