Skip to content

Latest commit

History

735 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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

ExampleDescription
API GatewayDeploy a simple REST API that counts the number of times a route has been hit.
Apigateway - Auth0Deploy a simple REST API protected by Auth0.
AppSyncDeploy a basic GraphQL endpoint in AWS AppSync.
AssumeRoleUse AssumeRole to create resources.
ContainersProvision containers on Fargate.
EKS - DashboardDeploy an EKS Kubernetes cluster with an EBS-backed StorageClass, then the Kubernetes Dashboard into the cluster.
EKS - Hello WorldDeploy an EKS Kubernetes cluster with an EBS-backed StorageClass, then a Kubernetes namespace and nginx deployment into the cluster.
EKS - Migrate Node GroupsCreate an EKS cluster and node group to use for workload migration with zero downtime.
FargateBuild, deploy, and run a Dockerized app using ECS, ECR, and Fargate.
MinifluxStand up an RSS Service using Fargate and RDS.
Pulumi WebhooksCreate a Pulumi cloud.HttpEndpoint that receives webhook events delivered by the Pulumi Service, then echos the event to Slack.
RDS and AirflowDeploy a RDS Postgres instance and containerized Airflow.
ResourcesCreate various resources, including cloudwatch.Dashboard, cloudwatch.EventRule, cloudwatch.LogGroup, and sqs.Queue.
Ruby on RailsCreate a single EC2 virtual machine instance with a local MySQL database.
S3 LambdaSet 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 ApplicationDeploy a complete serverless C# application using raw resources from @pulumi/aws.
Serverless DatawarehouseDeploy a serverless data warehouse.
SlackbotCreate a simple slackbot that posts a notification to a specific channel any time you're @mentioned anywhere.
Stack ReferenceCreate a "team" EC2 Instance with tags set from upstream stacks.
Static WebsiteServe a static website using S3, CloudFront, Route53, and Certificate Manager.
Step FunctionsUse Step Functions with a Lambda function.
ThumbnailerCreate a video thumbnail extractor using serverless functions and containers.
TwitterQuery Twitter every 2 minutes, store the results in S3, and set up an Athena table and query.
URL ShortenerCreate a serverless URL shortener that uses high-level components.
Voting AppCreate a simple voting app using Redis and Python Flask.
Web Server with Manual ProvisioningUse Pulumi dynamic providers to accomplish post-provisioning configuration steps.

JavaScript

ExampleDescription
ContainersProvision containers on Fargate.
S3 Folder ComponentServe a static website on S3 from a component.
S3 FolderServe a static website on S3.
Servless SQS to SlackWire up a serverless AWS Lambda to an AWS SQS queue and post a message to Slack.
Web Server - ComponentDeploy an EC2 instance using a common module for creating an instance.
Web ServerDeploy an EC2 Virtual machine running a Python web server.

Python

ExampleDescription
AppSyncDeploy a basic GraphQL endpoint in AWS AppSync.
FargateProvision a full ECS Fargate cluster running a load-balanced nginx web server.
ResourcesCreate various resources, including cloudwatch.Dashboard, cloudwatch.EventRule, cloudwatch.LogGroup, and sqs.Queue.
S3 FolderServe a static website on S3.
Stack ReferenceCreate a "team" EC2 Instance with tags set from upstream stacks.
Step FunctionsUse Step Functions with a Lambda function.
Web ServerDeploy an EC2 instance and open port 80.

Go

ExampleDescription
FargateProvision a full ECS Fargate cluster running a load-balanced nginx web server.
LambdaCreate a lambda that does a simple ToUpper on the string input and returns it.
S3 FolderServe a static website on S3.
Web ServerDeploy an EC2 Virtual machine running a Python web server.

C#

ExampleDescription
FargateBuild, deploy, and run a Dockerized app using ECS, ECR, and Fargate.
LambdaCreate a lambda that does a simple ToUpper on the string input and returns it.
Web ServerDeploy an EC2 instance and open port 80.

F#

ExampleDescription
Lambda Web ServerCreate a web server in AWS lambda using the Giraffe web server.

Azure

TypeScript

