GithubHelp home page GithubHelp logo

pulumi / examples Goto Github PK

View Code? Open in Web Editor NEW
2.3K 77.0 875.0 136.82 MB

Infrastructure, containers, and serverless apps to AWS, Azure, GCP, and Kubernetes... all deployed with Pulumi

Home Page: https://www.pulumi.com

License: Apache License 2.0

TypeScript 38.09% HTML 3.98% Python 19.11% CSS 0.49% Shell 0.84% JavaScript 2.88% C# 13.91% Go 12.64% Dockerfile 0.79% Ruby 2.14% CoffeeScript 0.02% Makefile 0.17% Java 2.41% PowerShell 0.08% F# 1.23% SCSS 0.12% CUE 0.09% Jinja 0.73% Astro 0.29%
serverless aws azure gcp kubernetes

examples's Introduction

Pulumi Examples

Open in GitHub Codespaces

This repository contains examples of using Pulumi to build and deploy cloud applications and infrastructure across major programming languages.

Each example has a two-part prefix, <cloud>-<language>, to indicate which <cloud> and <language> it pertains to. For example, <cloud> could be:

See the Pulumi documentation for more details on getting started with Pulumi.

Checking Out a Single Example

You can checkout only the example(s) you want by using a sparse checkout. The following commands show how checkout only the aws-go-fargate example. Replace aws-go-fargate with your example of interest.

$ mkdir examples && cd examples
$ git init
$ git remote add origin -f https://github.com/pulumi/examples/
$ git config core.sparseCheckout true
$ echo "aws-go-fargate" >> .git/info/sparse-checkout ## update this
$ git pull origin master

Don't see an example listed? Try Pulumi AI and use natural-language prompts to generate Pulumi infrastructure-as-code programs in any language.

Outline

AWS

TypeScript

(Click here to go back to the main list)

Example Description
API Gateway Deploy a simple REST API that counts the number of times a route has been hit.
API Gateway HTTP API with routes Deploy a HTTP API that invokes a Lambda.
API Gateway HTTP API quickstart Deploy a very simple HTTP API that invokes a Lambda.
API Gateway V1 with EventBridge and Lambda Deploy a REST API that uses EventBridge to target a Lambda function. Includes API Gateway model validation and custom integration-response mapping.
API Gateway V2 with EventBridge and Lambda Deploy an HTTP API that uses EventBridge to target a Lambda function.
Apigateway - Auth0 Deploy a simple REST API protected by Auth0.
AppSync Deploy a basic GraphQL endpoint in AWS AppSync.
AssumeRole Use AssumeRole to create resources.
Containers Provision containers on Fargate.
EKS - Dashboard Deploy an EKS Kubernetes cluster with an EBS-backed StorageClass, then the Kubernetes Dashboard into the cluster.
EKS - Hello World Deploy an EKS Kubernetes cluster with an EBS-backed StorageClass, then a Kubernetes namespace and nginx deployment into the cluster.
EKS - Migrate Node Groups Create an EKS cluster and node group to use for workload migration with zero downtime.
Fargate Build, deploy, and run a Dockerized app using ECS, ECR, and Fargate.
Lambda Thumbnailer Create a video thumbnail extractor using serverless functions.
Miniflux Stand up an RSS Service using Fargate and RDS.
Pulumi Webhooks Create a Pulumi cloud.HttpEndpoint that receives webhook events delivered by Pulumi Cloud, then echos the event to Slack.
RDS and Airflow Deploy a RDS Postgres instance and containerized Airflow.
Resources Create various resources, including cloudwatch.Dashboard, cloudwatch.EventRule, cloudwatch.LogGroup, and sqs.Queue.
Ruby on Rails Create a single EC2 virtual machine instance with a local MySQL database.
S3 Lambda Set up two AWS S3 Buckets and a single Lambda that listens to one and, upon each new object arriving in it, zips it up and copies it to the second bucket.
Serverless Application Deploy a complete serverless C# application using raw resources from @pulumi/aws.
Serverless Datawarehouse Deploy a serverless data warehouse.
Slackbot Create a simple slackbot that posts a notification to a specific channel any time you're @mentioned anywhere.
Stack Reference Create a "team" EC2 Instance with tags set from upstream stacks.
Static Website Serve a static website using S3, CloudFront, Route53, and Certificate Manager.
Step Functions Use Step Functions with a Lambda function.
Thumbnailer Create a video thumbnail extractor using serverless functions and containers.
Twitter Query Twitter every 2 minutes, store the results in S3, and set up an Athena table and query.
URL Shortener Create a serverless URL shortener that uses high-level components.
Voting App Create a simple voting app using Redis and Python Flask.
Web Server Deploy an EC2 Virtual machine using TypeScript to run a Python web server.
Web Server with Manual Provisioning Use Pulumi dynamic providers to accomplish post-provisioning configuration steps.
LangServe - Hello OpenAI Deploy a LangServe app that uses OpenAI's on AWS ECS.

