/automation-api-examples

Examples for the Pulumi Automation API https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/auto?tab=doc

Primary LanguageGo

automation-api-examples

This repo provides full end to end examples and walk-throughs for the Pulumi Automation API. The Automation API is available for Go, Node.js, Python and C#.

Full docs for automation API can be found here:

Content

Take a look at our examples grouped by language.

Go Examples

Example Description
Git Repo Use Automation API with a Pulumi program from a git repo. In this case a static S3 website from the Pulumi examples repo.
Inline Program Use Automation API with an inline Pulumi program. Inline programs are self contained in a single main.go and support full debugging capabilities. In this demo we deploy the same static S3 website adapted from the Pulumi examples repo.
Local Program This example shows how to use Automation API with an existing traditional CLI-driven Pulumi program. We add an Automation API deployment program to our Fargate program that deploys a web service via a Fargate task behind a load balancer.
Inline/Local Hybrid Program This example shows how to refactor your infrastructure to get the best of both worlds, a debuggable inline program that can still be driven by the Pulumi CLI for convenience (one-off deployments, inspecting the stack, retrieving outputs, etc). In this example we deploy an S3 static website. The automation/main.go is fully debuggable, including the shared deployment function. The stack can also be managed via the CLI program in cli/main.go.
Multi-Stack Orchestration This example shows how to use Automation API to tame the complexity of multiple stacks with dependent stack outputs. We decompose our S3 static website into two stacks, one that manages the bucket, and another that manages the index.html file. Both of these are defined as inline programs, and are deployed and destroyed together via a single main.go
Pulumi Over HTTP - Infra as RESTful resources This application demonstrates how to run Automation API in an HTTP server to expose infrastructure as RESTful resources. In our case, we've defined and exposed a static website site that exposes all of the CRUD operations plus list. Users can hit our REST endpoint and create custom static websites by specifying the content field in the POST body. All of our infrastructure is defined in inline programs that are constructed and altered on the fly based on input parsed from user-specified POST bodies.
Database Migration This example provisions an AWS Aurora SQL database and executes a database "migration" using the resulting connection info. This migration creates a table, inserts a few rows of data, and reads the data back to verify the setup. This is all done in a single program using an inline Pulumi program. With Automation API you can orchestrate complex workflows that go beyond infrastructure provisioning and into application management, database setup, etc.
Cloud-backed Secret Provider This example demonstrates an inline program using a cloud-backed (KMS) secret provider.
Passphrase Secret Provider This example demonstrates an inline program using a passphrase secret provider.
Remote Deployment This example demonstrates how to use Automation API to run Pulumi programs remotely with Pulumi Deployments. In this case a static S3 website from the Pulumi examples repo.

Node.js Examples

Example Toolchain Description
Inline Program Typescript + ts-node Use Automation API with an inline Pulumi program. Inline programs are self-contained in a single index.ts and support full debugging capabilities. In this demo we deploy the same static S3 website adapted from the Pulumi examples repo. This example uses typescript with ts-node as an execution environment.
Inline Program Typescript (tsc) + node Use Automation API with an inline Pulumi program. Inline programs are self-contained in a single index.ts and support full debugging capabilities. In this demo we deploy the same static S3 website adapted from the Pulumi examples repo. This example uses typescript compiled into javascript via tsc and executed via node.
Inline Program Javascript + node Use Automation API with an inline Pulumi program. Inline programs are self-contained in a single index.js and support full debugging capabilities. In this demo we deploy the same static S3 website adapted from the Pulumi examples repo. This example uses plain javascript executed via node.
Local Program Typescript + ts-node This example shows how to use Automation API with an existing traditional CLI-driven Pulumi program. We add an Automation API deployment program to our existing CLI-driven S3 website program. This example uses typescript with ts-node as an execution environment.
Cross-Language Program Typescript + ts-node This example shows how to use Automation API in typescript with an existing traditional CLI-driven Pulumi program written in a different language, in this case go. We add an Automation API deployment program to our Fargate program that deploys a web service via a Fargate task behind a load balancer. This automation program uses typescript with ts-node as an execution environment.
Pulumi Over HTTP - Infra as RESTful resources Typescript (tsc) + node This application demonstrates how to run Automation API in an HTTP server to expose infrastructure as RESTful resources. In our case, we've defined and exposed a static website site that exposes all of the CRUD operations plus list. Users can hit our REST endpoint and create custom static websites by specifying the content field in the POST body. All of our infrastructure is defined in inline programs that are constructed and altered on the fly based on input parsed from user specified POST bodies.
Database Migration Typescript (tsc) + node This example provisions an AWS Aurora SQL database and executes a database "migration" using the resulting connection info. This migration creates a table, inserts a few rows of data, and reads the data back to verify the setup. This is all done in a single program using an inline Pulumi program. With Automation API you can orchestrate complex workflows that go beyond infrastructure provisioning and into application management, database setup, etc.
Local Program with mocha tests Typescript + ts-node This example shows how to use Automation API with an existing traditional CLI-driven Pulumi program alongside some mocha-based integration tests to ensure that the infrastructure was set up properly. This example uses typescript with ts-node as an execution environment, with mocha being used to run the tests.
Remote Deployment Typescript + ts-node This example demonstrates how to use Automation API to run Pulumi programs remotely with Pulumi Deployments. In this case a static S3 website from the Pulumi examples repo.

