This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1949b1
commit a0ec9b1
Showing
4 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 14 additions & 1 deletion
15
...ontent/learn/creating-pulumi-programs/define-and-provision/code/typescript/create-ec2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
import * as aws from "@pulumi/aws"; | ||
import * as pulumi from "@pulumi/pulumi"; | ||
|
||
const userData = ` | ||
#!/bin/bash | ||
sudo yum update -y | ||
sudo yum upgrade -y | ||
sudo amazon-linux-extras install nginx1 -y | ||
sudo systemctl enable nginx | ||
sudo systemctl start nginx` | ||
|
||
// [Step 1: Create an EC2 instance.] | ||
const server = new aws.ec2.Instance("webserver-www2", { | ||
instanceType: "t2.micro", | ||
ami: "ami-09538990a0c4fe9be", | ||
userData: userData, | ||
}); | ||
|
||
// [Step 2: Create a security group.] | ||
export const publicIp = server.publicIp; |
27 changes: 26 additions & 1 deletion
27
...content/learn/creating-pulumi-programs/define-and-provision/code/typescript/create-sg.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,31 @@ | ||
import * as aws from "@pulumi/aws"; | ||
import * as pulumi from "@pulumi/pulumi"; | ||
|
||
const userData = ` | ||
#!/bin/bash | ||
sudo yum update -y | ||
sudo yum upgrade -y | ||
sudo amazon-linux-extras install nginx1 -y | ||
sudo systemctl enable nginx | ||
sudo systemctl start nginx` | ||
|
||
// [Step 2: Create a security group.] | ||
const securityGroup = new aws.ec2.SecurityGroup("webserver-secgrp2", { | ||
description: "Enable HTTP access", | ||
ingress: [{ | ||
protocol: "tcp", | ||
fromPort: 80, | ||
toPort: 80, | ||
cidrBlocks: ["0.0.0.0/0"], | ||
}], | ||
}); | ||
|
||
// [Step 1: Create an EC2 instance.] | ||
const server = new aws.ec2.Instance("webserver-www2", { | ||
instanceType: "t2.micro", | ||
ami: "ami-09538990a0c4fe9be", | ||
userData: userData, | ||
vpcSecurityGroupIds: [securityGroup.id], | ||
}); | ||
|
||
// [Step 2: Create a security group.] | ||
export const publicIp = server.publicIp; |
18 changes: 17 additions & 1 deletion
18
.../learn/creating-pulumi-programs/define-and-provision/code/typescript/updated-baseline.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
import * as aws from "@pulumi/aws"; | ||
import * as pulumi from "@pulumi/pulumi"; | ||
|
||
const userData = ` | ||
#!/bin/bash | ||
sudo yum update -y | ||
sudo yum upgrade -y | ||
sudo amazon-linux-extras install nginx1 -y | ||
sudo systemctl enable nginx | ||
sudo systemctl start nginx` | ||
|
||
// [Step 2: Create a security group.] | ||
const securityGroup = // TO-DO | ||
|
||
// [Step 1: Create an EC2 instance.] | ||
const server = new aws.ec2.Instance("webserver-www2", { | ||
instanceType: "t2.micro", | ||
ami: "ami-09538990a0c4fe9be", | ||
userData: userData, | ||
}); | ||
|
||
// [Step 2: Create a security group.] | ||
export const publicIp = server.publicIp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters