Skip to content

/AWS1/IF_ECS=>UPDATEDAEMON()

About UpdateDaemon

Updates the specified daemon. When you update a daemon, a new deployment is triggered that progressively rolls out the changes to the container instances associated with the daemon's capacity providers. For more information, see Daemon deployments in the Amazon Elastic Container Service Developer Guide.

Amazon ECS drains existing container instances and provisions new instances with the updated daemon. Amazon ECS automatically launches replacement tasks for your services.

Updating a daemon triggers a rolling deployment that drains and replaces container instances. Plan updates during maintenance windows to minimize impact on running services.

ECS Managed Daemons is only supported for Amazon ECS Managed Instances Capacity Providers.

Method Signature

METHODS /AWS1/IF_ECS~UPDATEDAEMON
  IMPORTING
    !IV_DAEMONARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_DAEMONTASKDEFINITIONARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IT_CAPACITYPROVIDERARNS TYPE /AWS1/CL_ECSSTRINGLIST_W=>TT_STRINGLIST OPTIONAL
    !IO_DEPLOYMENTCONFIGURATION TYPE REF TO /AWS1/CL_ECSDAEMONDEPLOYCONF OPTIONAL
    !IV_PROPAGATETAGS TYPE /AWS1/ECSDAEMONPROPAGATETAGS OPTIONAL
    !IV_ENABLEECSMANAGEDTAGS TYPE /AWS1/ECSBOOLEAN OPTIONAL
    !IV_ENABLEEXECUTECOMMAND TYPE /AWS1/ECSBOOLEAN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ecsupdatedaemonrsp
  RAISING
    /AWS1/CX_ECSACCESSDENIEDEX
    /AWS1/CX_ECSCLIENTEXCEPTION
    /AWS1/CX_ECSCLUSTERNOTFOUNDEX
    /AWS1/CX_ECSDAEMONNOTACTIVEEX
    /AWS1/CX_ECSDAEMONNOTFOUNDEX
    /AWS1/CX_ECSINVALIDPARAMETEREX
    /AWS1/CX_ECSPLATFORMUNKNOWNEX
    /AWS1/CX_ECSSERVEREXCEPTION
    /AWS1/CX_ECSUNSUPPEDFEATUREEX
    /AWS1/CX_ECSCLIENTEXC
    /AWS1/CX_ECSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_daemonarn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the daemon to update.

iv_daemontaskdefinitionarn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the daemon task definition to use for the updated daemon.

it_capacityproviderarns TYPE /AWS1/CL_ECSSTRINGLIST_W=>TT_STRINGLIST TT_STRINGLIST

The Amazon Resource Names (ARNs) of the capacity providers to associate with the daemon.

Optional arguments:

io_deploymentconfiguration TYPE REF TO /AWS1/CL_ECSDAEMONDEPLOYCONF /AWS1/CL_ECSDAEMONDEPLOYCONF

Optional deployment parameters that control how the daemon rolls out updates, including the drain percentage, alarm-based rollback, and bake time.

iv_propagatetags TYPE /AWS1/ECSDAEMONPROPAGATETAGS /AWS1/ECSDAEMONPROPAGATETAGS

Specifies whether to propagate the tags from the daemon to the daemon tasks. If you don't specify a value, the tags aren't propagated. You can only propagate tags to daemon tasks during task creation.

iv_enableecsmanagedtags TYPE /AWS1/ECSBOOLEAN /AWS1/ECSBOOLEAN

Specifies whether to turn on Amazon ECS managed tags for the tasks in the daemon. For more information, see Tagging your Amazon ECS resources in the Amazon Elastic Container Service Developer Guide.

iv_enableexecutecommand TYPE /AWS1/ECSBOOLEAN /AWS1/ECSBOOLEAN

If true, the execute command functionality is turned on for all tasks in the daemon. If false, the execute command functionality is turned off.

RETURNING

oo_output TYPE REF TO /aws1/cl_ecsupdatedaemonrsp /AWS1/CL_ECSUPDATEDAEMONRSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->updatedaemon(
  io_deploymentconfiguration = new /aws1/cl_ecsdaemondeployconf(
    io_alarms = new /aws1/cl_ecsdaemonalarmconf(
      it_alarmnames = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
        ( new /aws1/cl_ecsstringlist_w( |string| ) )
      )
      iv_enable = ABAP_TRUE
    )
    iv_baketimeinminutes = 123
    iv_drainpercent = '0.1'
  )
  it_capacityproviderarns = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
    ( new /aws1/cl_ecsstringlist_w( |string| ) )
  )
  iv_daemonarn = |string|
  iv_daemontaskdefinitionarn = |string|
  iv_enableecsmanagedtags = ABAP_TRUE
  iv_enableexecutecommand = ABAP_TRUE
  iv_propagatetags = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_string = lo_result->get_daemonarn( ).
  lv_daemonstatus = lo_result->get_status( ).
  lv_timestamp = lo_result->get_createdat( ).
  lv_timestamp = lo_result->get_updatedat( ).
  lv_string = lo_result->get_deploymentarn( ).
ENDIF.

To update a daemon

This example updates the my-monitoring-daemon daemon to use a new daemon task definition revision.

DATA(lo_result) = lo_client->updatedaemon(
  io_deploymentconfiguration = new /aws1/cl_ecsdaemondeployconf(
    iv_baketimeinminutes = 5
    iv_drainpercent = '10.0'
  )
  it_capacityproviderarns = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
    ( new /aws1/cl_ecsstringlist_w( |arn:aws:ecs:us-east-1:123456789012:capacity-provider/my-capacity-provider| ) )
  )
  iv_daemonarn = |arn:aws:ecs:us-east-1:123456789012:daemon/my-cluster/my-monitoring-daemon|
  iv_daemontaskdefinitionarn = |arn:aws:ecs:us-east-1:123456789012:daemon-task-definition/monitoring-agent:2|
).