-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
webserver.pp
58 lines (49 loc) 路 1.15 KB
/
webserver.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
config instanceType string {
default = "t3.micro"
}
ec2Ami = invoke("aws:index/getAmi:getAmi", {
filters = [{
name = "name",
values = ["amzn-ami-hvm-*-x86_64-ebs"]
}],
owners = ["137112412989"],
mostRecent = true
}).id
resource webSecGrp "aws:ec2/securityGroup:SecurityGroup" {
__logicalName = "WebSecGrp"
ingress = [{
protocol = "tcp",
fromPort = 80,
toPort = 80,
cidrBlocks = ["0.0.0.0/0"]
}]
}
resource webServer "aws:ec2/instance:Instance" {
__logicalName = "WebServer"
instanceType = instanceType
ami = ec2Ami
userData = "#!/bin/bash\necho 'Hello, World from ${webSecGrp.arn}!' > index.html\nnohup python -m SimpleHTTPServer 80 &"
vpcSecurityGroupIds = [webSecGrp.id]
}
resource usEast2Provider "pulumi:providers:aws" {
__logicalName = "UsEast2Provider"
region = "us-east-2"
}
resource myBucket "aws:s3/bucket:Bucket" {
__logicalName = "MyBucket"
options {
provider = usEast2Provider
}
}
output instanceId {
__logicalName = "InstanceId"
value = webServer.id
}
output publicIp {
__logicalName = "PublicIp"
value = webServer.publicIp
}
output publicHostName {
__logicalName = "PublicHostName"
value = webServer.publicDns
}