Connect to AWS

Connecting lightwing to AWS

To connect lightwing to AWS, you will need to create an IAM role and generate access key and secret.

Lightwing will be performing the following actions on the AWS account.

  • Start/Stop/Terminate EC2 instances
  • Create spot instances
  • Start/Stop RDS instances

Creating IAM role

  1. Login to AWS management console
  2. Navigate to IAM
  3. Click on Users and create a new user
  4. Choose programmatic access when creating the user
  5. Choose “Attach existing policies directly”
  6. Choose “Create policy” and paste the following into the “JSON” section
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "LightwingCloudAutomation",
            "Effect": "Allow",
            "Action": [
                "rds:StartDBCluster",
                "rds:StopDBCluster",
                "elasticloadbalancing:*",
                "ec2:StopInstances",
                "autoscaling:*",
                "rds:StopDBInstance",
                "rds:StartDBInstance",
                "ec2:Describe*",
                "iam:CreateServiceLinkedRole",
                "iam:ListInstanceProfiles",
                "iam:ListInstanceProfilesForRole",
                "iam:AddRoleToInstanceProfile",
                "iam:PassRole",
                "ec2:StartInstances",
                "rds:ListTagsForResource",
                "rds:DescribeDBInstances",
                "ec2:*",
                "rds:ModifyDBInstance",
                "iam:GetUser",
                "ec2:ModifyInstanceAttribute",
                "rds:DescribeDBClusters"
            ],
            "Resource": "*"
        }
    ]
}
  1. Enter a policy name. Eg: LightwingCloudAccess
  2. Attach “LightwingCloudAccess” policy in the user creation wizard
  3. Once the user is created, download access key and secret by clicking on the “Download .csv” button in the AWS management console

Setting up AWS on Lightwing

Now that a role is setup on AWS, open up lightwing console and follow the below instructions.

  1. Login to lightwing and click on “Cloud accounts”
  2. Click on “Add account” and enter access key and secret which you just downloaded
  3. Click “Next” and lightwing will successfully connect to your AWS account