Hi there, Is it possible to provision infra with ...
# general
h
Hi there, Is it possible to provision infra with Pulumi via REST API call (ExpressJS)? I am looking to do something like this:
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import express  ...

app.get(/make-ec2, (req,res)=> {
const ubuntu = aws.ec2.getAmi({
    mostRecent: true,
    filters: [
        {
            name: "name",
            values: ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"],
        },
        {
            name: "virtualization-type",
            values: ["hvm"],
        },
    ],
    owners: ["099720109477"],
});
const web = new aws.ec2.Instance("web", {
    ami: ubuntu.then(ubuntu => ubuntu.id),
    instanceType: "t3.micro",
    tags: {
        Name: "HelloWorld",
    }
});

res.send(web)
})
I am already doing this with AWS SDK, just wanted to know if I can do this by pulumi?
c
Hey there - you absolutely can! I'd recommend starting here: https://www.pulumi.com/docs/guides/automation-api/
h
Thankyou!