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
- Chocolatey
- AWS Tools for Windows Powershell
- PsGet
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!
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
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
If you want to stop all running instances, but not terminate them, then do this:
Stop-AllEC2Instances
The next works in the same way as Get-EC2InstancesWithFilter
, but instead of getting the instances it stops them:
Stop-EC2InstancesWithTagName "Clarity*"
Like the previous example, but starts instances:
Start-EC2InstancesWithTagName "Clarity*"