Hello there - I am using aws-typescript. Doing fir...
# general
r
Hello there - I am using aws-typescript. Doing first basic provisioning of EC2 instances, and the name of the instances is not getting set on creation? I would assume the resource name is used as the VM name? no other args to tap into to be able to set the EC2 instances name either as far as I can tell.
Copy code
import * as aws from "@pulumi/aws";
import {ENV, instanceName} from "../tools/naming";
import {EC2_AMI, EC2_SIZE} from "../ec2";
import {masterCloudInit} from "./cloudinit";
import {Egress, Ingress} from "../security/security_group";
import {Instance} from "@pulumi/aws/ec2";

export interface SaltBuildResult {
    saltmaster: Instance;
}

export function buildSalt(): SaltBuildResult {
    const saltGroup = new aws.ec2.SecurityGroup("salt-secgrp", {
        ingress: [
            Ingress.ssh,
            Ingress.salt,
            Ingress.http,
            Ingress.https
        ],
        egress: [
            Egress.salt,
            Egress.http,
            Egress.https
        ]
    });

    const saltmasterName = instanceName("saltmaster")

    const saltMasterInstance = new aws.ec2.Instance(
        saltmasterName,
        {
            instanceType: EC2_SIZE.MICRO,
            vpcSecurityGroupIds: [saltGroup.id],
            ami: EC2_AMI.UBUNTU_18_04_HVM,
            userData: masterCloudInit({
                hostID: saltmasterName,
                environment: ENV.SHARED_SERVICES,
            })
        }
    )
    return {saltmaster: saltMasterInstance}
}
p
You need to set a tag
Name
on the EC2, thats how AWS works
r
👍