forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update existing readmes and add two new ones. Fixes pulumi#34
- Loading branch information
1 parent
cd90c56
commit 780f71a
Showing
11 changed files
with
125 additions
and
12 deletions.
There are no files selected for viewing
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
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,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. |
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,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`. | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
pulumi>=0.11.0 |
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,3 +1,3 @@ | ||
name: url-shortener | ||
name: url-shortener-cache | ||
runtime: nodejs | ||
description: URL shortener sample | ||
description: URL shortener with cache |
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 |
---|---|---|
@@ -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. | ||
|
||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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