Remove webserver-zones example. Fixes
DELETE
aws-ts-webserver-zones/Pulumi.yaml
-name: webserver
-runtime: nodejs
-description: Basic example of an AWS web server accessible over HTTP.

DELETE
aws-ts-webserver-zones/README.md
-# Pulumi web server with availability zones
-
-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.
-
-This example shows how to use dynamic data when deploying infrastructure.
-
-## Deploying and running the program
-
-1. Run `pulumi init`. (Note: this command will not be required in a future SDK release.)
-
-1. Create a new stack:
-
- ```
- $ pulumi stack init
- Enter a stack name: webserver-testing
- ```
-
-1. Set the provider and region, such as `us-west-2`:
-
- ```
- $ pulumi config set cloud:provider aws
- $ pulumi config set aws:region us-west-2
- ```
-
-1. Compile the program via `tsc` or `npm run build`.
-
-1. Preview the program deployment:
-
- ```
- $ pulumi preview
- [...details omitted...]
- ---outputs:---
- serverUrls: [
- [0]: computed<string>
- [1]: computed<string>
- [2]: computed<string>
- ]
- info: 5 changes previewed:
- + 5 resources to create
- ```
-
-1. Perform the deployment. Depending on the region you've selected, you should see two or three EC2 instances created.
-
- ```
- $ pulumi update
- [...details omitted...]
- ---outputs:---
- serverUrls: [
- [0]: "http://ec2-54-148-246-71.us-west-2.compute.amazonaws.com"
- [1]: "http://ec2-34-213-186-185.us-west-2.compute.amazonaws.com"
- [2]: "http://ec2-52-33-17-194.us-west-2.compute.amazonaws.com"
- ]
- info: 5 changes performed:
- + 5 resources created
- Update duration: 57.392733427s
- ```
-
-1. View the stack output:
-
- ```
- $ pulumi stack output serverUrls
- ["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"]
- ```
-
-1. Call `curl` on one of the endpoints:
-
- ```
- $ curl http://ec2-54-148-246-71.us-west-2.compute.amazonaws.com
- Hello, World!
- Instance metadata:
- us-west-2a
- ```
-
-### Delete resources
-
-When you're done, run `pulumi destroy` to delete the program's resources:
-
-```
-$ pulumi destroy
-This will permanently destroy all resources in the 'webserver-testing' stack!
-Please confirm that this is what you'd like to do by typing ("webserver-testing"): webserver-testing
-```
-
-
-

DELETE
aws-ts-webserver-zones/index.ts
-// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
-
-import * as aws from "@pulumi/aws";
-import * as webserver from "./webserver"; // use the new custom component
-import * as pulumi from "@pulumi/pulumi";
-
-// the async block is required since `getAvailabilityZones` returns a promise
-export let serverUrls = (async () => {
- let zones: string[] = (await aws.getAvailabilityZones()).names;
- let urls: pulumi.Output<string>[] = []; // save the URL of each created instance
-
- for (let i = 0; i < zones.length; i++) {
- let server = webserver.createInstance(`web-server-www-${i}`, "t2.micro", zones[i]);
- urls.push(server.publicDns.apply(dns => `http://${dns}`));
- }
-
- return urls;
-})();

