Amazon Web Services Instance Tools lets you simplify using the AWS Tools for Windows Powershell to start and stop your AWS EC2 virtual machines.
Don't worry, all of these will be installed with our installation script in the next step:
- Powershell 4.0
- AWS Tools for Windows Powershell
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.
- 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.
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.
Once you have everything installed and your credentials set, try the example commands below.
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:
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:
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:
Starting several instances with a filter
Like the previous example, but starts instances: