Another TS newbie question: how does one specify a...
# typescript
s
Another TS newbie question: how does one specify a value for the type of instance to create, and then re-use that value multiple times? For example:
Copy code
let bastionType = "t2.small";
let bastion_instance = new aws.ec2.Instance("bastion", {
    instanceType = bastionType,
});
This doesn't work (
instanceType
requires type Input, but I can't seem to declare my variable as that type).
b
Can you declare your bastionType as:
Copy code
let bastionType = aws.ec2.InstanceTypes.T2_Small
and then use that?
s
Ah, that's got it. I saw the reference to
aws.ec2.InstanceTypes
but wasn't sure exactly how to use it (for example, I tried declaring the type of "bastionType" as that, but that didn't work). Thank you!
b
👍