I first used AWS approximately 4 years ago. At that time, programmatic management of services was not an easy hurdle to jump and required regular ‘feeding & watering’.
Naturally, these tools have matured greatly so whatever tool-set you are most comfortable with has a well developed set of features/options available for you to use. These can be referenced and downloaded from this page.
Here, I’m going to demonstrate how to setup and install the AWS Tools for PowerShell.
**Please make sure you follow good practice by creating separate, credentialed (IE NON ROOT) users. **
Download the MSI here and run with Admin creds. You can follow the bouncing ball;
You’ll have a new PowerShell shortcut available;
But it’s much tidier to simply add the import routine into your Default PS Profile by adding the following;
1 |
Import-Module "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell\AWSPowerShell.psd1" |
You are customising this with all your default modules, right ?
Load your profile and verify the module is loaded;
1 |
Get-Module -ListAvailable | Where {$_.Name -like "AWS*"} |
Now, we’ll store some Credentials into a Profile Called “Default”
1 |
Set-AWSCredentials -AccessKey ACCESSKEY -SecretKey SECRETKEY -StoreAs Default |
Storing as Default means a “-ProfileName” parameter does not need to be specified at each execution.
Where do you get these from ? Login to the AWS console and go to the IAM console;
Click on Users, Click on the User you’re going to use and then the “Security credentials” Tab.
To create a fresh Access key ID Pair, click on Create access key.
Click on Show, and copy down the “Secret access key” and stow it in your password vault. Done.
Check it’s all configured, for my Admin profile.
1 |
Get-AWSCredentials -ProfileName Default |
…and a quick check that my accounts and S3Buckets are being returned,
1 |
Get-IAMUser |
Get-S3Bucket | Sort -Property CreationDate | ft -auto
Good to go. Now we’re in and cooking and have the power of PowerShell and AWS at our fingertips.
In Part 2 we’ll go a little deeper and get stuff done. Stay Tuned.