2018-04-05 16:49:30 +00:00
---
title: About the aws_s3_buckets Resource
---
# aws\_s3\_buckets
2019-04-26 18:24:29 +00:00
Use the `aws_s3_buckets` Chef InSpec audit resource to list all buckets in a single account.
2018-04-05 16:49:30 +00:00
2019-04-26 18:24:29 +00:00
Use the `aws_s3_bucket` Chef InSpec audit resource to perform in-depth auditing of a single S3 bucket.
2018-04-05 16:49:30 +00:00
<br>
2018-08-09 12:34:49 +00:00
## Availability
### Installation
2019-04-26 18:24:29 +00:00
This resource is distributed along with Chef InSpec itself. You can use it automatically.
2018-08-09 12:34:49 +00:00
### Version
This resource first became available in v2.1.30 of InSpec.
2018-04-05 16:49:30 +00:00
## Syntax
An `aws_s3_buckets` resource block takes no arguments
describe aws_s3_buckets do
it { should exist }
end
<br>
## Examples
2019-04-26 18:24:29 +00:00
The following examples show how to use this Chef InSpec audit resource.
2018-04-05 16:49:30 +00:00
As this is the initial release of `aws_s3_buckets`, its limited functionality precludes examples.
<br>
## Matchers
### exists
The control will pass if the resource contains at least one bucket.
# Test if there are any buckets
describe aws_s3_buckets
it { should exist }
end
## Properties
### bucket\_names
Provides an array of strings containing the names of the buckets.
2018-05-10 18:57:53 +00:00
# Examine what buckets have been created.
2018-04-05 16:49:30 +00:00
describe aws_s3_buckets do
its('bucket_names') { should eq ['my_bucket'] }
# OR
its('bucket_names') { should include 'my_bucket' }
end
2018-05-10 18:57:53 +00:00
## AWS Permissions
Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `s3:ListAllMyBuckets` action with Effect set to Allow.
You can find detailed documentation at [Actions, Resources, and Condition Keys for Amazon S3](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html).