Class: AWSCDK::GameLift::CfnContainerGroupDefinition::ContainerHealthCheckProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
game_lift/cfn_container_group_definition.rb

Overview

Instructions on when and how to check the health of a support container in a container fleet.

These properties override any Docker health checks that are set in the container image. For more information on container health checks, see HealthCheck command in the Amazon Elastic Container Service API . Game server containers don't have a health check parameter; Amazon GameLift Servers automatically handles health checks for these containers.

The following example instructs the container to initiate a health check command every 60 seconds and wait 10 seconds for it to succeed. If it fails, retry the command 3 times before flagging the container as unhealthy. It also tells the container to wait 100 seconds after launch before counting failed health checks.

{"Command": [ "CMD-SHELL", "ps cax | grep "processmanager" || exit 1" ], "Interval": 60, "Timeout": 10, "Retries": 3, "StartPeriod": 100 }

Part of: SupportContainerDefinition , SupportContainerDefinitionInput

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command:, interval: nil, retries: nil, start_period: nil, timeout: nil) ⇒ ContainerHealthCheckProperty

Returns a new instance of ContainerHealthCheckProperty.

Parameters:

  • command (Array<String>)

    A string array that specifies the command that the container runs to determine if it's healthy.

  • interval (Numeric, nil) (defaults to: nil)

    The time period (in seconds) between each health check.

  • retries (Numeric, nil) (defaults to: nil)

    The number of times to retry a failed health check before flagging the container unhealthy.

  • start_period (Numeric, nil) (defaults to: nil)

    The optional grace period (in seconds) to give a container time to bootstrap before the first failed health check counts toward the number of retries.

  • timeout (Numeric, nil) (defaults to: nil)

    The time period (in seconds) to wait for a health check to succeed before counting a failed health check.



798
799
800
801
802
803
804
805
806
807
808
809
# File 'game_lift/cfn_container_group_definition.rb', line 798

def initialize(command:, interval: nil, retries: nil, start_period: nil, timeout: nil)
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command")
  @interval = interval
  Jsii::Type.check_type(@interval, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "interval") unless @interval.nil?
  @retries = retries
  Jsii::Type.check_type(@retries, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "retries") unless @retries.nil?
  @start_period = start_period
  Jsii::Type.check_type(@start_period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "startPeriod") unless @start_period.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "timeout") unless @timeout.nil?
end

Instance Attribute Details

#commandArray<String> (readonly)

A string array that specifies the command that the container runs to determine if it's healthy.



815
816
817
# File 'game_lift/cfn_container_group_definition.rb', line 815

def command
  @command
end

#intervalNumeric? (readonly)

The time period (in seconds) between each health check.



820
821
822
# File 'game_lift/cfn_container_group_definition.rb', line 820

def interval
  @interval
end

#retriesNumeric? (readonly)

The number of times to retry a failed health check before flagging the container unhealthy.

The first run of the command does not count as a retry.



827
828
829
# File 'game_lift/cfn_container_group_definition.rb', line 827

def retries
  @retries
end

#start_periodNumeric? (readonly)

The optional grace period (in seconds) to give a container time to bootstrap before the first failed health check counts toward the number of retries.



832
833
834
# File 'game_lift/cfn_container_group_definition.rb', line 832

def start_period
  @start_period
end

#timeoutNumeric? (readonly)

The time period (in seconds) to wait for a health check to succeed before counting a failed health check.



837
838
839
# File 'game_lift/cfn_container_group_definition.rb', line 837

def timeout
  @timeout
end

Class Method Details

.jsii_propertiesObject



839
840
841
842
843
844
845
846
847
# File 'game_lift/cfn_container_group_definition.rb', line 839

def self.jsii_properties
  {
    :command => "command",
    :interval => "interval",
    :retries => "retries",
    :start_period => "startPeriod",
    :timeout => "timeout",
  }
end

Instance Method Details

#to_jsiiObject



849
850
851
852
853
854
855
856
857
858
859
# File 'game_lift/cfn_container_group_definition.rb', line 849

def to_jsii
  result = {}
  result.merge!({
    "command" => @command,
    "interval" => @interval,
    "retries" => @retries,
    "startPeriod" => @start_period,
    "timeout" => @timeout,
  })
  result.compact
end