Python Examples

Example Description
Inline Program Use Automation API with an inline Pulumi program. Inline programs are self contained in a single main.py and support full debugging capabilities. In this demo we deploy the same static S3 website adapted from the Pulumi examples repo.
Cross-Language Program This example shows how to use Automation API in python with an existing traditional CLI-driven Pulumi program written in a different language, in this case go. We add an Automation API deployment program to our Fargate program that deploys a web service via a Fargate task behind a load balancer.
Database Migration This example provisions an AWS Aurora SQL database and executes a database "migration" using the resulting connection info. This migration creates a table, inserts a few rows of data, and reads the data back to verify the setup. This is all done in a single program using an inline Pulumi program. With Automation API you can orchestrate complex workflows that go beyond infrastructure provisioning and into application management, database setup, etc.
Local Program This example shows how to use Automation API with an existing traditional CLI-driven Pulumi program. We add an Automation API deployment program to our existing CLI-driven app described in the aws-py-voting-app example.
Pulumi Over HTTP - Infra as RESTful resources This application demonstrates how to run Automation API in an HTTP server to expose infrastructure as RESTful resources. In our case, we've defined and exposed a static website site that exposes all of the CRUD operations plus list. Users can hit our REST endpoint and create custom static websites by specifying the content field in the POST body. All of our infrastructure is defined in inline programs that are constructed and altered on the fly based on input parsed from user specified POST bodies.
Pulumi Via Jupyter This example explores running Pulumi through a Jupyter Notebook.
Remote Deployment This example demonstrates how to use Automation API to run Pulumi programs remotely with Pulumi Deployments. In this case a static S3 website from the Pulumi examples repo.

.NET Examples

Example Description
Inline Program Use Automation API with an inline Pulumi program. Inline programs are self contained in a .NET console application and support full debugging capabilities. In this demo we deploy the same static S3 website adapted from the Pulumi examples repo.
Local Program This example shows how to use Automation API with an existing traditional CLI-driven Pulumi program. We add an Automation API deployment program to our existing CLI-driven S3 website program.
Cross-Language Program This example shows how to use Automation API in dotnet with an existing traditional CLI-driven Pulumi program written in a different language, in this case go. We add an Automation API deployment program to our Fargate program that deploys a web service via a Fargate task behind a load balancer.
Database Migration This example provisions an AWS Aurora SQL database and executes a database "migration" using the resulting connection info. This migration creates a table, inserts a few rows of data, and reads the data back to verify the setup. This is all done in a single program using an inline Pulumi program. With Automation API you can orchestrate complex workflows that go beyond infrastructure provisioning and into application management, database setup, etc.
Remote Deployment This example demonstrates how to use Automation API to run Pulumi programs remotely with Pulumi Deployments. In this case a static S3 website from the Pulumi examples repo.

Other projects using Automation API

Project Description
Ploy Ploy is a CLI used to deploy a local Docker image to an EKS cluster.
Halloumi Pulumi + Heroku = Halloumi. You write your application, we run it in the cloud.
Self Service Platyform A webapp skeleton for building your own Infrastructure Platform using Python and Flask.

If you have a project using Automation API that you'd like to showcase here please submit a PR!