Amazon Simple Storage Service (S3) is Amazon provided cloud based scalable, high speed Object storage service. According to Amazon – “Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.”
Refer here for more information on Amazon S3 service.
The script provided below will help you to generate a quick inventory of S3 Buckets in your Account. I have provided very basic inventory script here. However, feel free to add your stuff. It assumes you have already setup your aws credentials and Powershell SDK to run on your system. If you face any issue setting those, please refer following documents to set those:
- https://docs.aws.amazon.com/powershell/latest/userguide/specifying-your-aws-credentials.html
- https://aws.amazon.com/powershell/
Let me know if this is helpful!
<#
.SYNOPSIS
Script to generate CSV File with details of Amazon S3 Buckets in an AWS Account.
.DESCRIPTION
Script to generate CSV File with details of Amazon S3 Buckets in an AWS Account.
NOTE : Set up AWS Credentials with Proper region default before running this script.
.NOTES
Author: Arindam Hazra
Version: 1.0.0
#>
$date = Get-Date -UFormat "%m-%d-%Y"
$currentDir = $(Get-Location).Path
$oFile = "$($currentDir)\S3Buckets_Details_$($date).csv"
if(Test-Path $oFile){Remove-Item $oFile -Force}
"S3 Bucket Name,Creation Date" | Out-File $oFile -Append -Encoding ascii
Get-S3Bucket | ForEach-Object{
$s3BucketName = $createDate = ""
$s3BucketName = $_.BucketName
$createDate = $_.CreationDate
#Here we have associated Tags with the S3 Bucket. You may use it to further parse Tags.
$tags = Get-S3BucketTagging -BucketName $s3BucketName
"$s3BucketName,$createDate" | Out-File $oFile -Append -Encoding ascii
}
Exit
Before running aws scripts, set up your aws credentials following provided documentation above.
Download above script and save it with a .ps1 file extension. After that, Open aws powershell sdk tool console. Once, it is open run the script saved previously.
Once the script execution completes, it will generate a CSV file output like below screenshot: