I have a lambda function that is supposed to start an ecs task when invoked. It gets all the way down to the "Starting execution..." log then it logs "done.". It seems to just skip right over ecs.runTask(). I have tried getting the returned json output by setting the runtask function to a variable, but that has not helped. I have also tried changing some of my parameters and that has not worked as well.
const AWS = require('aws-sdk');
var ecs = new AWS.ECS()
exports.handler = async (event) => {
var params = {
cluster: "ec2-cluster",
enableECSManagedTags: true,
launchType: "FARGATE",
count: 1,
platformVersion: 'LATEST',
networkConfiguration: {
awsvpcConfiguration: {
assignPublicIp: "ENABLED",
securityGroups: [ "sg" ],
subnets: [ "subnet" ]
}
},
startedBy: "testLambda",
taskDefinition: "definition"
}
console.log("Starting execution...");
ecs.runTask(params, function(err, data) {
console.log(err, data)
});
// console.log(myReturn)
console.log("done.")
}
When I run this locally everything works great. When I run this in lambda however it does not start my task.