Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Added ts code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
toriancrane committed Aug 29, 2023
1 parent e1949b1 commit a0ec9b1
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
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;
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;
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;
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ In this tutorial, we'll demonstrate how to create a simple Nginx web server. You

{{< tutorials/prereqs-aws >}}

Let's get started!

## Create a Virtual Machine

The first step is to create a virtual machine resource that will be used to host the web server. The specific details of how to create your virtual machine differ by cloud provider. For the purposes of this tutorial, we will be creating our resources in AWS in the `us-east-1` region.
Expand Down

0 comments on commit a0ec9b1

Please sign in to comment.