forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
31 lines (26 loc) · 1009 Bytes
/
index.ts
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
const pulumi = require("@pulumi/pulumi");
const linode = require("@pulumi/linode");
const debian9 = "linode/debian9";
// (optional) create a simple web server using a startup script for the instance
const startupScript = `#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &`;
const profile = pulumi.output(linode.getProfile());
const stackscript = new linode.StackScript("simple-server", {
label: "simple-server",
script: startupScript,
description: "SimpleHTTPServer example StackScript",
images: [debian9],
});
const linodeInstance = new linode.Instance("instance", {
instanceType: "g6-nanode-1",
stackscriptId: stackscript,
image: debian9,
region: "us-east",
// Include all "LISH" registered SSH Keys
authorizedKeys: profile.authorizedKeys,
// Include all User configured SSH Keys
authorizedUsers: [profile.username],
}, { dependsOn: [stackscript] });
exports.instanceLabel = linodeInstance.label;
exports.instanceIP = linodeInstance.ipAddress;