Hmm.. is it possible to launch a fargate container...
# general
m
Hmm.. is it possible to launch a fargate container with lambda through an api gateway and retrieve the cloudwatch container logs, send it back as a response to the api gateway call, all within Pulumi?
w
It would certainly be possible - we have examples that are along these lines - though Fargate launch times can be slow (10s of seconds to minute) which may make this not ideal cost and performance-wise. https://github.com/pulumi/examples/tree/master/cloud-js-thumbnailer is an example of spawning a Fargate task inside a lambda. You should be able to make an aws-SDK CloudWatch call inside the lambda to get Logs as well.
m
Ah thanks!!
@white-balloon-205 I see this as a pulumi lambda example:
Copy code
const cloud = require("@pulumi/cloud-aws");

const api = new cloud.API("aws-hellolambda-js");
api.get("/js", (req, res) => {
    res.status(200).json("Hi from Javascript lambda");
});

exports.endpointJs = api.publish().url;
Would I be able to import aws-sdk and do an cloudwatch call within the
api.get
callback function? Or do I need to put lambda specific code somewhere else?
w
m
wow awesome!