github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/aws-webserver-pp/dotnet/aws-webserver.cs (about) 1 using System.Collections.Generic; 2 using Pulumi; 3 using Aws = Pulumi.Aws; 4 5 return await Deployment.RunAsync(() => 6 { 7 // Create a new security group for port 80. 8 var securityGroup = new Aws.Ec2.SecurityGroup("securityGroup", new() 9 { 10 Ingress = new[] 11 { 12 new Aws.Ec2.Inputs.SecurityGroupIngressArgs 13 { 14 Protocol = "tcp", 15 FromPort = 0, 16 ToPort = 0, 17 CidrBlocks = new[] 18 { 19 "0.0.0.0/0", 20 }, 21 }, 22 }, 23 }); 24 25 var ami = Aws.GetAmi.Invoke(new() 26 { 27 Filters = new[] 28 { 29 new Aws.Inputs.GetAmiFilterInputArgs 30 { 31 Name = "name", 32 Values = new[] 33 { 34 "amzn-ami-hvm-*-x86_64-ebs", 35 }, 36 }, 37 }, 38 Owners = new[] 39 { 40 "137112412989", 41 }, 42 MostRecent = true, 43 }); 44 45 // Create a simple web server using the startup script for the instance. 46 var server = new Aws.Ec2.Instance("server", new() 47 { 48 Tags = 49 { 50 { "Name", "web-server-www" }, 51 }, 52 InstanceType = "t2.micro", 53 SecurityGroups = new[] 54 { 55 securityGroup.Name, 56 }, 57 Ami = ami.Apply(getAmiResult => getAmiResult.Id), 58 UserData = @"#!/bin/bash 59 echo ""Hello, World!"" > index.html 60 nohup python -m SimpleHTTPServer 80 & 61 ", 62 }); 63 64 return new Dictionary<string, object?> 65 { 66 ["publicIp"] = server.PublicIp, 67 ["publicHostName"] = server.PublicDns, 68 }; 69 }); 70