AWS Report using Powershell

I have been using AWS off and on for almost a year. Both for professional projects and for personal projects. A great service and if your project is small enough a very cost effective hosting solution. I decided to start working on automating a few tasks using Powershell and the AWS Powershell module.

I wrote a quick reporting script to run as a scheduled task to keep track of my personal projects. The report can check multiple AWS accounts. I refer to these as environments in the report. The script generates an html and csv file . The code can be found in my github or on pastebin (pastebin)

To configure the script for your environment:

Download the plugin here and install it.

I’d suggest creating a read only user for each environment you need to check. Creating a user is pretty well documented.

When prompted download the Access Keys or Copy and paste them into notepad we’ll need those to authenticate against aws.

After the user is created make a group called “Read only” from the permissions list provide it with the “ReadOnlyAccess” policy:



Now that the AWS account is created and you noted or recreated your Access keys. Log into the Computer/Server you installed the plugin on as the Service account user that will be running the script. Import the AWS module:

if($PSVersionTable.PSVersion.Major -ge 4) {

Import-Module AWSPowerShell

} else {

Import-Module "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell\AWSPowerShell.psd1"


Take the Access keys for each environment and enter them into the powershell like so:

Set-AWSCredentials -AccessKey <access key> -SecretKey <secret key> -Storeas <profile name>

For this script the <profile name> will be reported as the environment so names like: “Prod, Staging, Dev, Corp” what ever works for the environment.

At the top of the script enter each of the profile names in to the Array:

#profiles to check

$profile_list = (“Example_1”)

Check the path configs and make sure everything is correct for your environment:

#Path configs

$website_path = "C:\inetpub\awsreport.html"

$website_tmp_path = ".\awsreport.tmp"

$csv_tmp_path = ".\awscsvreport.tmp"

$csv_path = "C:\inetpub\awsreport.csv"

Create a scheduled task to run as often as you would like updates.

Thanks for reading. If you have questions feel free to leave a comment.

Sharing is caring!

2 thoughts on “AWS Report using Powershell

  1. I love your blog but i can’t learn most things you post because they are complex for my IT level (helpdesk). For example, i would like to know what do you use AWS in your personal life, i’m trying to learn 🙂

Leave your comment

5 × 2 =