Pulumi Examples
This repository contains examples of using Pulumi to build and deploy cloud applications and infrastructure.
Each example has a two-part prefix, <cloud>-<language>
, to indicate which <cloud>
and <language>
it pertains to.
For example, <cloud>
could be aws
for Amazon Web Services , azure
for Microsoft
Azure , gcp
for Google Cloud
Platform , kubernetes
for
Kubernetes , or cloud
for
Pulumi's cross-cloud programming framework .
See the Pulumi documentation for more details on getting started with Pulumi.
Outline
AWS
Typescript
Example
Description
API Gateway
Deploy a simple REST API that counts the number of times a route has been hit.
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.
Miniflux
Stand up an RSS Service using Fargate and RDS.
Pulumi Webhooks
Create a Pulumi cloud.HttpEndpoint
that receives webhook events delivered by the Pulumi Service, 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 with Manual Provisioning
Use Pulumi dynamic providers to accomplish post-provisioning configuration steps.
Javascript
Python
Example
Description
AppSync
Deploy a basic GraphQL endpoint in AWS AppSync.
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.
Go
Example
Description
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.
C#
Example
Description
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.
Web Server
Deploy an EC2 instance and open port 80.
F#
Example
Description
Lambda Web Server
Create a web server in AWS lambda using the Giraffe web server.
Azure
Typescript
Example
Description
AKS - Helm
Create an Azure Kubernetes Service (AKS) Cluster and deploy a Helm Chart into it.
AKS - KEDA
Create an Azure Kubernetes Service (AKS) Cluster and deploy an Azure Function App with Kubernetes-based Event Driven Autoscaling (KEDA) into it.
AKS - Mean
Stand up an Azure Kubernetes Service (AKS) Cluster and a MongoDB-flavored instance of CosmosDB.
AKS - Multicluster
Create multiple Azure Kubernetes Service (AKS) Clusters in different regions and with different node counts.
API Management
Deploy an instance of Azure API Management.
App Service - DevOps
Deploy a Todo App using App Service with SQL Database and integrated with DevOps.
App Service - Docker
Build a web application hosted in App Service from Docker images.
App Service - Spring Boot
Deploy a Spring Boot app to an App Service instance using Jenkins.
App Service
Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
ARM Template
Deploy an existing Azure Resource Manager (ARM) template.
CosmosApp Component
Use a reusable component to create globally-distributed applications with Azure Cosmos DB.
CosmosDB LogicApp
Use Azure Resource Manager (ARM) templates to create an API Connection and a Logic App.
Dynamic Resource
Add a custom domain to a CDN endpoint.
Functions - Raw
Deploy functions in all supported languages to Azure Functions.
Functions
Deploy a typescript function to Azure Functions.
HDInsight Spark
Deploy a Spark cluster on Azure HDInsight.
MSI KeyVault RBAC
Use a managed identity with Azure App Service to access Azure KeyVault, Azure Storage, and Azure SQL Database without passwords or secrets.
Static Website
Configure static website hosting in Azure Storage.
Stream Analytics
Deploy an Azure Stream Analytics job to transform data in an Event Hub.
URL Shortener
Create a globally-distributed serverless URL shortener using Azure Functions and Cosmos DB.
VM Scaleset
Provision a Scale Set of Linux web servers with nginx deployed, auto-scaling based on CPU load, a Load Balancer in front of them, and a public IP address.
Web Server Component
Provision a configurable number of Linux web servers in an Azure Virtual Machine using a reusable component.
Web Server
Provision a Linux web server in an Azure Virtual Machine.
Javascript
Example
Description
Web Server
Build the Pulumi web server sample in Azure.
Python
Example
Description
AKS - Multicluster
Create multiple AKS clusters in different regions and with different node counts.
AKS
Deploy an AKS cluster, virtual network and Azure Container Registry and grant AKS permissions to access and manage those.
App Service - Docker
Build a web application hosted in App Service from Docker images.
App Service
Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Functions - Raw
Deploy a function to Azure Functions created from raw deployment packages in C#.
HDInsight Spark
Deploy a Spark cluster on Azure HDInsight.
MSI Key Vault RBAC
Use a managed identity with Azure App Service to access Azure KeyVault, Azure Storage, and Azure SQL Database without passwords or secrets.
VM Scale Set
Provision a Scale Set of Linux web servers with nginx deployed, auto-scaling based on CPU load, a Load Balancer in front of them, and a public IP address.
Web Server Component
Deploy a Virtual Machine and start an HTTP server on it using a reusable component.
Web Server
Deploy a Virtual Machine and start an HTTP server on it.
Go
Example
Description
App Service
Build a web application hosted in Azure App Service.
Web Server Component
Provision a configurable number of Linux web servers in an Azure Virtual Machine using a reusable component.
C#
Example
Description
AKS
Stand up an Azure Kubernetes Service (AKS) cluster.
AKS and Private Container Registry
Stand up an Azure Kubernetes Service (AKS) cluster, a private Azure Container Registry, and deploys an image to the cluster.
App Service
Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Bot Service
Build an Azure Bot Service hosted in Azure App Service.
Cosmos App Component
Use a reusable component to create globally-distributed applications with Azure Cosmos DB.
Functions - Raw
Deploy a function to Azure Functions created from raw deployment packages in C#.
MSI Key Vault RBAC
Use a managed identity with Azure App Service to access Azure KeyVault, Azure Storage, and Azure SQL Database without passwords or secrets.
Static Website
Deploy a Static Website to Azure Storage.
Web Server
Deploy a Virtual Machine and start an HTTP server on it.
F#
Example
Description
AKS
Stand up an Azure Kubernetes Service (AKS) cluster.
App Service
Build a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
GCP
Typescript
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
Example
Description
Web Server
Build a web server in Google Cloud.
Python
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
Example
Description
Functions
Deploy a Go-based Google Cloud Function.
Functions - Raw
Deploy a Google Cloud Function implemented in Python.
C#
Example
Description
Functions - Raw
Deploy a Google Cloud Function implemented in Python.
Functions
Deploy a Go-based Google Cloud Function.
Kubernetes
Typescript
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
Example
Description
Guestbook
Build and deploy a simple, multi-tier web application using Kubernetes and Docker.
C#
Example
Description
Guestbook
Build and deploy a simple, multi-tier web application using Kubernetes and Docker.
Cloud
Typescript
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
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
Example
Description
Droplets
Build sample architecture.
Kubernetes
Provision a DigitalOcean Kubernetes cluster.
Python
Example
Description
Droplets
Build sample architecture.
Kubernetes
Provision a DigitalOcean Kubernetes cluster.
C#
Example
Description
Droplets
Build sample architecture.
Kubernetes
Provision a DigitalOcean Kubernetes cluster.
Multicloud
Typescript
Example
Description
Buckets
Use a single Pulumi program to provision resources in both AWS and GCP.
F5
Typescript
Twilio
Typescript
Example
Description
Component
Create a custom Component Resource to parse incoming messages from Twilio.
Linode
Javascript
Example
Description
Web Server
Build a web server on Linode.
Packet
Typescript
Example
Description
Web Server
Build a web server on Packet.net.
Python
Example
Description
Web Server
Build a web server on Packet.net.
Testing