ExampleDescription
AKS - HelmCreate an Azure Kubernetes Service (AKS) Cluster and deploy a Helm Chart into it.
AKS - KEDACreate an Azure Kubernetes Service (AKS) Cluster and deploy an Azure Function App with Kubernetes-based Event Driven Autoscaling (KEDA) into it.
AKS - MeanStand up an Azure Kubernetes Service (AKS) Cluster and a MongoDB-flavored instance of CosmosDB.
AKS - MulticlusterCreate multiple Azure Kubernetes Service (AKS) Clusters in different regions and with different node counts.
API ManagementDeploy an instance of Azure API Management.
App Service - DevOpsDeploy a Todo App using App Service with SQL Database and integrated with DevOps.
App Service - DockerBuild a web application hosted in App Service from Docker images.
App Service - Spring BootDeploy a Spring Boot app to an App Service instance using Jenkins.
App ServiceBuild a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
ARM TemplateDeploy an existing Azure Resource Manager (ARM) template.
CosmosApp ComponentUse a reusable component to create globally-distributed applications with Azure Cosmos DB.
CosmosDB LogicAppUse Azure Resource Manager (ARM) templates to create an API Connection and a Logic App.
Dynamic ResourceAdd a custom domain to a CDN endpoint.
Functions - RawDeploy functions in all supported languages to Azure Functions.
FunctionsDeploy a typescript function to Azure Functions.
HDInsight SparkDeploy a Spark cluster on Azure HDInsight.
MSI KeyVault RBACUse a managed identity with Azure App Service to access Azure KeyVault, Azure Storage, and Azure SQL Database without passwords or secrets.
Static WebsiteConfigure static website hosting in Azure Storage.
Stream AnalyticsDeploy an Azure Stream Analytics job to transform data in an Event Hub.
URL ShortenerCreate a globally-distributed serverless URL shortener using Azure Functions and Cosmos DB.
VM ScalesetProvision 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 ComponentProvision a configurable number of Linux web servers in an Azure Virtual Machine using a reusable component.
Web ServerProvision a Linux web server in an Azure Virtual Machine.

JavaScript

ExampleDescription
Web ServerBuild the Pulumi web server sample in Azure.

Python

ExampleDescription
AKS - MulticlusterCreate multiple AKS clusters in different regions and with different node counts.
AKSDeploy an AKS cluster, virtual network and Azure Container Registry and grant AKS permissions to access and manage those.
App Service - DockerBuild a web application hosted in App Service from Docker images.
App ServiceBuild a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Functions - RawDeploy a function to Azure Functions created from raw deployment packages in C#.
HDInsight SparkDeploy a Spark cluster on Azure HDInsight.
MSI Key Vault RBACUse a managed identity with Azure App Service to access Azure KeyVault, Azure Storage, and Azure SQL Database without passwords or secrets.
Virtual Data CenterDeploy peered hub-and-spoke networks in paired regions complete with gateways, firewalls and custom routing to redirect traffic through the firewalls.
VM Scale SetProvision 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 ComponentDeploy a Virtual Machine and start an HTTP server on it using a reusable component.
Web ServerDeploy a Virtual Machine and start an HTTP server on it.

Go

ExampleDescription
App ServiceBuild a web application hosted in Azure App Service.
Web Server ComponentProvision a configurable number of Linux web servers in an Azure Virtual Machine using a reusable component.

C#

ExampleDescription
AKSStand up an Azure Kubernetes Service (AKS) cluster.
AKS and Private Container RegistryStand up an Azure Kubernetes Service (AKS) cluster, a private Azure Container Registry, and deploys an image to the cluster.
App ServiceBuild a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.
Bot ServiceBuild an Azure Bot Service hosted in Azure App Service.
Cosmos App ComponentUse a reusable component to create globally-distributed applications with Azure Cosmos DB.
Functions - .NET on ConsumptionDeploy a .NET Azure Function running on a Windows Consumption Plan.
Functions - Python on Linux App ServiceDeploy a Python Azure Function running on a Linux App Service Premium Plan.
MSI Key Vault RBACUse a managed identity with Azure App Service to access Azure KeyVault, Azure Storage, and Azure SQL Database without passwords or secrets.
Static WebsiteDeploy a Static Website to Azure Storage.
Web ServerDeploy a Virtual Machine and start an HTTP server on it.

F#

ExampleDescription
AKSStand up an Azure Kubernetes Service (AKS) cluster.
App ServiceBuild a web application hosted in App Service and provision Azure SQL Database and Azure Application Insights.

GCP

TypeScript

