EC2 AWS CLI Adapter

Need some help? Contact us:

 

 

The EC2 AWS CLI adapter is a simple component which can be used to automate EC2 interactions such as managing IPs, getting EC2 instance descriptions and running instances. We use it ourselves to streamline deploying our EC2 instances.

This component assumes you have an AWS EC2 Instance Launch Template setup to use. If you don’t have one, you can follow the AWS instructions to create a Launch Template.

Follow the steps below to set it up this component in your IguanaX environment:

Refer to our documentation IguanaX Installation and https://interfaceware.atlassian.net/wiki/pages/createpage.action?spaceKey=IXB&title=AWS%20CLI&linkCreation=true&fromPageId=2705784943 if you have not installed them.

You can use this url:

git@bitbucket.org:interfaceware/ec2awscli.git

This adapter is built as a Library, so you can also create your own component and simply import the EC2 Library into your project. See Import a Library.

There are two custom fields to set:

  • ltemplate: AWS EC2 Instance Launch Template ID (ex. lt-0123456789abcdef0) will be used to programmatically run an EC2 instance. You can find this value in your AWS Console > Services > EC2 > Instance > Launch Templates.

  • resultsout: File directory location to store temporary result files. You can leave this as is or change to a directory of your choice.

These are a component’s Custom Fields.

In main.lua, update the functions and try out the different EC2 methods by uncommenting the sample function calls. Continue on reading this doc for examples of each method.

Uncomment sampleAllocateIp() and see the results in your AWS Console. Go to EC2 > Network & Security > Elastic IPs.

Note the Allocation ID value. We’ll use this later when we associate this IP.

This adapter can easily be extended by your team to meet your workflow needs by adding new method functions. You can reference the AWS CLI EC2 API documentation.

Take a look at How the EC2 AWS CLI Adapter works if you want more information on the core concepts used in building and adapting this component.

Related pages