public ElastiGroupStack() { var sg = new Pulumi.Aws.Ec2.SecurityGroup("my-csharp-security-group"); var azs = GetAvailabilityZones.InvokeAsync(); var elastigroup = new Elastigroup("my-csharp-elastigroup", new ElastigroupArgs { FallbackToOndemand = false, InstanceTypesOndemand = "m3.2xlarge", InstanceTypesSpots = { "m3.xlarge", "m3.2xlarge", }, Orientation = "balanced", Product = "Linux/UNIX", SecurityGroups = { sg.Id }, Region = "us-west-2", AvailabilityZones = azs.Result.Names, ImageId = "ami-e251209a", }); }
private async Task <VpcData> Define() { var availabilityZonesResult = await GetAvailabilityZones.InvokeAsync( null, new InvokeOptions { Provider = _options?.Provider }); var azA = availabilityZonesResult.Names[0]; var azB = availabilityZonesResult.Names[1]; var vpcResourceName = $"{GetResourceName()}"; var vpc = new Vpc( vpcResourceName, new VpcArgs { CidrBlock = $"10.{_args.CidrBlockSegment}.0.0/16", Tags = new InputMap <string> { { "Name", vpcResourceName }, { "pulumi:ResourceName", vpcResourceName } } }, new CustomResourceOptions { Provider = _options?.Provider, Parent = this }); var private0 = AddSubnet(vpcResourceName, vpc, "private", azA, 0, _args.CidrBlockSegment, 0); var private1 = AddSubnet(vpcResourceName, vpc, "private", azB, 1, _args.CidrBlockSegment, 64); var public0 = AddSubnet(vpcResourceName, vpc, "public", azA, 0, _args.CidrBlockSegment, 128); var public1 = AddSubnet(vpcResourceName, vpc, "public", azB, 1, _args.CidrBlockSegment, 192); var ig = new InternetGateway( $"{vpc.GetResourceName()}-ig", new InternetGatewayArgs { VpcId = vpc.Id }, new CustomResourceOptions { Parent = vpc }); new Route($"{public0.RouteTable.GetResourceName()}-ig", new RouteArgs { RouteTableId = public0.RouteTable.Id, DestinationCidrBlock = "0.0.0.0/0", GatewayId = ig.Id }, new CustomResourceOptions { Parent = public0.RouteTable }); new Route($"{public1.RouteTable.GetResourceName()}-ig", new RouteArgs { RouteTableId = public1.RouteTable.Id, DestinationCidrBlock = "0.0.0.0/0", GatewayId = ig.Id }, new CustomResourceOptions { Parent = public1.RouteTable }); var eip0 = new Eip( $"{public0.Subnet.GetResourceName()}-eip", new EipArgs { Vpc = true, Tags = new InputMap <string> { { "Name", $"{public0.Subnet.GetResourceName()}-eip" } } }, new CustomResourceOptions { Parent = public0.Subnet }); var natGateway0 = new NatGateway( $"{public0.Subnet.GetResourceName()}-ng", new NatGatewayArgs { SubnetId = public0.Subnet.Id, AllocationId = eip0.Id, Tags = new InputMap <string> { { "Name", $"{public0.Subnet.GetResourceName()}-ng" } } }, new CustomResourceOptions { Parent = public0.Subnet }); new Route($"{private0.Subnet.GetResourceName()}-nat-0", new RouteArgs { RouteTableId = private0.RouteTable.Id, DestinationCidrBlock = "0.0.0.0/0", NatGatewayId = natGateway0.Id }, new CustomResourceOptions { Parent = private0.Subnet }); var eip1 = new Eip( $"{public1.Subnet.GetResourceName()}-eip", new EipArgs { Vpc = true, Tags = new InputMap <string> { { "Name", $"{public1.Subnet.GetResourceName()}-eip" } } }, new CustomResourceOptions { Parent = public1.Subnet }); var natGateway1 = new NatGateway( $"{public1.Subnet.GetResourceName()}-ng", new NatGatewayArgs { SubnetId = public1.Subnet.Id, AllocationId = eip1.Id, Tags = new InputMap <string> { { "Name", $"{public1.Subnet.GetResourceName()}-ng" } } }, new CustomResourceOptions { Parent = public1.Subnet }); new Route($"{private1.Subnet.GetResourceName()}-nat-1", new RouteArgs { RouteTableId = private1.RouteTable.Id, DestinationCidrBlock = "0.0.0.0/0", NatGatewayId = natGateway1.Id }, new CustomResourceOptions { Parent = private1.Subnet }); return(new VpcData(vpc, private0.Subnet, private1.Subnet, public0.Subnet, public1.Subnet)); }