Amazon Web Services Instances Tools
PowerShell
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 78 commits ahead of kunzimariano:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
AWSInstanceTools.psm1
README.md
install.ps1
install_modules.ps1

README.md

AWSInstanceTools

Amazon Web Services Instance Tools lets you simplify using the AWS Tools for Windows Powershell to start and stop your AWS EC2 virtual machines.

Requirements

Don't worry, all of these will be installed with our installation script in the next step:

  • Powershell 4.0
  • Chocolatey
  • AWS Tools for Windows Powershell
  • PsGet

Install

First of all, if you're installing this from VersionOne, make sure you are in the office or connected to the VPN because the scripts use a file from \\files. If you're not able to do that, you'll need to run the command in this private GitHub file in Powershell once you've run the install script. This configures your system with our default credentials for AWS, and caches them so you don't have to do it every time.

Do this:

  • Open Powershell as Administrator.
  • Type or copy and paste the following commands:
Set-ExecutionPolicy Unrestricted -force; (new-object net.webclient).DownloadString('https://raw.githubusercontent.com/openAgile/AWSInstanceTools/master/install.ps1') | iex

If all goes well, you should have everything installed now and be able to test your installation below!

Notes for people outside of VersionOne

If you're using these tools from another company, you will have to follow the instructions in the Amazon Powershell Tools Documentation for getting your default credentials set up.

Troubleshooting Install

Some machines have trouble with these commands. You may need to reboot after the Powershell 4 installation step, though we've tried to account for that. If you have an issue, please document it on the Issues tab in this repository.

Test installation

Once you have everything installed and your credentials set, try the example commands below.

Basic usage

To test that you are configured correctly, run this command:

Get-EC2InstancesWithTagName "*"  | select -expand Tags

Expect something like this as a result:

PS C:\Users\Daniel> Get-EC2InstancesWithTagName "*"  | select -expand Tags

Key                                                         Value
---                                                         -----
Name                                                        i-12345678
Name                                                        i-0abcdefg
Name                                                        ClarityOne Sandbox - V1
Name                                                        ClarityOne Sandbox - Clarity PPM
Name                                                        Demo Data
Name                                                        i-23456789
Name                                                        Clarity PPM

Get several instances' IP addresses

We can get one or more instances by passing a filter. This filters by the tag name:

Get-EC2InstancesWithTagName "ClarityOne*"

The previous example gets all the instances with the tag name that starts with "ClarityOne". We can also reduce the amount of information we show. Doing the next we only show the ip addresses for those instances:

Get-EC2InstancesWithTagName "ClarityOne*" | select -expand PublicIpAddress

Stopping all instances

If you want to stop all running instances, but not terminate them, then do this:

Stop-AllEC2Instances

Stopping several instances with a filter

The next works in the same way as Get-EC2InstancesWithFilter, but instead of getting the instances it stops them:

Stop-EC2InstancesWithTagName "Clarity*"

Starting several instances with a filter

Like the previous example, but starts instances:

Start-EC2InstancesWithTagName "Clarity*"