New! Spotinst Supports AWS OpsWorks

Reading Time: 2 minutes

Starting from now, you can easily associate your Elastigroup instances with your OpsWorks stack and layers with this simple three steps guide.

opsworks1

Step 1: Choose your AWS OpsWorks Stack

To get started, you need an OpsWorks Stack, Go to AWS OpsWorks console and have your desired stack-id ready for the next steps.

Step 2: Configure IAM Rule for OpsWorks

In order to register your Spot instances into OpsWorks, you need to create an IAM role first and associate it with your Elastigroup.

  1. Sign in to the AWS Management Console and open the IAM console.
  2. In the navigation pane of the console, click Roles and search for aws-opsworks-ec2-role.
  3. Click on the role name, and then in the Permissions tab click on “Attach Policy“.
  4. Search for the policies AWSOpsWorksRegisterCLI and AWSOpsWorksRole.
  5. Click on the policies to select them and then click “Attach Policy“.

Step 3: Create your Elastigroup with IAM Role and a custom startup-script

Once you have configured the IAM role, your Instances can perform operations and attach themselves to any OpsWorks stack.

Create an Elastigroup, select the IAM Role from the previous step and set the user data (startup script) with the following command to register your the instance with your desired stack.

Look for ‘API endpoint region’ parameter under ‘advanced options’ in OpsWorks. Put the stack type parameter as part of the following script. The possible values are either ‘REGIONAL’ or ‘CLASSIC’, according to your type.

 

#!/bin/bash

curl -fsSL https://s3.amazonaws.com/spotinst-labs/spotinst_aws_opsworks_v3.sh | \
OPSWORKS_STACK_TYPE="myStackType" OPSWORKS_STACK_ID="myStackID" OPSWORKS_LAYER_ID="myLayerID" bash
Note: Before using this user-data shell script, please set the following parameters:
OPSWORKS_STACK_ID=”myStackID”
OPSWORKS_LAYER_ID=”myLayerID”
OPSWORKS_STACK_TYPE=”myStackType”
Thank you,
The Spotinst Team.