JavaScript

(Click here to go back to the main list)

Example Description
Containers Provision containers on Fargate.
S3 Folder Component Serve a static website on S3 from a component.
S3 Folder Serve a static website on S3.
Servless SQS to Slack Wire up a serverless AWS Lambda to an AWS SQS queue and post a message to Slack.
Web Server - Component Deploy an EC2 instance using a common module for creating an instance.
Web Server Deploy an EC2 Virtual machine running a Python web server.
LangServe - Hello OpenAI Deploy a LangServe app that uses OpenAI's on AWS ECS.

Python

(Click here to go back to the main list)

Example Description
API Gateway HTTP API quickstart Deploy a very simple HTTP API that invokes a Lambda.
API Gateway V2 with EventBridge and Lambda Deploy an HTTP API that uses EventBridge to target a Lambda function.
AppSync Deploy a basic GraphQL endpoint in AWS AppSync.
AssumeRole Use AssumeRole to create resources.
Fargate Provision a full ECS Fargate cluster running a load-balanced nginx web server.
Resources Create various resources, including cloudwatch.Dashboard, cloudwatch.EventRule, cloudwatch.LogGroup, and sqs.Queue.
S3 Folder Serve a static website on S3.
Stack Reference Create a "team" EC2 Instance with tags set from upstream stacks.
Step Functions Use Step Functions with a Lambda function.
Web Server Deploy an EC2 instance and open port 80.
LangServe - Hello OpenAI Deploy a LangServe app that uses OpenAI's on AWS ECS.

Go

(Click here to go back to the main list)

Example Description
AssumeRole Use AssumeRole to create resources.
Fargate Provision a full ECS Fargate cluster running a load-balanced nginx web server.
Lambda Create a lambda that does a simple ToUpper on the string input and returns it.
S3 Folder Serve a static website on S3.
Web Server Deploy an EC2 Virtual machine running a Python web server.
LangServe - Hello OpenAI Deploy a LangServe app that uses OpenAI's on AWS ECS.

C#

(Click here to go back to the main list)

Example Description
AssumeRole Use AssumeRole to create resources.
Fargate Build, deploy, and run a Dockerized app using ECS, ECR, and Fargate.
Lambda Create a lambda that does a simple ToUpper on the string input and returns it.
S3 Folder Serve a static website on S3.
Web Server Deploy an EC2 instance and open port 80.
LangServe - Hello OpenAI Deploy a LangServe app that uses OpenAI's on AWS ECS.

F#

(Click here to go back to the main list)

Example Description
Lambda Web Server Create a web server in AWS lambda using the Giraffe web server.
S3 Folder Serve a static website on S3.

Azure

TypeScript

(Click here to go back to the main list)

Example Description
Azure Container Apps Run a Docker image on Azure Container Apps.
Azure Container Instance Run Azure Container Instances on Linux.
Azure Kubernetes Service Create an Azure Kubernetes Service (AKS) Cluster.
Azure App Service Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Azure App Service with Docker Build a web application hosted in App Service from Docker images.
App Service in Virtual Network Deploy two App Services - Front web app with VNet injection and Back web app with a Private Endpoint.
Azure Cosmos DB and LogicApp Define Cosmos DB, API connections, and link them to a logic app.
Azure Functions Deploy a Node.js serverless function to Azure Functions.
Azure Functions - Many Deploy several kinds of Azure Functions created from raw deployment packages.
Azure SDK integration Call Azure SDK functions from a Pulumi program.
Static Website Configure static website hosting in Azure Storage.
Azure Synapse Starting point for enterprise analytics solutions based on Azure Synapse.
Web Server Provision a Linux web server in an Azure Virtual Machine.

Python

(Click here to go back to the main list)

Example Description
Azure Container Apps Run a Docker image on Azure Container Apps.
Azure Container Instance Run Azure Container Instances on Linux.
Azure Kubernetes Service Create an Azure Kubernetes Service (AKS) Cluster.
Azure App Service Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Azure App Service with Docker Build a web application hosted in App Service from Docker images.
Azure SDK integration Call Azure SDK functions from a Pulumi program in Python.
Azure Cosmos DB and LogicApp Define Cosmos DB, API connections, and link them to a logic app.
Minecraft Server Deploy an Azure Virtual Machine and provision a Minecraft server.
Static Website Configure static website hosting in Azure Storage.
Azure Synapse Starting point for enterprise analytics solutions based on Azure Synapse.
Virtual Data Center Deploy Azure Virtual Data Center (VDC) hub-and-spoke network stacks in Azure, complete with ExpressRoute and VPN Gateways, Azure Firewall guarding a DMZ, and Azure Bastion.
Web Server Provision a Linux web server in an Azure Virtual Machine.

Go

(Click here to go back to the main list)

Example Description
Azure Container Apps Run a Docker image on Azure Container Apps.
Azure Container Instance Run Azure Container Instances on Linux.
Azure Kubernetes Service Create an Azure Kubernetes Service (AKS) Cluster.
Azure App Service with Docker Build a web application hosted in App Service from Docker images.
Static Website Configure static website hosting in Azure Storage.
Azure SDK integration Call Azure SDK functions from a Pulumi programin Go.

C#

(Click here to go back to the main list)

Example Description
Cluster.
Azure Container Apps Run a Docker image on Azure Container Apps.
Azure Container Instance Run Azure Container Instances on Linux.
Azure Kubernetes Service Create an Azure Kubernetes Service (AKS) Cluster.
AKS web app with .NET 5 Create an Azure Kubernetes Service (AKS) cluster and deploy a web app to it using .NET 5 and C# 9.
AKS + Cosmos DB A Helm chart deployed to AKS that stores TODOs in an Azure Cosmos DB MongoDB API.
Azure App Service Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Azure App Service with Docker Build a web application hosted in App Service from Docker images.
Azure API integration Call additional Azure API endpoints from a Pulumi program.
Azure Cosmos DB and LogicApp Define Cosmos DB, API connections, and link them to a logic app.
Azure Functions Deploy a Node.js serverless function to Azure Functions.
Static Website Configure static website hosting in Azure Storage.
Azure Synapse Starting point for enterprise analytics solutions based on Azure Synapse.
Azure SQL Server An example of a SQLServer on Azure PaaS.

GCP

TypeScript

(Click here to go back to the main list)

Example Description
Cloud Run Deploy a custom Docker image into Google Cloud Run service.
Functions - Raw Deploy two Google Cloud Functions implemented in Python and Go.
Functions Deploy an HTTP Google Cloud Function endpoint.
GKE - Hello World Deploy a GKE cluster, then a Kubernetes namespace and nginx deployment into the cluster.
GKE Provision a Google Kubernetes Engine (GKE) cluster, then a Kubernetes Deployment.
Ruby on Rails Deliver a containerized Ruby on Rails application.
Slackbot Create a simple slackbot that posts a notification to a specific channel any time you're @mentioned anywhere.

JavaScript

(Click here to go back to the main list)

Example Description
Web Server Build a web server in Google Cloud.

Python

(Click here to go back to the main list)

Example Description
Functions - Raw Deploy two Google Cloud Functions implemented in Python and Go.
Functions Deploy a Python-based Google Cloud Function.
GKE Provision a Google Kubernetes Engine (GKE) cluster, then a Kubernetes Deployment.
Network Component Use a reusable component to create a Google Cloud Network and instance.
nginx Server Build a nginx server in Google Cloud.

Go

(Click here to go back to the main list)

Example Description
Functions Deploy a Go-based Google Cloud Function.
Functions - Raw Deploy a Google Cloud Function implemented in Python.
Web Server Build a web server in Google Cloud.

C#

(Click here to go back to the main list)

Example Description
Functions - Raw Deploy a Google Cloud Function implemented in Python.
Functions Deploy a Go-based Google Cloud Function.

Kubernetes

TypeScript

(Click here to go back to the main list)

Example Description
App Rollout via ConfigMap Enable a change in a ConfigMap to trigger a rollout of an nginx Deployment.
App Rollout via S3 Data Change Enable a change in data in S3 to trigger a rollout of an nginx deployment.
Expose Deployment Deploy nginx to a Kubernetes cluster, and publicly explose it using a Kubernetes Service.
Guestbook Build and deploy a simple, multi-tier web application using Kubernetes and Docker.
Jenkins Deploy a container running the Jenkins continuous integration system onto a running Kubernetes cluster.
Multicloud Create managed Kubernetes clusters using AKS, EKS, and GKE, and deploy the application on each cluster.
nginx server Deploy a replicated nginx server to a Kubernetes cluster, using TypeScript and no YAML.
Sock Shop Deploy a version of the standard Sock Shop microservices reference app.
Staged App Rollout Create a staged rollout gated by checking that the P90 response time reported by Prometheus is less than some amount.
Wordpress Helm Chart Use the Helm API to deploy v2.1.3 of the Wordpress Helm Chart to a Kubernetes cluster.

Python

(Click here to go back to the main list)

Example Description
Guestbook Build and deploy a simple, multi-tier web application using Kubernetes and Docker.

C#

(Click here to go back to the main list)

Example Description
Guestbook Build and deploy a simple, multi-tier web application using Kubernetes and Docker.

Go

(Click here to go back to the main list)

Example Description
Guestbook Build and deploy a simple, multi-tier web application using Kubernetes and Docker.
App Rollout via ConfigMap Enable a change in a ConfigMap to trigger a rollout of an nginx Deployment.
Wordpress Helm Chart Use the Helm API to deploy v9.6.0 of the Wordpress Helm Chart to a Kubernetes cluster.
Expose Deployment Deploy nginx to a Kubernetes cluster, and publicly expose it using a Kubernetes Service.

Openstack

Python

(Click here to go back to the main list)

Web Server | Deploy an Openstack instance and open port 8000.

OVHCloud

Go

Example Description
Kubernetes A sample to deploy a managed Kubernetes cluster on OVHcloud

Cloud

TypeScript

(Click here to go back to the main list)

Example Description
URL Shortener - Cache and HttpServer Create a simple URL shortener SPA that uses the high-level cloud.Table and cloud.HttpServer components.
URL Shortener - Cache Create a simple URL shortener SPA that uses the high-level cloud.Table and cloud.API components.
URL Shortener Create a complete URL shortener web application that uses the high-level cloud.Table and cloud.HttpServer components.
Voting App Create a simple voting app using Redis and Python Flask.

JavaScript

(Click here to go back to the main list)

Example Description
API on AWS Create a simple REST API that counts the number of times a route has been hit.
Containers Provision containers on Fargate.
HttpServer Create a simple REST API that counts the number of times a route has been hit.
Thumbnailer - Machine Learning Create a video thumbnail extractor using serverless functions, containers, and AWS Rekognition.
Thumbnailer Create a video thumbnail extractor using serverless functions and containers.
Twitter Query Twitter every 2 minutes, store the results in S3, and set up an Athena table and query.

DigitalOcean

TypeScript

(Click here to go back to the main list)

Example Description
Droplets Build sample architecture.
Kubernetes Provision a DigitalOcean Kubernetes cluster.

Python

(Click here to go back to the main list)

Example Description
Droplets Build sample architecture.
Kubernetes Provision a DigitalOcean Kubernetes cluster.

C#

(Click here to go back to the main list)

Example Description
Droplets Build sample architecture.
Kubernetes Provision a DigitalOcean Kubernetes cluster.

Multicloud

TypeScript

(Click here to go back to the main list)

Example Description
Buckets Use a single Pulumi program to provision resources in both AWS and GCP.

F5

TypeScript

(Click here to go back to the main list)

Example Description
BigIP Local Traffic Manager Provide load balancing via an F5 BigIP appliance to backend HTTP instances.

Twilio

TypeScript

(Click here to go back to the main list)

Example Description
Component Create a custom Component Resource to parse incoming messages from Twilio.

Linode

JavaScript

(Click here to go back to the main list)

Example Description
Web Server Build a web server on Linode.

Testing

(Click here to go back to the main list)

Example Description
Unit Tests in TypeScript Mock-based unit tests in TypeScript.
Unit Tests in Python Mock-based unit tests in Python.
Unit Tests in Go Mock-based unit tests in Go.
Unit Tests in C# Mock-based unit tests in C#.
Testing with Policies Tests based on Policy-as-Code in TypeScript.
Integration Testing in Go Deploy-check-destroy tests in Go.

Automation API

(Click here to go back to the main list)

Automation API Examples

Community and Social

Engage with our community to elevate your developer experience:

  • Join our online Pulumi Community on Slack - Interact with over 3K Pulumi developers for collaborative problem-solving and knowledge-sharing!
  • Join a Local Pulumi User Groups (PUGs)- Attend tech-packed meetups and hands-on virtual or in-person workshops.
  • Follow @PulumiCorp on X (Twitter) - Get real-time updates, technical insights, and sneak peeks into the latest features.
  • Subscribe to our YouTube Channel, PulumiTV - Learn about AI / ML essentials, launches, workshops, demos and more.
  • Follow our LinkedIn - Uncover company news, achievements, and behind-the-scenes glimpses.

Contributors

Meet the brilliant minds behind this project, view their profiles, and learn about their valuable contributions.

FAQs

How can I contribute to this repository?

We're glad you asked! Please visit our CONTRIBUTING doc for details.

How can I install the Pulumi CLI?

Visit our install page for installation steps.

Is Pulumi Cloud free?

Individual accounts are always free and allow unlimited resources. See our pricing page for other options.

Further Reading

Delve deeper into our project with additional resources:

  • Get Started with Pulumi: Deploy a simple application in AWS, Azure, Google Cloud, or Kubernetes using Pulumi.
  • Registry: Search for packages and learn about the supported resources you need. Install the package directly into your project, browse the API documentation, and start building.
  • Try Pulumi AI - Use natural-language prompts to generate Pulumi infrastructure-as-code programs in any language.
  • Documentation: Learn about Pulumi concepts, follow user guides, and consult the reference documentation.
  • Pulumi Blog - Stay in the loop with our latest tech announcements, insightful articles, and updates.

examples's People

Contributors

cnunciato avatar cyrusnajmabadi avatar daveremy avatar dependabot[bot] avatar ellismg avatar ericrudder avatar evanboyle avatar frassle avatar hausdorff avatar jaxxstorm avatar jetvova avatar jkisk avatar joeduffy avatar justinvp avatar lblackstone avatar lindydonna avatar lukehoban avatar metral avatar mikhailshilkov avatar mitchellgerdisch avatar mnlumi avatar pierskarsenbarg avatar spara avatar stack72 avatar t0yv0 avatar tgummerer avatar thomas11 avatar toriancrane avatar tusharshahrs avatar zephyrz73 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

Use of volumes in nginx example is confusing

The example declares a PV, nginxvolume, (see below) but:

  1. it looks like the name we're passing to kubernetes.PersistentVolume is "redis", while the .metadata.name field looks to be "nginxvolume". To me, this makes the intended use not very clear.
  2. I could be missing how Pulumi is juggling around the names, but to me nginxvolume doesn't look to be used, either in redis or nginx. redis seems to be using an emptyDir volume.
