Comparing version 0.0.9 to 0.0.10
@@ -13,5 +13,10 @@ const { program } = require("commander"); | ||
.option("--ecs-run-on-fargate", "run ecs task on fargate") | ||
.option("--ecs-task-logs", "read task logs") | ||
.option("--edge-lambda-kill-warm-instances", "kill warm edge lambda instances by doing a silent redeployment") | ||
.option("--lambda-kill-warm-instances", "kill warm lambda instances by doing a silent redeployment") | ||
// .option("--ecr-ecs-ephemeral-create", "creates an ephemeral ecr/ecs combination") | ||
// .option("--ecr-ecs-ephemeral-destroy", "destroys an ephemeral ecr/ecs combination") | ||
// .option("--version-based-lambda-deploy", "deploy a version-based lambda function") | ||
.option("--task-definition <task-definition>", "ecs task definition") | ||
.option("--task-arn <task-arn>", "ecs task arn") | ||
.option("--cluster-name <cluster-name>", "ecs cluster name") | ||
@@ -55,2 +60,5 @@ .option("--container-name <container-name>", "container name") | ||
if (options["ecsTaskLogs"]) | ||
Lib.ecsTaskLogs(options["taskArn"], options["clusterName"], resultFunc); | ||
if (options["edgeLambdaKillWarmInstances"]) | ||
@@ -61,4 +69,1 @@ Lib.edgeLambdaKillWarmInstances(options["lambdaFunction"], options["cloudfrontId"], options["lambdaEdgeType"], resultFunc); | ||
Lib.lambdaKillWarmInstances(options["lambdaFunction"], resultFunc); | ||
// TODO: lambda version based routing deploy | ||
// TODO: run temporarily on fargate |
{ | ||
"name": "awsass", | ||
"description": "AWSASS is an assistant to AWS, mostly for running better scripts.", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"author": "Jsonize", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/jsonize/awsass", |
@@ -163,2 +163,37 @@ const AWS = require("aws-sdk"); | ||
ecsTaskLogs: function (taskArn, clusterName, callback) { | ||
const ecs = new AWS.ECS({apiVersion: '2014-11-13'}); | ||
const cloudwatchlogs = new AWS.CloudWatchLogs({apiVersion: '2014-03-28'}); | ||
ecs.describeTasks({ | ||
tasks: [taskArn], | ||
cluster: clusterName | ||
}, function (err, describeTasksData) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
ecs.describeTaskDefinition({ | ||
taskDefinition: describeTasksData.tasks[0].taskDefinitionArn | ||
}, function (err, describeTaskDef) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
const logGroup = describeTaskDef.taskDefinition.containerDefinitions[0].logConfiguration.options['awslogs-group']; | ||
const logStreamId = taskArn.split("/").pop(); | ||
cloudwatchlogs.getLogEvents({ | ||
logGroupName: logGroup, | ||
logStreamName: logGroup.substring(1) + "/" + logStreamId, | ||
limit: 100 | ||
}, function(err, data) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
callback(undefined, data.events.map(event => event.message)); | ||
}); | ||
}); | ||
}); | ||
}, | ||
edgeLambdaKillWarmInstances: function (lambdaFunction, cloudfrontId, lambdaEdgeType, callback) { | ||
@@ -165,0 +200,0 @@ const lambda = new AWS.Lambda({apiVersion: '2015-03-31'}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15538
326