Skip to content

Commit 71fd0bd

Browse files
authored
Update readmes for webserver, fix formatting in url-shortener readme (pulumi#30)
1 parent 5fed47c commit 71fd0bd

File tree

4 files changed

+119
-32
lines changed

4 files changed

+119
-32
lines changed

url-shortener/README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,49 @@ A sample URL shortener SPA that uses the high-level `cloud.Table` and `cloud.Htt
88

99
1. Create a new stack:
1010

11-
```
12-
$ pulumi stack init
13-
Enter a stack name: url-shortener-test
14-
```
11+
```
12+
$ pulumi stack init
13+
Enter a stack name: url-shortener-test
14+
```
1515
1616
1. Set the provider and region:
1717
18-
```
19-
$ pulumi config set cloud:provider aws
20-
$ pulumi config set aws:region us-west-2
21-
```
18+
```
19+
$ pulumi config set cloud:provider aws
20+
$ pulumi config set aws:region us-west-2
21+
```
2222
2323
1. Compile the program via `tsc` or `npm run build`.
2424
2525
1. Preview the program deployment:
2626
27-
```
28-
$ pulumi preview
29-
[many lines elided...]
30-
---outputs:---
31-
endpointUrl: computed<string>
32-
info: 48 changes previewed:
33-
+ 48 resources to create
34-
```
27+
```
28+
$ pulumi preview
29+
[many lines elided...]
30+
---outputs:---
31+
endpointUrl: computed<string>
32+
info: 48 changes previewed:
33+
+ 48 resources to create
34+
```
3535
3636
1. Perform the deployment:
3737
38-
```
39-
$ pulumi update
40-
[many lines elided...]
41-
---outputs:---
42-
endpointUrl: "https://gs8t66u634.execute-api.us-east-1.amazonaws.com/stage/"
43-
info: 48 changes performed:
44-
+ 48 resources created
45-
Update duration: 4m7.023449447s
46-
```
38+
```
39+
$ pulumi update
40+
[many lines elided...]
41+
---outputs:---
42+
endpointUrl: "https://gs8t66u634.execute-api.us-east-1.amazonaws.com/stage/"
43+
info: 48 changes performed:
44+
+ 48 resources created
45+
Update duration: 4m7.023449447s
46+
```
4747
4848
1. The API endpoint will be shown as the value for `endpointUrl` in the CLI output. You can always get this value by running `pulumi stack output`:
4949
50-
```
51-
$ pulumi stack output endpointUrl
52-
https://gs8t66u634.execute-api.us-east-1.amazonaws.com/stage/
53-
```
50+
```
51+
$ pulumi stack output endpointUrl
52+
https://gs8t66u634.execute-api.us-east-1.amazonaws.com/stage/
53+
```
5454
5555
1. Open this page in a browser and you'll see a single page app for creating and viewing short URLs.
5656

webserver-component/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AWS web server component example
2+
3+
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.
4+
5+
For a detailed walkthrough, see [Programming AWS](https://docs.pulumi.com/quickstart/aws.html) in the Pulumi documentation.

webserver-zones/README.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,85 @@
11
# Pulumi web server with availability zones
22

3-
Pulumi example that deploys multiple EC2 instances, one in each availability zone for the region.
3+
Pulumi example that deploys multiple EC2 instances, one in each availability zone for the region. The example uses `aws.getAvailabilityZones()` which calls an an AWS API to retrieve all availability zones for the selected region. The program then loops over these AZs and creates an EC2 instance in each zone.
4+
5+
This example shows how to use dynamic data when deploying infrastructure.
6+
7+
## Deploying and running the program
8+
9+
1. Run `pulumi init`. (Note: this command will not be required in a future SDK release.)
10+
11+
1. Create a new stack:
12+
13+
```
14+
$ pulumi stack init
15+
Enter a stack name: webserver-testing
16+
```
17+
18+
1. Set the provider and region, such as `us-west-2`:
19+
20+
```
21+
$ pulumi config set cloud:provider aws
22+
$ pulumi config set aws:region us-west-2
23+
```
24+
25+
1. Compile the program via `tsc` or `npm run build`.
26+
27+
1. Preview the program deployment:
28+
29+
```
30+
$ pulumi preview
31+
[... many lines elided ...]
32+
---outputs:---
33+
serverUrls: [
34+
[0]: computed<string>
35+
[1]: computed<string>
36+
[2]: computed<string>
37+
]
38+
info: 5 changes previewed:
39+
+ 5 resources to create
40+
```
41+
42+
1. Perform the deployment. Depending on the region you've selected, you should see two or three EC2 instances created.
43+
44+
```
45+
$ pulumi update
46+
[... many lines elided ...]
47+
---outputs:---
48+
serverUrls: [
49+
[0]: "http://ec2-54-148-246-71.us-west-2.compute.amazonaws.com"
50+
[1]: "http://ec2-34-213-186-185.us-west-2.compute.amazonaws.com"
51+
[2]: "http://ec2-52-33-17-194.us-west-2.compute.amazonaws.com"
52+
]
53+
info: 5 changes performed:
54+
+ 5 resources created
55+
Update duration: 57.392733427s
56+
```
57+
58+
1. View the stack output:
59+
60+
```
61+
$ pulumi stack output serverUrls
62+
["http://ec2-54-148-246-71.us-west-2.compute.amazonaws.com","http://ec2-34-213-186-185.us-west-2.compute.amazonaws.com","http://ec2-52-33-17-194.us-west-2.compute.amazonaws.com"]
63+
```
64+
65+
1. Call `curl` on one of the endpoints:
66+
67+
```
68+
$ curl http://ec2-54-148-246-71.us-west-2.compute.amazonaws.com
69+
Hello, World!
70+
Instance metadata:
71+
us-west-2a
72+
```
73+
74+
### Delete resources
75+
76+
When you're done, run `pulumi destroy` to delete the program's resources:
77+
78+
```
79+
$ pulumi destroy
80+
This will permanently destroy all resources in the 'webserver-testing' stack!
81+
Please confirm that this is what you'd like to do by typing ("webserver-testing"): webserver-testing
82+
```
83+
84+
85+

webserver/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Pulumi web server
1+
# AWS web server example
22

3-
Starting point for building the Pulumi web server sample.
3+
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.

0 commit comments

Comments
 (0)