ExampleDescription
Cloud RunDeploy a custom Docker image into Google Cloud Run service.
Functions - RawDeploy two Google Cloud Functions implemented in Python and Go.
FunctionsDeploy an HTTP Google Cloud Function endpoint.
GKE - Hello WorldDeploy a GKE cluster, then a Kubernetes namespace and nginx deployment into the cluster.
GKEProvision a Google Kubernetes Engine (GKE) cluster, then a Kubernetes Deployment.
Ruby on RailsDeliver a containerized Ruby on Rails application.
SlackbotCreate a simple slackbot that posts a notification to a specific channel any time you're @mentioned anywhere.

JavaScript

ExampleDescription
Web ServerBuild a web server in Google Cloud.

Python

ExampleDescription
Functions - RawDeploy two Google Cloud Functions implemented in Python and Go.
FunctionsDeploy a Python-based Google Cloud Function.
GKEProvision a Google Kubernetes Engine (GKE) cluster, then a Kubernetes Deployment.
Network ComponentUse a reusable component to create a Google Cloud Network and instance.
nginx ServerBuild a nginx server in Google Cloud.

Go

ExampleDescription
FunctionsDeploy a Go-based Google Cloud Function.
Functions - RawDeploy a Google Cloud Function implemented in Python.

C#

ExampleDescription
Functions - RawDeploy a Google Cloud Function implemented in Python.
FunctionsDeploy a Go-based Google Cloud Function.

Kubernetes

TypeScript

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

Python

ExampleDescription
GuestbookBuild and deploy a simple, multi-tier web application using Kubernetes and Docker.

C#

ExampleDescription
GuestbookBuild and deploy a simple, multi-tier web application using Kubernetes and Docker.

Go

ExampleDescription
GuestbookBuild and deploy a simple, multi-tier web application using Kubernetes and Docker.

Cloud

TypeScript

ExampleDescription
URL Shortener - Cache and HttpServerCreate a simple URL shortener SPA that uses the high-level cloud.Table and cloud.HttpServer components.
URL Shortener - CacheCreate a simple URL shortener SPA that uses the high-level cloud.Table and cloud.API components.
URL ShortenerCreate a complete URL shortener web application that uses the high-level cloud.Table and cloud.HttpServer components.
Voting AppCreate a simple voting app using Redis and Python Flask.

JavaScript

ExampleDescription
API on AWSCreate a simple REST API that counts the number of times a route has been hit.
ContainersProvision containers on Fargate.
HttpServerCreate a simple REST API that counts the number of times a route has been hit.
Thumbnailer - Machine LearningCreate a video thumbnail extractor using serverless functions, containers, and AWS Rekognition.
ThumbnailerCreate a video thumbnail extractor using serverless functions and containers.
TwitterQuery Twitter every 2 minutes, store the results in S3, and set up an Athena table and query.

DigitalOcean

TypeScript

ExampleDescription
DropletsBuild sample architecture.
KubernetesProvision a DigitalOcean Kubernetes cluster.

Python

ExampleDescription
DropletsBuild sample architecture.
KubernetesProvision a DigitalOcean Kubernetes cluster.

C#

ExampleDescription
DropletsBuild sample architecture.
KubernetesProvision a DigitalOcean Kubernetes cluster.

Multicloud

TypeScript

ExampleDescription
BucketsUse a single Pulumi program to provision resources in both AWS and GCP.

F5

TypeScript

ExampleDescription
BigIP Local Traffic ManagerProvide load balancing via an F5 BigIP appliance to backend HTTP instances.

Twilio

TypeScript

ExampleDescription
ComponentCreate a custom Component Resource to parse incoming messages from Twilio.

Linode

JavaScript

ExampleDescription
Web ServerBuild a web server on Linode.

Packet

TypeScript

ExampleDescription
Web ServerBuild a web server on Packet.net.

Python

ExampleDescription
Web ServerBuild a web server on Packet.net.

Testing

ExampleDescription
Unit Tests in TypeScriptMock-based unit tests in TypeScript.
Unit Tests in PythonMock-based unit tests in Python.
Unit Tests in GoMock-based unit tests in Go.
Unit Tests in C#Mock-based unit tests in C#.
Testing with PoliciesTests based on Policy-as-Code in TypeScript.
Integration Testing in GoDeploy-check-destroy tests in Go.

About

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

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages