Before you begin, Armor recommends that you review our pre-installation information, including firewall rules. To learn more, see ANYWHERE Pre-Installation.

You can follow the steps outlined below to provision an Amazon Linux 2 virtual machine, as well as a Windows 2019 virtual machine.  The Amazon Machine Image (AMI) can then be replaced with an AMI of your choice.


Step 1: Replace the following variables with your own information:

  1. <ACCESS_KEY>
  2. <SECRET_KEY>
  3. <LICENSE KEY>
  4. <YOUR_KEY>
  5. <SECURITY GROUP ID>

    Example Terraform file:

    provider "aws" {
      access_key  = "<ACCESS_KEY>"
      secret_key  = "<SECRET_KEY>"
      region      = "us-west-1"
    }
    
    locals {
      instance-userdata-lin = <<EOF
      #!/bin/bash
      sudo curl -sSL https://get.core.armor.com/latest/armor_agent.sh | sudo bash /dev/stdin -l <LICENSE KEY>
      EOF
    
      instance-userdata-win = <<EOF
      <powershell>
      [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
      Invoke-WebRequest https://get.core.armor.com/latest/armor_agent.ps1 -outfile armor_agent.ps1 ; .\armor_agent.ps1 -license <LICENSE KEY>
      </powershell>
      EOF
    }
    
    resource "aws_instance" "amzn2" {
      ami                     = "ami-0245d318c6788de52"
      instance_type           = "t2.medium"
      user_data_base64        = "${base64encode(local.instance-userdata-lin)}"
      key_name                = "<YOUR_KEY>"
      vpc_security_group_ids  = ["<SECURITY GROUP ID>"]
      tags {
        Name                  = "Example TF Linux User Data"
      }
    }
    
    resource "aws_instance" "win2019" {
      ami                     = "ami-0069635df219ce9e5"
      instance_type           = "t2.medium"
      user_data_base64        = "${base64encode(local.instance-userdata-win)}"
      key_name                = <YOUR_KEY>"
      vpc_security_group_ids  = ["<SECURITY GROUP ID>"]
      tags {
        Name                  = "Example TF Windows User Data"
      }
    }


Step 2: Save the above to main.tf.


Step 3: Execute the following command:

terraform apply

The information outlined above is intended to serve as an example only, and can be adapted to suit your use. Please see https://www.terraform.io/docs/index.html for advanced usage.




Was this helpful?
Your Rating: Results: 1 Star2 Star3 Star4 Star5 Star 0 rates