Skip to content

Commit

Permalink
Readmes (pulumi#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Jun 15, 2018
1 parent faa9422 commit a615383
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 112 deletions.
21 changes: 11 additions & 10 deletions aws-js-s3-folder-component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ The component version of [aws-js-s3-folder](../aws-js-s3-folder). For a detailed

## Deploying and running the program

Note: some values in this example will be different from run to run. These values are indicated
with `***`.

1. Create a new stack:

```bash
Expand All @@ -16,9 +19,10 @@ The component version of [aws-js-s3-folder](../aws-js-s3-folder). For a detailed
$ pulumi config set aws:region us-west-2
```

1. Restore NPM modules via `npm install`.
1. Restore NPM modules via `npm install` or `yarn install`.

1. Run `pulumi update` to preview and deploy changes.
1. Run `pulumi update` to preview and deploy changes. After the preview is shown you will be
prompted if you want to continue or not.

```bash
$ pulumi update
Expand All @@ -38,14 +42,11 @@ The component version of [aws-js-s3-folder](../aws-js-s3-folder). For a detailed
+ └─ aws:s3:BucketObject index.html created

---outputs:---
bucketName: "pulumi-static-site-517ff4e"
websiteUrl: undefined

info: 6 changes performed:
+ 6 resources created
Update duration: 8.997389052s
Update duration: ***

Permalink: https://pulumi.com/lindydonna/website-component-testing/updates/1
Permalink: https://app.pulumi.com/***
```

1. To see the resources that were created, run `pulumi stack output`:
Expand All @@ -54,8 +55,8 @@ The component version of [aws-js-s3-folder](../aws-js-s3-folder). For a detailed
$ pulumi stack output
Current stack outputs (2):
OUTPUT VALUE
bucketName s3-website-bucket-e7c0411
websiteUrl s3-website-bucket-e7c0411.s3-website-us-west-2.amazonaws.com
bucketName s3-website-bucket-***
websiteUrl ***.s3-website-us-west-2.amazonaws.com
```

1. To see that the S3 objects exist, you can either use the AWS Console or the AWS CLI:
Expand All @@ -70,7 +71,7 @@ The component version of [aws-js-s3-folder](../aws-js-s3-folder). For a detailed

```bash
$ pulumi stack output websiteUrl
s3-website-bucket-8533d8b.s3-website-us-west-2.amazonaws.com
***.s3-website-us-west-2.amazonaws.com
```

1. To clean up resources, run `pulumi destroy` and answer the confirmation question at the prompt.
22 changes: 11 additions & 11 deletions aws-js-s3-folder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ For a detailed walkthrough of this example, see the tutorial [Static Website on

## Deploying and running the program

Note: some values in this example will be different from run to run. These values are indicated
with `***`.

1. Create a new stack:

```bash
Expand All @@ -17,9 +20,10 @@ For a detailed walkthrough of this example, see the tutorial [Static Website on
$ pulumi config set aws:region us-west-2
```

1. Restore NPM modules via `npm install`.
1. Restore NPM modules via `npm install` or `yarn install`.

1. Run `pulumi update` to preview and deploy changes.
1. Run `pulumi update` to preview and deploy changes. After the preview is shown you will be
prompted if you want to continue or not.

```bash
$ pulumi update
Expand All @@ -37,15 +41,11 @@ For a detailed walkthrough of this example, see the tutorial [Static Website on
+ ├─ aws:s3:BucketObject favicon.png created
+ └─ aws:s3:BucketObject index.html created

---outputs:---
bucketName: "s3-website-bucket-5afcc1d"
websiteUrl: "s3-website-bucket-5afcc1d.s3-website-us-west-2.amazonaws.com"

info: 5 changes performed:
+ 5 resources created
Update duration: 8.69080606s
Update duration: ***

Permalink: https://pulumi.com/lindydonna/website-testing/updates/4
Permalink: https://app.pulumi.com/***
```

1. To see the resources that were created, run `pulumi stack output`:
Expand All @@ -54,8 +54,8 @@ For a detailed walkthrough of this example, see the tutorial [Static Website on
$ pulumi stack output
Current stack outputs (2):
OUTPUT VALUE
bucketName s3-website-bucket-e7c0411
websiteUrl s3-website-bucket-e7c0411.s3-website-us-west-2.amazonaws.com
bucketName s3-website-bucket-***
websiteUrl ***.s3-website-us-west-2.amazonaws.com
```

1. To see that the S3 objects exist, you can either use the AWS Console or the AWS CLI:
Expand All @@ -70,7 +70,7 @@ For a detailed walkthrough of this example, see the tutorial [Static Website on

```bash
$ pulumi stack output websiteUrl
s3-website-bucket-8533d8b.s3-website-us-west-2.amazonaws.com
***.s3-website-us-west-2.amazonaws.com
```

![Hello S3 example](images/part2-website.png)
Expand Down
45 changes: 45 additions & 0 deletions aws-ts-airflow/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# AWS RDS and Airflow example

A Pulumi program to deploy an RDS Postgres instance and containerized Airflow.

## Deploying and running the program

For more information on how to run this example, see: https://pulumi.io/reference and https://pulumi.io/quickstart/

1. Create a new stack:

```bash
$ pulumi stack init airflow
```

1. Set the AWS region:

```
$ pulumi config set aws:region us-east-1
```

1. Enable ECS auto clustering:

```
$ pulumi config set cloud-aws:ecsAutoCluster true
```

1. Set the desired RDS password with:

```
$ pulumi config set airflow:dbPassword DESIREDPASSWORD
```

1. Restore NPM modules via `yarn install`.
1. Build the TypeScript code via `yarn run build`.
1. Run `pulumi update` to preview and deploy changes. After the preview is shown you will be
prompted if you want to continue or not.

```
Previewing update of stack 'airflow'
Previewing changes:
Type Name Plan Info
+ pulumi:pulumi:Stack airflow create
...
```

File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions cloud-js-httpendpoint/README.md → cloud-js-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ A simple REST API that counts the number of times a route has been hit. For a de
## Deploying and running the program

Note: some values in this example will be different from run to run. These values are indicated
with `***`.

1. Create a new stack:

```bash
Expand All @@ -18,7 +21,7 @@ A simple REST API that counts the number of times a route has been hit. For a de
$ pulumi config set aws:region us-west-2
```

1. Restore NPM modules via `npm install`.
1. Restore NPM modules via `npm install` or `yarn install`.

1. Run `pulumi update` to preview and deploy changes:

Expand Down Expand Up @@ -47,21 +50,21 @@ A simple REST API that counts the number of times a route has been hit. For a de
+ └─ aws:apigateway:Stage hello-world created
---outputs:---
endpoint: "https://k6z25g5lw6.execute-api.us-west-2.amazonaws.com/stage/"
endpoint: "https://***.us-west-2.amazonaws.com/stage/"
info: 14 changes performed:
+ 14 resources created
Update duration: 48.510747688s
Update duration: ***
```

1. View the endpoint URL and curl a few routes:

```bash
$ pulumi stack output
$ pulumi stack output
Current stack outputs (1):
OUTPUT VALUE
endpoint https://5e8xrktey3.execute-api.us-west-2.amazonaws.com/stage/
endpoint https://***.us-west-2.amazonaws.com/stage/

$ curl $(pulumi stack output endpoint)/hello
{"route":"hello","count":1}
$ curl $(pulumi stack output endpoint)/hello
Expand Down
6 changes: 3 additions & 3 deletions cloud-js-httpendpoint/index.js → cloud-js-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ const cloud = require("@pulumi/cloud-aws");
let counterTable = new cloud.Table("counterTable", "route");

// Create an API endpoint
let endpoint = new cloud.HttpEndpoint("hello-world");
let endpoint = new cloud.API("hello-world");

endpoint.get("/{route+}", (req, res) => {
let route = req.params["route"];
console.log(`Getting count for '${route}'`);

// get previous value and increment
// reference outer `counterTable` object
counterTable.get({ route }).then(value => {
counterTable.get({ route }).then(value => {
let count = (value && value.count) || 0;
counterTable.insert({ route, count: ++count }).then(() => {
res.status(200).json({ route, count });
console.log(`Got count ${count} for '${route}'`);
console.log(`Got count ${count} for '${route}'`);
});
});
});
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions cloud-js-thumbnailer-machine-learning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ To use this example, make sure [Docker](https://docs.docker.com/engine/installat

## Running the App

Note: some values in this example will be different from run to run. These values are indicated
with `***`.

1. Create a new stack:

```
Expand All @@ -29,13 +32,13 @@ To use this example, make sure [Docker](https://docs.docker.com/engine/installat
$ pulumi config set cloud-aws:computeIAMRolePolicyARNs arn:aws:iam::aws:policy/AWSLambdaFullAccess,arn:aws:iam::aws:policy/AmazonEC2ContainerServiceFullAccess,arn:aws:iam::aws:policy/AmazonRekognitionFullAccess
```

1. Restore NPM modules via `npm install`.
1. Restore NPM modules via `npm install` or `yarn install`.

1. Preview and deploy the app via `pulumi update`. The preview will take some time, as it builds a Docker container. A total of 44 resources are created.
1. Preview and deploy the app via `pulumi update`. The preview will take some time, as it builds a Docker container. A total of 48 resources are created.

```
$ pulumi update
Previewing update of stack 'donna-thumbnailer-rekognition'
Previewing update of stack 'thumbnailer-rekognition'
...
Performing changes:
Expand Down Expand Up @@ -88,21 +91,18 @@ To use this example, make sure [Docker](https://docs.docker.com/engine/installat
+ └─ aws:sns:TopicSubscription AmazonRekognitionTopic_labelResults created
...
---outputs:---
bucketName: "bucket-d6c6339"
info: 44 changes performed:
+ 44 resources created
Update duration: 2m27.112988339s
Update duration: ***
Permalink: https://pulumi.com/pulumi/donna-thumbnailer-rekognition/updates/1
Permalink: https://app.pulumi.com/***
```

1. Upload a video:

```
$ aws s3 cp ./sample/cat.mp4 s3:https://$(pulumi stack output bucketName)
upload: sample/cat.mp4 to s3:https://bucket-c647dfb/cat.mp4
upload: sample/cat.mp4 to s3:https://***/cat.mp4
```

1. View the logs from both the Lambda function and the ECS task:
Expand All @@ -113,7 +113,7 @@ To use this example, make sure [Docker](https://docs.docker.com/engine/installat
2018-05-21T19:57:35.968-07:00[ onNewVideo] *** New video: file cat.mp4 was uploaded at 2018-05-22T02:57:35.431Z.
2018-05-21T19:57:36.376-07:00[ onNewVideo] *** Submitted Rekognition job for cat.mp4
2018-05-21T19:57:45.848-07:00[AmazonRekognitionTopic_labelRe] *** Rekognition job complete
2018-05-21T19:57:50.690-07:00[AmazonRekognitionTopic_labelRe] Raw label results:
2018-05-21T19:57:50.690-07:00[AmazonRekognitionTopic_labelRe] Raw label results:
...
2018-05-21T19:57:50.746-07:00[AmazonRekognitionTopic_labelRe] *** Found object Cat at position 1568. Confidence = 50.56669616699219
2018-05-21T19:57:50.746-07:00[AmazonRekognitionTopic_labelRe] *** Rekognition processing complete for bucket-d6c6339/cat.mp4 at timestamp 1.568
Expand All @@ -130,7 +130,7 @@ To use this example, make sure [Docker](https://docs.docker.com/engine/installat

```
$ aws s3 cp s3:https://$(pulumi stack output bucketName)/cat.jpg .
download: s3:https://bucket-0e25c2d/cat.jpg to ./cat.jpg
download: s3:https://***/cat.jpg to ./cat.jpg
```

## Clean up
Expand Down
26 changes: 13 additions & 13 deletions cloud-js-thumbnailer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ To run this example, make sure [Docker](https://docs.docker.com/engine/installat

## Running the App

Note: some values in this example will be different from run to run. These values are indicated
with `***`.

1. Create a new stack:

```
Expand All @@ -23,9 +26,9 @@ To run this example, make sure [Docker](https://docs.docker.com/engine/installat
```
$ pulumi config set aws:region us-west-2
$ pulumi config set cloud-aws:useFargate true
```
```

1. Restore NPM modules via `npm install`.
1. Restore NPM modules via `npm install` or `yarn install`.

1. Preview and deploy the app via `pulumi update`. The preview will take some time, as it builds a Docker container. A total of 32 resources are created.

Expand Down Expand Up @@ -79,14 +82,11 @@ To run this example, make sure [Docker](https://docs.docker.com/engine/installat
+ └─ aws:ec2:SecurityGroup pulumi-thumbnaile-global created
...
---outputs:---
bucketName: "bucket-c647dfb"
info: 32 changes performed:
+ 32 resources created
Update duration: 1m32.73050186s
Update duration: ***
Permalink: https://pulumi.com/lindydonna/thumbnailer-testing/updates/1
Permalink: https://app.pulumi.com/***
```

1. View the stack outputs:
Expand All @@ -95,37 +95,37 @@ To run this example, make sure [Docker](https://docs.docker.com/engine/installat
$ pulumi stack output
Current stack outputs (1):
OUTPUT VALUE
bucketName bucket-6120251
bucketName ***
```

1. Upload a video, embedding the timestamp in the filename:

```
$ aws s3 cp ./sample/cat.mp4 s3:https://$(pulumi stack output bucketName)/cat_00-01.mp4
upload: sample/cat.mp4 to s3:https://bucket-c647dfb/cat_00-01.mp4
upload: sample/cat.mp4 to s3:https://***/cat_00-01.mp4
```

1. View the logs from both the Lambda function and the ECS task:

```
$ pulumi logs -f
Collecting logs for stack thumbnailer-testing since 2018-05-25T11:56:53.000-07:00.
Collecting logs for stack thumbnailer-testing since ***
2018-05-25T12:57:26.326-07:00[ onNewVideo] *** New video: file cat_00-01.mp4 was uploaded at 2018-05-25T19:57:25.507Z.
2018-05-25T12:57:30.705-07:00[ onNewVideo] Running thumbnailer task.
2018-05-25T12:58:34.960-07:00[ ffmpegThumbTask] Starting ffmpeg task...
2018-05-25T12:58:34.960-07:00[ ffmpegThumbTask] Copying video from S3 bucket-5ea6b28/cat_00-01.mp4 to cat_00-01.mp4...
2018-05-25T12:58:37.267-07:00[ ffmpegThumbTask] Completed 256.0 KiB/666.5 KiB (2.5 MiB/s) with 1 fildownload: s3:https://bucket-5ea6b28/cat_00-01.mp4 to ./cat_00-01.mp4
2018-05-25T12:58:37.267-07:00[ ffmpegThumbTask] Completed 256.0 KiB/666.5 KiB (2.5 MiB/s) with 1 fildownload: s3:https://bucket-5ea6b28/cat_00-01.mp4 to ./cat_00-01.mp4
2018-05-25T12:58:40.306-07:00[ ffmpegThumbTask] Copying cat.jpg to S3 at bucket-5ea6b28/cat.jpg ...
2018-05-25T12:58:43.034-07:00[ ffmpegThumbTask] Completed 86.6 KiB/86.6 KiB (619.7 KiB/s) with 1 filupload: ./cat.jpg to s3:https://bucket-5ea6b28/cat.jpg
2018-05-25T12:58:43.034-07:00[ ffmpegThumbTask] Completed 86.6 KiB/86.6 KiB (619.7 KiB/s) with 1 filupload: ./cat.jpg to s3:https://bucket-5ea6b28/cat.jpg
2018-05-25T12:58:43.758-07:00[ onNewThumbnail] *** New thumbnail: file cat.jpg was saved at 2018-05-25T19:58:43.028Z.
```

1. Download the key frame:

```
$ aws s3 cp s3:https://$(pulumi stack output bucketName)/cat.jpg .
download: s3:https://bucket-0e25c2d/cat.jpg to ./cat.jpg
download: s3:https://***/cat.jpg to ./cat.jpg
```

## Clean up
Expand Down
Loading

0 comments on commit a615383

Please sign in to comment.