Click here to Skip to main content
15,885,365 members
Articles / DevOps
Tip/Trick

Managing Multiple AWS EC2 accounts from a PC

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
8 Jun 2015CPOL3 min read 7.7K   1   1
Introducing a tool to manage multiple AWS accounts from a PC.

Introduction

Supporting Amazon Web Services EC2 instances for a corporation may involve managing multiple accounts.  In each account, there are multiple regions which may contain EC2 Instances.  On other platforms,  AWS supports the use of a Credential file to hold this information, but on the PC, this information is stored in a secure manner which is not portable.
 

This project originally began with the simple goal of scanning all our EC2 instances across all accounts and regions and looking for scheduled events.  Once I had the framework, however, I kept finding new goodies to add in.  I use it in my daily work,  and hope you can use it.   Use at your own risk. 

 

Features

Credential File Import:

Windows uses a secure method of storing Credentials,  and I was not able to get it to use the Credential file the rest of my team (on their stinkin Macs) used.  I did not want to have to manually enter the data in over and over again as I changed PC's so I added code to allow the import of a Credential file which would then add those credentials to the secure Windows store.

Profile and Region Selection

Havent figured out how to multithread the process yet, so running against all 23 profiles with 8 regions each,  and pulling data from 600 instances takes time (about 90 seconds on my PC).

To help speed things up, I added menu items that allow selection of the profiles and regions to scan.

Regions Selection Menu

Connecting

I wish this could be cleaner, but the program will attempt to use the credentials stored in PuTTY/WinSCP to establish SSH/SCP connections to AWS when you right click an instance entry.

Assuming you have multiple credentials stored,  I have to attempt to launch each program once for every credential and try to kill Windows that fail to connect.  It works for me,  but it is the only way I could get this to work.

Viewing and organizing the Data

I keep adding new columns as I discover new data I need to access.  In many cases, I only care about a few columns at the time I am scanning.   Like the Regions and Profiles,  there is a menu item to make columns visible or hidden to make analysing the relevant data easier.  You can also drag columns in the grid to change their order on the fly.  Clicking on a column will sort by that column.

Hiding columns

Filtering

The filtering options are limitted at this point, but you can pick a field to filter,  and enter a filter string, and only instances that match that filter are displayed.  The tags dropdown box is there to allow you to chose from the tags found during the scan.

Filtering

In the above example, filtering the iType field for "t2.micro" returned 25 of the 587 instances.

Upload

Select a file to upload using the ... button,  and select a target directory, and the program will attempt to copy that file to that directory for all instances that appear in the filtered list.  Need to work out how to handle errors, and it wont work with Windows based instances (uses SCP to copy).

 

 

Using the code

The code is published on Github.   You may compile and edit as you like, or submit feedback.  I do not consider myself a developer,  so I am not clued into how to manage a collaborative project, but would love any advice you could offer.


https://github.com/StivOstenberg/EC2EventMonitor

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Network Administrator Samsung Electronics America
United States United States
Using the Web to learn C# and write programs to make my job easier....
Working a lot with AWS now as well.

Comments and Discussions

 
Praisecredentials Pin
codeshane11-Nov-15 13:06
codeshane11-Nov-15 13:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.