An Elastic IP address is a static, public IPv4 address designed for dynamic cloud computing. You can associate an Elastic IP address with any instance or network interface for any VPC in your account. With an Elastic IP address, you can mask the failure of an instance by rapidly remapping the address to another instance in your VPC.

 

Requirements

 

vCommander scripts (Download here)

PowerShell v4 installed on the vCommander application server

Embotics® vCommander® 6.1.12 or later

Embotics vCommander 2.8 REST API PowerShell libraries (Download here)

AWS PowerShell API Module installed on the vCommander Server (Download Here)

 

 

Prepare the Script Files

 

Download and extract the scripts to your vCommander application server. Embotics recommends storing all scripts called by vCommander in a single location (c:\Scripts) for example. These scripts are executed by vCommander. 

 

The scripts require minor editing before they will work with your systems. Refer to the comments in the individual script or  the table below for guidance on editing the contents.


Setting
Description
$vCommanderServer
The Web URL of the vCommander server.
$CredFile
The credentials file which handles access to your vCommander. For more details, please refer to the Appendix: PowerShell Script Credential Encryption in the vCommander API Getting Started Guide, available here.
$Attrib
Attribute to save the Elastic IP address
$AWSAccessKey
Your AWS access key with programmatic access to add and remove Elastic IP’s from instances
$AWSSecretKey
The secret key to accompany the access key above


Edit the script files for your environment:


Create Custom attribute

 

Create a List based attribute that applies to the form, this is the user selectable option on the form to drive assigning the elastic IP in the completion workflow. 




Update Completion Workflow

 

Now that the scripts and credentials have been configured it's time to update the Completion workflow to call out to AWS and assign an elastic IP for the deployed instance

 

Sample Form:

Adding a step to call the script in the Instance completion workflow (Post provisioning) with the following condition line syntax:

 

("#{target.settings.customAttribute['Assign Elastic IP']} " -eq "Assign elastic IP address only") -and ("#{target.managedSystem.type}" -eq amazon_aws)



Adding a step to call the script in the Instance completion workflow (Post provisioning) with the following command line line syntax:

 

powershell.exe C:\Scripts\Assign_Elastic_Ip.ps1 '#{target.remoteId}' '#{target.id}' '#{target.region.name}'




Update Decommissioning Workflow

Now to configure vCommander to remove the assigned address when the service is decommissioned through vCommander. Edit your completion workflow that's tied to your decommissioning change request form. Add the following conditional Statements to ensure it only runs when needed:

 

("#{target.settings.customAttribute['AWS Elastic IP set']}" -eq yes) -and ("#{target.managedSystem.type}" -eq amazon_aws)

 

Add an execute script step to remove the Elastic IP before your delete vm step with the following command line syntax: 

    

            powershell.exe C:\Scripts\Remove_Elastic_Ip.ps1 '#{target.remoteId}' '#{target.id}' '#{target.region.name}' '#{target.ipAddress}'


Now Request a VM as a test if everything was configured properly you will see the workflow run and the instance will have the attribute "AWS ElasticIP set" and will have the correct network information assigned. 



If you take it a step further and add a nominal cost to the "AWS Elastic IP set" attribute for a value of yes it will be populated on the form and in the Cost reports for vm's that have an elastic IP address set.