DELETE
aws-ts-webserver-zones/linuxAmi.ts
-// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
-
-// This file defines some maps that correspond to the recommended AWS Marketplace values:
-// http://docs.aws.amazon.com/servicecatalog/latest/adminguide/catalogs_marketplace-products.html
-// Ultimately, this lets us choose a recommended Amazon Linux AMI; see:
-// https://aws.amazon.com/amazon-linux-ami/instance-type-matrix/
-
-import * as aws from "@pulumi/aws";
-
-/**
- * instanceTypeArch is a map of instance type to its architecture.
- */
-const instanceTypeArch: {
- [instanceType: string]: string,
-} = {
- "t1.micro" : "PV64" ,
- "t2.nano" : "HVM64",
- "t2.micro" : "HVM64",
- "t2.small" : "HVM64",
- "t2.medium" : "HVM64",
- "t2.large" : "HVM64",
- "m1.small" : "PV64" ,
- "m1.medium" : "PV64" ,
- "m1.large" : "PV64" ,
- "m1.xlarge" : "PV64" ,
- "m2.xlarge" : "PV64" ,
- "m2.2xlarge" : "PV64" ,
- "m2.4xlarge" : "PV64" ,
- "m3.medium" : "HVM64",
- "m3.large" : "HVM64",
- "m3.xlarge" : "HVM64",
- "m3.2xlarge" : "HVM64",
- "m4.large" : "HVM64",
- "m4.xlarge" : "HVM64",
- "m4.2xlarge" : "HVM64",
- "m4.4xlarge" : "HVM64",
- "m4.10xlarge": "HVM64",
- "c1.medium" : "PV64" ,
- "c1.xlarge" : "PV64" ,
- "c3.large" : "HVM64",
- "c3.xlarge" : "HVM64",
- "c3.2xlarge" : "HVM64",
- "c3.4xlarge" : "HVM64",
- "c3.8xlarge" : "HVM64",
- "c4.large" : "HVM64",
- "c4.xlarge" : "HVM64",
- "c4.2xlarge" : "HVM64",
- "c4.4xlarge" : "HVM64",
- "c4.8xlarge" : "HVM64",
- "g2.2xlarge" : "HVMG2",
- "g2.8xlarge" : "HVMG2",
- "r3.large" : "HVM64",
- "r3.xlarge" : "HVM64",
- "r3.2xlarge" : "HVM64",
- "r3.4xlarge" : "HVM64",
- "r3.8xlarge" : "HVM64",
- "i2.xlarge" : "HVM64",
- "i2.2xlarge" : "HVM64",
- "i2.4xlarge" : "HVM64",
- "i2.8xlarge" : "HVM64",
- "d2.xlarge" : "HVM64",
- "d2.2xlarge" : "HVM64",
- "d2.4xlarge" : "HVM64",
- "d2.8xlarge" : "HVM64",
- "hi1.4xlarge": "HVM64",
- "hs1.8xlarge": "HVM64",
- "cr1.8xlarge": "HVM64",
- "cc2.8xlarge": "HVM64",
-};
-
-/**
- * regionArchLinuxAMI is a map from region to inner maps from architecture to the recommended Linux AMI.
- */
-export let regionArchLinuxAMI: {
- [region: string]: { [arch: string]: string; },
-} = {
- "us-east-1": {
- "PV64" : "ami-2a69aa47",
- "HVM64": "ami-6869aa05",
- "HVMG2": "ami-648d9973",
- },
- "us-west-2": {
- "PV64" : "ami-7f77b31f",
- "HVM64": "ami-7172b611",
- "HVMG2": "ami-09cd7a69",
- },
- "us-west-1": {
- "PV64" : "ami-a2490dc2",
- "HVM64": "ami-31490d51",
- "HVMG2": "ami-1e5f0e7e",
- },
- "eu-west-1": {
- "PV64" : "ami-4cdd453f",
- "HVM64": "ami-f9dd458a",
- "HVMG2": "ami-b4694ac7",
- },
- "eu-west-2": {
- "PV64" : "NOT_SUPPORTED",
- "HVM64": "ami-886369ec",
- "HVMG2": "NOT_SUPPORTED",
- },
- "eu-central-1": {
- "PV64" : "ami-6527cf0a",
- "HVM64": "ami-ea26ce85",
- "HVMG2": "ami-de5191b1",
- },
- "ap-northeast-1": {
- "PV64" : "ami-3e42b65f",
- "HVM64": "ami-374db956",
- "HVMG2": "ami-df9ff4b8",
- },
- "ap-northeast-2": {
- "PV64" : "NOT_SUPPORTED",
- "HVM64": "ami-2b408b45",
- "HVMG2": "NOT_SUPPORTED",
- },
- "ap-southeast-1": {
- "PV64" : "ami-df9e4cbc",
- "HVM64": "ami-a59b49c6",
- "HVMG2": "ami-8d8d23ee",
- },
- "ap-southeast-2": {
- "PV64" : "ami-63351d00",
- "HVM64": "ami-dc361ebf",
- "HVMG2": "ami-cbaf94a8",
- },
- "ap-south-1": {
- "PV64" : "NOT_SUPPORTED",
- "HVM64": "ami-ffbdd790",
- "HVMG2": "ami-decdbab1",
- },
- "us-east-2": {
- "PV64" : "NOT_SUPPORTED",
- "HVM64": "ami-f6035893",
- "HVMG2": "NOT_SUPPORTED",
- },
- "ca-central-1": {
- "PV64" : "NOT_SUPPORTED",
- "HVM64": "ami-730ebd17",
- "HVMG2": "NOT_SUPPORTED",
- },
- "sa-east-1": {
- "PV64" : "ami-1ad34676",
- "HVM64": "ami-6dd04501",
- "HVMG2": "NOT_SUPPORTED",
- },
- "cn-north-1": {
- "PV64" : "ami-77559f1a",
- "HVM64": "ami-8e6aa0e3",
- "HVMG2": "NOT_SUPPORTED",
- },
-};
-
-/**
- * getLinuxAMI gets the recommended Linux AMI for the given instance in the current AWS region.
- */
-export function getLinuxAMI(instanceType: string): string {
- let region = aws.config.requireRegion();
- let arch = instanceTypeArch[instanceType];
- return regionArchLinuxAMI[region][arch];
-}
-

