Use real configuration in ec2instance example
This change eliminates the hard-coded region from the ec2instance
example, and instead uses the new `aws.config.region` configuration
variable.  This makes the code more amenable to multi-instancing.
-import { InternetGateway, Instance, SecurityGroup } from '@coconut/aws/ec2';
+import * as aws from '@coconut/aws';
let keyName = "lukehoban-us-east-1";
let instanceType = "t2.micro";
let sshLocation = "0.0.0.0";
let sshLocationCIDR = sshLocation + "/0";
-let region = "us-east-1";
+let region = aws.config.requireRegion();
let awsRegionArch2AMI: { [name: string]: { [key: string]: string; } }= {
"us-east-1": {
@@ -246,7 +246,7 @@ let awsInstanceType2Arch: { [name: string]: { Arch: string; } } = {
}
};
-let securityGroup = new SecurityGroup("group", {
+let securityGroup = new aws.ec2.SecurityGroup("group", {
groupDescription: "Enable SSH access",
securityGroupIngress: [{
ipProtocol: "tcp",
@@ -256,7 +256,7 @@ let securityGroup = new SecurityGroup("group", {
}]
});
-let instance = new Instance("instance", {
+let instance = new aws.ec2.Instance("instance", {
instanceType: instanceType,
securityGroups: [ securityGroup ],
keyName: keyName,
