https://pulumi.com logo
#general
Title
# general
m

microscopic-florist-85263

09/23/2018, 4:35 AM
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

white-balloon-205

09/23/2018, 9:43 PM
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

microscopic-florist-85263

09/24/2018, 3:05 AM
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

white-balloon-205

09/24/2018, 3:51 AM
m

microscopic-florist-85263

09/24/2018, 7:13 PM
wow awesome!