Class: Cucloud::SSMUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/cucloud/ssm_utils.rb

Overview

SSMUtils class - for interacting with the simple server management service

Instance Method Summary collapse

Constructor Details

#initialize(ssm_client = Aws::SSM::Client.new) ⇒ SSMUtils

Returns a new instance of SSMUtils.



4
5
6
# File 'lib/cucloud/ssm_utils.rb', line 4

def initialize(ssm_client = Aws::SSM::Client.new)
  @ssm = ssm_client
end

Instance Method Details

#send_patch_command(patch_instances, command) ⇒ Object

Used to send patching command to ec2 linux instance

Parameters:

  • patch_instances (array)

    array of instance instance ids

  • command (string)

    patching command to be sent



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cucloud/ssm_utils.rb', line 11

def send_patch_command(patch_instances, command)
  @ssm.send_command(
    instance_ids: patch_instances, # required
    document_name: 'AWS-RunShellScript', # required
    timeout_seconds: 600,
    comment: 'Patch It!',
    parameters: {
      'commands' => [command]
    }
  )
end