Skip to content

/AWS1/IF_ECS=>CREATEDAEMON()

About CreateDaemon

Creates a new daemon in the specified cluster and capacity providers. A daemon deploys cross-cutting software agents such as security monitoring, telemetry, and logging independently across your Amazon ECS infrastructure.

Amazon ECS deploys exactly one daemon task on each container instance of the specified capacity providers. When a container instance registers with the cluster, Amazon ECS automatically starts daemon tasks. Amazon ECS starts a daemon task before scheduling other tasks.

Daemons are essential for instance health - if a daemon task stops, Amazon ECS automatically drains and replaces that container instance.

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

Method Signature

METHODS /AWS1/IF_ECS~CREATEDAEMON
  IMPORTING
    !IV_DAEMONNAME TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_CLUSTERARN 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
    !IT_TAGS TYPE /AWS1/CL_ECSTAG=>TT_TAGS OPTIONAL
    !IV_PROPAGATETAGS TYPE /AWS1/ECSDAEMONPROPAGATETAGS OPTIONAL
    !IV_ENABLEECSMANAGEDTAGS TYPE /AWS1/ECSBOOLEAN OPTIONAL
    !IV_ENABLEEXECUTECOMMAND TYPE /AWS1/ECSBOOLEAN OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/ECSSTRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ecscreatedaemonrsp
  RAISING
    /AWS1/CX_ECSACCESSDENIEDEX
    /AWS1/CX_ECSCLIENTEXCEPTION
    /AWS1/CX_ECSCLUSTERNOTFOUNDEX
    /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_daemonname TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The name of the daemon. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.

iv_daemontaskdefinitionarn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the daemon task definition to use for the 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. The daemon deploys tasks on container instances managed by these capacity providers.

Optional arguments:

iv_clusterarn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the cluster to create the daemon in.

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.

it_tags TYPE /AWS1/CL_ECSTAG=>TT_TAGS TT_TAGS

The metadata that you apply to the daemon to help you categorize and organize them. Each tag consists of a key and an optional value. You define both of them.

The following basic restrictions apply to tags:

  • Maximum number of tags per resource - 50

  • For each resource, each tag key must be unique, and each tag key can have only one value.

  • Maximum key length - 128 Unicode characters in UTF-8

  • Maximum value length - 256 Unicode characters in UTF-8

  • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

  • Tag keys and values are case-sensitive.

  • Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.

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. To add tags to a task after task creation, use the TagResource API action.

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

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

iv_clienttoken TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

An identifier that you provide to ensure the idempotency of the request. It must be unique and is case sensitive. Up to 36 ASCII characters in the range of 33-126 (inclusive) are allowed.

RETURNING

oo_output TYPE REF TO /aws1/cl_ecscreatedaemonrsp /AWS1/CL_ECSCREATEDAEMONRSP

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->createdaemon(
  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| ) )
  )
  it_tags = VALUE /aws1/cl_ecstag=>tt_tags(
    (
      new /aws1/cl_ecstag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_clienttoken = |string|
  iv_clusterarn = |string|
  iv_daemonname = |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_string = lo_result->get_deploymentarn( ).
ENDIF.

To create a daemon

This example creates a daemon named my-monitoring-daemon in the specified cluster that uses the monitoring-agent daemon task definition and deploys to the specified capacity provider.

DATA(lo_result) = lo_client->createdaemon(
  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_clusterarn = |arn:aws:ecs:us-east-1:123456789012:cluster/my-cluster|
  iv_daemonname = |my-monitoring-daemon|
  iv_daemontaskdefinitionarn = |arn:aws:ecs:us-east-1:123456789012:daemon-task-definition/monitoring-agent:1|
).