Module: NulogyMessageBusConsumer::Deployment::ECS

Defined in:
lib/nulogy_message_bus_consumer/deployment/ecs.rb

Class Method Summary collapse

Class Method Details

.task_idObject

Try to get the TaskID from metadata server: docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html Otherwise, return nil



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nulogy_message_bus_consumer/deployment/ecs.rb', line 9

def task_id
  data = `curl --silent "$ECS_CONTAINER_METADATA_URI_V4/task"`

  return if data.empty?

  json = JSON.parse(data)
  arn = json["TaskARN"]

  return unless arn

  arn.split("/").last
end