Class: EcsDeployCli::Runners::RunTask

Inherits:
Base
  • Object
show all
Defined in:
lib/ecs_deploy_cli/runners/run_task.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #update_task

Constructor Details

This class inherits a constructor from EcsDeployCli::Runners::Base

Instance Method Details

#run!(task, launch_type:, security_groups:, subnets:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ecs_deploy_cli/runners/run_task.rb', line 6

def run!(task, launch_type:, security_groups:, subnets:)
  _, tasks, = @parser.resolve

  task_definition = _update_task tasks[task]
  task_name = "#{task_definition[:family]}:#{task_definition[:revision]}"

  ecs_client.run_task(
    cluster: config[:cluster],
    task_definition: task_name,
    network_configuration: {
      awsvpc_configuration: {
        subnets: subnets,
        security_groups: security_groups,
        assign_public_ip: 'ENABLED'
      }
    },
    launch_type: launch_type
  )
end