Skip to content

Commit

Permalink
Update existing readmes and add two new ones. Fixes pulumi#34
Browse files Browse the repository at this point in the history
  • Loading branch information
lindydonna committed Apr 23, 2018
1 parent cd90c56 commit 780f71a
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 12 deletions.
2 changes: 1 addition & 1 deletion aws-js-webserver-component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Deploy an EC2 instances using `@pulumi/aws`, using a common module for creating an instance. A function `createInstance` is defined in [webserver.js](webserver.js) which is then used in main program.

For a detailed walkthrough, see [Programming AWS](https://docs.pulumi.com/quickstart/aws.html) in the Pulumi documentation.
For a walkthrough of the main example, see [Part 1 of the quickstart](https://docs.pulumi.com/quickstart/part1.html) in the Pulumi documentation
5 changes: 3 additions & 2 deletions aws-js-webserver/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# AWS web server example
# AWS web server example in JavaScript

Deploy an EC2 instance using `@pulumi/aws`. This example shows how to use multiple infrastructure resources in one program. For a detailed walkthrough, see [Part 1 of the quickstart](https://docs.pulumi.com/quickstart/part1.html) in the Pulumi documentation.

Deploy an EC2 instance using `@pulumi/aws`. This example shows how to use multiple infrastructure resources in one program. For a detailed walkthrough, see [Programming AWS](https://docs.pulumi.com/quickstart/aws.html) in the Pulumi documentation.
61 changes: 58 additions & 3 deletions aws-py-webserver/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,62 @@
# examples/scenarios/aws/webserver-py
# AWS web server example in Python

An example based on the basic Amazon EC2 Instance sample at:
http:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/deploying.applications.html.
http:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/deploying.applications.html. The example deploys an EC2 instance and opens port 80. To get the correct Amazon Linux AMI for the instance size and region, a mapping is defined in [ami.py](./ami.py).

This is written in Python. A JavaScript version is available at examples/scenarios/aws/webserver/.
## Prerequisites

1. [Install Pulumi](https://docs.pulumi.com/install/)
1. [Configure Pulumi for AWS](https://docs.pulumi.com/install/aws-config.html)
1. [Configure Pulumi for Python](https://docs.pulumi.com/reference/python.html)

## Deploying and running the program

1. Login to the Pulumi CLI via `pulumi login`.

1. Initialize a Pulumi repository with pulumi init, using your GitHub username. (Note: this step will be removed in the future.)

```bash
$ pulumi init --owner githubUsername
```

1. Create a new stack:

```
$ pulumi stack init webserver-testing
Created stack 'webserver-testing'.
```

1. Run `pulumi preview`:

```
$ pulumi preview
Previewing stack 'python-test' in the Pulumi Cloud ☁️
Previewing changes:
pulumi:Stack("webserver-py-python-test"): Completed
aws:SecurityGroup("web-secgrp"): + Would create
aws:Instance("web-server-www"): + Would create
info: 3 changes previewed:
+ 3 resources to create
```

1. Run `pulumi update`:

```
$ pulumi update
Updating stack 'python-test' in the Pulumi Cloud ☁️
Performing changes:
pulumi:Stack("webserver-py-python-test"): Completed
aws:SecurityGroup("web-secgrp"): + Created
aws:Instance("web-server-www"): + Created
info: 3 changes performed:
+ 3 resources created
Update duration: 26.445180782s
```

1. Verify that the EC2 instance exists, by either using the AWS Console or running `aws ec2 describe-instances`.

1. Clean up resources by running `pulumi destroy`.


1 change: 1 addition & 0 deletions aws-py-webserver/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pulumi>=0.11.0
4 changes: 2 additions & 2 deletions cloud-ts-url-shortener-cache/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: url-shortener
name: url-shortener-cache
runtime: nodejs
description: URL shortener sample
description: URL shortener with cache
53 changes: 53 additions & 0 deletions cloud-ts-url-shortener-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Serverless URL Shortener with Redis Cache

A sample URL shortener SPA that uses the high-level `cloud.Table` and `cloud.HttpEndpoint` components. The example shows to combine serverless functions along with containers.

## Deploying and running the program

1. Initialize a Pulumi repository with pulumi init, using your GitHub username. (Note: this step will be removed in the future.)

```
$ pulumi init --owner githubUsername
```

1. Create a new stack:

```
$ pulumi stack init testing
```

1. Set the provider and region:

```
$ pulumi config set cloud:provider aws
$ pulumi config set aws:region us-west-2
```

1. Set a value for the Redis password. The value can be an encrypted secret, specified with the `--secret` flag. If this flag is not provided, the value will be saved as plaintext in `Pulumi.testing.yaml` (since `testing` is the current stack name).

```
$ pulumi config set --secret redisPassword S3cr37Password
Enter your passphrase to protect config/secrets:
Re-enter your passphrase to confirm:
```

1. Restore NPM modules via `npm install`.

1. Compile the program via `tsc` or `npm run build`.

1. Preview the program deployment:



1. Perform the deployment:

1. To view the API endpoint, use the `stack output` command:

```
$ pulumi stack output endpointUrl
https://gs8t66u634.execute-api.us-east-1.amazonaws.com/stage/
```

1. Open this page in a browser and you'll see a single page app for creating and viewing short URLs.


3 changes: 2 additions & 1 deletion cloud-ts-url-shortener-cache/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import * as pulumi from "@pulumi/pulumi";

let config = new pulumi.Config("url-shortener:config");
let config = new pulumi.Config("url-shortener-cache");

// Get the Redis password from config
export let redisPassword = config.require("redisPassword");
Binary file modified cloud-ts-url-shortener-cache/www/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion cloud-ts-url-shortener/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ A sample URL shortener SPA that uses the high-level `cloud.Table` and `cloud.Htt

## Deploying and running the program

1. Run `pulumi init`. (Note: this command will not be required in a future SDK release.)
1. Initialize a Pulumi repository with pulumi init, using your GitHub username. (Note: this step will be removed in the future.)

```
$ pulumi init --owner githubUsername
```

1. Create a new stack:

Expand Down
Binary file modified cloud-ts-url-shortener/www/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions cloud-ts-voting-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ To use this example, make sure [Docker](https://docs.docker.com/engine/installat

```
$ pulumi config set --secret redisPassword S3cr37Password
Enter your passphrase to protect config/secrets:
Re-enter your passphrase to confirm:
```

### Compile the TypeScript program
Expand Down

0 comments on commit 780f71a

Please sign in to comment.