Back to articles
Pulumi Has a Free Automation API That Replaces Your Shell Scripts
How-ToDevOps

Pulumi Has a Free Automation API That Replaces Your Shell Scripts

via Dev.to DevOpsAlex Spinov

Pulumi's Automation API lets you embed infrastructure-as-code directly inside your applications. Define, deploy, and destroy cloud resources programmatically from TypeScript, Python, Go, or C#. What Is the Automation API? Instead of running pulumi up from the terminal, you call it from code: import { LocalWorkspace } from " @pulumi/pulumi/automation " ; const stack = await LocalWorkspace . createOrSelectStack ({ stackName : " dev " , projectName : " my-infra " , program : async () => { const aws = require ( " @pulumi/aws " ); const bucket = new aws . s3 . Bucket ( " my-bucket " , { website : { indexDocument : " index.html " } }); return { bucketUrl : bucket . websiteEndpoint }; } }); const result = await stack . up ({ onOutput : console . log }); console . log ( `Bucket URL: ${ result . outputs . bucketUrl . value } ` ); Key Use Cases 1. Self-Service Infrastructure Portals app . post ( " /api/create-environment " , async ( req , res ) => { const { teamName , size } = req . body ; const

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
2 views

Related Articles