// Create an nginxvolume
let nginxvolume = new kubernetes.PersistentVolume("redis", {
    metadata: {
        name: "nginxvolume"
    },
    specs: [{
        capacity: {
            storage: "10Gi",
        },
        accessModes: ["ReadWriteMany"],
        persistentVolumeSource: {
            gcePersistentDisk: {
                pdName: "test-123",
            },
        },
    }],
});

Add end-to-end steps for examples in READMEs

Right now, our examples aren't necessarily self-describing in terms of how to get them to work. This would be really great to do, including what environments are supported -- at least one of our examples requires GCP, and I know most others require AWS -- and what configuration is needed. Basically, a step by step, starting from cloning, all the way to standing up a new instance, and then destroying.

Examples to fix (edited by Donna)

  • aws-py-webserver
  • kubernetes-ts-guestbook
  • cloud-ts-url-shortener-cache

Update examples to support `pulumi new`

The pulumi new command now supports installing templates from arbitrary Git URLs, as long as they have template metadata. We should update all (or most) of the examples to support pulumi new.

Consider adding a Datadog example

We helped add a Datadog agent to a customer's cluster, and wading through the information available on the internet was not terribly straightforward. This might make a nice example, especially since it's standalone and can be used even if nothing else is on Pulumi. It is loosely based on https://docs.datadoghq.com/integrations/amazon_ecs/. Here's a quick snapshot of the idea:

// Configure Datadog for the cluster.

import * as config from "./config";
import { cluster } from "./foundation";
import * as pulumi from "pulumi";
import * as aws from "@pulumi/aws";

const prefix = pulumi.getStack();

// Allocate a Datadog agent that runs on every host node.  Adapted from:
//     https://docs.datadoghq.com/integrations/amazon_ecs/
const datadogAgentTask = new aws.ecs.TaskDefinition(`${prefix}-datadog-agent-task`, {
    family: "dd-agent-task",
    containerDefinitions: JSON.stringify([{
        name: "dd-agent",
        image: "datadog/docker-dd-agent:latest",
        cpu: 10,
        memory: 256,
        essential: true,
        mountPoints: [
            {
              containerPath: "/var/run/docker.sock",
              sourceVolume: "docker_sock"
            },
            {
              containerPath: "/host/sys/fs/cgroup",
              sourceVolume: "cgroup",
              readOnly: true,
            },
            {
              containerPath: "/host/proc",
              sourceVolume: "proc",
              readOnly: true,
            }
        ],
        environment: [
            {
                name: "API_KEY",
                value: config.datadogKey,
            },
            {
                name: "SD_BACKEND",
                value: "docker",
            },
        ],
    }]),
    volume: [
        {
            name: "docker_sock",
            hostPath: "/var/run/docker.sock",
        },
        {
            name: "proc",
            hostPath: "/proc/",
        },
        {
            name: "cgroup",
            hostPath: "/cgroup/",
        }
    ],
});
const datadogAgent = new aws.ecs.Service(`${prefix}-datadog-agent`, {
    cluster: cluster.ecsClusterARN,
    taskDefinition: datadogAgentTask.arn,
    desiredCount: config.getClusterSize(),
    placementStrategy: [{ type: "spread", field: "instanceId" }],
    placementConstraints: [{ type: "distinctInstance" }],
});

// And now authorize Datadog to read all of the things that it needs to.
let datadogIntegrationRole = new aws.iam.Role(`${prefix}-datadog-role`, {
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Effect: "Allow",
            Condition: {
                StringEquals: {
                    "sts:ExternalId": config.datadogKey,
                },
            },
            Principal: {
                AWS: aws.getCallerIdentity().then(caller => `arn:aws:iam::${caller.accountId}:root`),
            },
        }],
    }),
});

let datadogIntegrationPolicy = new aws.iam.RolePolicy(`${prefix}-datadog-policy`, {
    role: datadogIntegrationRole.name,
    policy: JSON.stringify({
        Version: "2012-10-17",
        Statement: {
            Effect: "Allow",
            Resource: "*",
            Action: [
                "autoscaling:Describe*",
                "cloudtrail:DescribeTrails",
                "cloudtrail:GetTrailStatus",
                "cloudwatch:Describe*",
                "cloudwatch:Get*",
                "cloudwatch:List*",
                "ec2:Describe*",
                "ec2:Get*",
                "ecs:Describe*",
                "ecs:List*",
                "elasticache:Describe*",
                "elasticache:List*",
                "elasticloadbalancing:Describe*",
                "elasticmapreduce:List*",
                "iam:Get*",
                "iam:List*",
                "kinesis:Get*",
                "kinesis:List*",
                "kinesis:Describe*",
                "logs:Get*",
                "logs:Describe*",
                "logs:TestMetricFilter",
                "rds:Describe*",
                "rds:List*",
                "route53:List*",
                "ses:Get*",
                "ses:List*",
                "sns:List*",
                "sns:Publish",
                "sqs:GetQueueAttributes",
                "sqs:ListQueues",
                "sqs:ReceiveMessage",
            ],
        },
    }),
});

We could probably wrap this up in a single class and make it as easy as

new Datadog(ecsARN);

to configure.

The kubernetes-ts-guestbook example never progress.. (Local deployment)

The LoadBalancer does not seems to work out as expected locally even with Kubernetes on Docker, it times out waiting for the front-end.
The documentation is misleading in that regard.
Also would be nice, if you know why/how to make it work locally, to explain how.

Using ClusterIP fixed it.

Also the comment in the code looks truncated.
https://github.com/pulumi/examples/blob/master/kubernetes-ts-guestbook/index.ts#L111

I've tested successfully the sock-shop.

Create a sample that demonstrates how to use ParameterStore

Customer contacted us on slack with questions about how to properly do secrets, and how they would like to use ParameterStore to acquire that stuff at runtime. It would likely be useful for many customers who use this system as per AWS's best practices recommendations.

cloud-ts-url-shortener-cache-http example not returning valid payload

Follow the readme steps for cloud-ts-url-shortener-cache-http. When curling the endpoint an unexpected payload is returned (expecting real web page).

$ curl $(pulumi stack output endpointUrl)
{"uncaught":{"url":"/index.html","baseUrl":"","originalUrl":"/index.html","version":"v8.10.0"}}

gcp-ts-gke example failed with Error 403: Required "container.clusters.create" permission(s)

I am following steps in the gcp-ts-gke example to create a GKE cluster via pulumi.

At pulumi up, I got stuck with the following error, complaining missing "container.clusters.create" permission(s) to my project:

% pulumi up
Previewing update of stack 'gcp-ts-gke-dev'
Enter your passphrase to unlock config/secrets
    (set PULUMI_CONFIG_PASSPHRASE to remember):
Previewing changes:

     Type                            Name                       Plan          Info
 *   pulumi:pulumi:Stack             gcp-ts-gke-gcp-ts-gke-dev  no change
 +   ├─ gcp:container:Cluster        gke-cluster                create
 +   ├─ pulumi:providers:kubernetes  gkeK8s                     create
 +   └─ kubernetes:apps:Deployment   canary                     create

info: 3 changes previewed:
    + 3 resources to create
      1 resource unchanged

Do you want to perform this update? yes
Updating stack 'gcp-ts-gke-dev'
Enter your passphrase to unlock config/secrets
    (set PULUMI_CONFIG_PASSPHRASE to remember):
Performing changes:

     Type                      Name                       Status                  Info
 *   pulumi:pulumi:Stack       gcp-ts-gke-gcp-ts-gke-dev  done
 +   └─ gcp:container:Cluster  gke-cluster                **creating failed**     1 error

Diagnostics:
  gcp:container:Cluster: gke-cluster
    error: Plan apply failed: googleapi: Error 403: Required "container.clusters.create" permission(s) for "projects/XXX"., forbidden

info: no changes required:
      1 resource unchanged

What did I miss? However, I can successfully create a cluster directly via gcloud CLI:

%  gcloud container clusters create my_cluster --zone us-west1-c --scopes storage-rw --machine-type n1-standard-2

Guestbook example doesn't work

Deploying kubernetes-ts-guestbook fails with:

 error: Unable to fetch schema: ValidationError(Service.spec.selector): invalid type for io.k8s.api.core.v1.ServiceSpec.selector: got "array", expected "map"

This was not triggering a TypeScript error due to pulumi/pulumi-kubernetes#98.

Update examples for 0.12.0 SDK

Make the following changes for each example:

  • In readme, remove pulumi init
  • In readme, remove pulumi preview
  • Update to 0.12.0 packages and test

`aws-go-s3-folder` example doesn't show stack outputs

When running pulumi up the stack outputs are not shown:

$ pulumi up
Previewing update of stack 'website-dev'
Previewing changes:

     Type                     Name                 Plan       Info
 +   pulumi:pulumi:Stack      website-website-dev  create     
 +   ├─ pulumi:providers:aws  default              create     
 +   ├─ aws:s3:Bucket         s3-website-bucket    create     
 +   ├─ aws:s3:BucketPolicy   bucketPolicy         create     
 +   ├─ aws:s3:BucketObject   www/index.html       create     
 +   └─ aws:s3:BucketObject   www/favicon.png      create     
 
info: 5 changes previewed:
    + 5 resources to create

Do you want to perform this update? yes
Updating stack 'website-dev'
Performing changes:

     Type                    Name                 Status      Info
 +   pulumi:pulumi:Stack     website-website-dev  created     
 +   ├─ aws:s3:Bucket        s3-website-bucket    created     
 +   ├─ aws:s3:BucketPolicy  bucketPolicy         created     
 +   ├─ aws:s3:BucketObject  www/index.html       created     
 +   └─ aws:s3:BucketObject  www/favicon.png      created     
 
info: 5 changes performed:
    + 5 resources created
Update duration: 7.633434765s

Permalink: https://app.pulumi.com/***

Also, when running pulumi stack it says "No output values currently in this stack":

$ pulumi stack

[...]

Current stack resources (6):
    TYPE                                             NAME
    pulumi:pulumi:Stack                              website-website-dev
    pulumi:providers:aws                             default
    aws:s3/bucket:Bucket                             s3-website-bucket
    aws:s3/bucketPolicy:BucketPolicy                 bucketPolicy
    aws:s3/bucketObject:BucketObject                 www/index.html
    aws:s3/bucketObject:BucketObject                 www/favicon.png

Current stack outputs (0):
    No output values currently in this stack

I'm not sure if it's a bug in our go support or bug in the example.

AKS helm example error referencing apache resource

The AKS helm example tries to export the service IP using the following code:

export let serviceIP =
    (apache.resources["v1/Service::default/apache-apache"] as k8s.core.v1.Service).
        spec.apply(s => s.clusterIP);

This threw an error during preview as apache.resources["v1/Service::default/apache-apache"] was returning undefined. Once I removed the namespace 'default' from the key it worked ok and I got the correct output. Before I submit a PR to remove it, I wanted to check this issue repro'd with others.

Add a GCP example

We should add one of fhs GCP examples to this repo, along with a README with instructions.

[Examples] Example packages are out of date

For instance, in aws-js-webserver:

{
    "name": "webserver",
    "version": "0.1.0",
    "main": "index.js",
    "dependencies": {
        "@pulumi/pulumi": "^0.12.0",
        "@pulumi/aws": "^0.12.0"
    }
}

We should bump everything so folks are on the latest providers.

I noticed this because misconfigured AWS creds gave me the old, terrible error message.

Add an Azure example

Add at least one Azure example - probably a variant of webserver targeting Azure.

Make the Kubernetes guestbook as beautiful as possible

We know there are some opportunities for making the Kubernetes guestbook even more beautiful than it is, thanks to using real languages. We have deployContainer but there are more "KubeJS Lite" opportunities. Let's make sure to land those before our upcoming launches.

Assigning to you, @lukehoban, feel free to reassign as appropriate.

Add test coverage of examples

We would like to have some automated testing in place to ensure that all examples can successfully build and deploy as we update examples and make updates to the Pulumi packages and CLI that examples depend on.

Add 1-2 more interesting Kubernetes examples

Highlight realworld usage of some of the new capabilities:

  1. Helm and/or Kubernetes YAML deployments
  2. Deployment orchestration (rolling update of configmap+deployment, canary+monitoring staged deployment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.