DELETE
aws-ts-webserver-zones/package.json
-{
- "name": "webserver",
- "version": "0.1.0",
- "main": "bin/index.js",
- "typings": "bin/index.d.ts",
- "scripts": {
- "build": "tsc"
- },
- "devDependencies": {
- "typescript": "^2.7.2",
- "@types/node": "^8.0.26"
- },
- "dependencies": {
- "@pulumi/pulumi": "^0.11.0",
- "@pulumi/aws": "^0.11.0"
- }
-}

DELETE
aws-ts-webserver-zones/tsconfig.json
-{
- "compilerOptions": {
- "outDir": "bin",
- "target": "es6",
- "lib": [
- "es6"
- ],
- "module": "commonjs",
- "moduleResolution": "node",
- "declaration": true,
- "sourceMap": true,
- "stripInternal": true,
- "experimentalDecorators": true,
- "pretty": true,
- "noFallthroughCasesInSwitch": true,
- "noImplicitAny": true,
- "noImplicitReturns": true,
- "forceConsistentCasingInFileNames": true,
- "strictNullChecks": true
- },
- "files": [
- "index.ts",
- "webserver.ts",
- "linuxAmi.ts"
- ]
-}

DELETE
aws-ts-webserver-zones/webserver.ts
-// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
-
-import * as aws from "@pulumi/aws";
-import { getLinuxAMI } from "./linuxAmi";
-
-// create a new security group for port 80
-let group = new aws.ec2.SecurityGroup("web-secgrp", {
- description: "Enable HTTP access",
- ingress: [
- { protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] },
- ],
-});
-
-// (optional) create a simple web server using the startup script for the instance
-// use the AWS metadata service to get the availability zone for the instance
-let userData =
- `#!/bin/bash
- echo "Hello, World!\nInstance metadata:" > index.html
- curl http://169.254.169.254/latest/meta-data/placement/availability-zone >> index.html
- nohup python -m SimpleHTTPServer 80 &`;
-
-export function createInstance(name: string, size: aws.ec2.InstanceType, zone: string): aws.ec2.Instance {
- let result = new aws.ec2.Instance(name, {
- availabilityZone: zone,
- tags: { "Name": name }, // use the `name` parameter
- instanceType: size, // use function argument for size
- securityGroups: [ group.name ], // reference the group object above
- ami: getLinuxAMI(size), // call custom lookup function
- userData: userData // set up a simple web server
- });
-
- return result;
-}
\ No newline at end of file

Remove webserver-zones example. Fixes #22.