Skip to content

/AWS1/IF_ECS=>REGISTERDAEMONTASKDEFINITION()

About RegisterDaemonTaskDefinition

Registers a new daemon task definition from the supplied family and containerDefinitions. Optionally, you can add data volumes to your containers with the volumes parameter. For more information, see Daemon task definitions in the Amazon Elastic Container Service Developer Guide.

A daemon task definition is a template that describes the containers that form a daemon. Daemons deploy cross-cutting software agents such as security monitoring, telemetry, and logging across your Amazon ECS infrastructure.

Each time you call RegisterDaemonTaskDefinition, a new revision of the daemon task definition is created. You can't modify a revision after you register it.

Method Signature

METHODS /AWS1/IF_ECS~REGISTERDAEMONTASKDEFINITION
  IMPORTING
    !IV_FAMILY TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_TASKROLEARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_EXECUTIONROLEARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IT_CONTAINERDEFINITIONS TYPE /AWS1/CL_ECSDAEMONCONTNRDEFN=>TT_DAEMONCONTAINERDEFNLIST OPTIONAL
    !IV_CPU TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_MEMORY TYPE /AWS1/ECSSTRING OPTIONAL
    !IT_VOLUMES TYPE /AWS1/CL_ECSDAEMONVOLUME=>TT_DAEMONVOLUMELIST OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_ECSTAG=>TT_TAGS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ecsregdaemntskdefnrsp
  RAISING
    /AWS1/CX_ECSACCESSDENIEDEX
    /AWS1/CX_ECSCLIENTEXCEPTION
    /AWS1/CX_ECSINVALIDPARAMETEREX
    /AWS1/CX_ECSLIMITEXCEEDEDEX
    /AWS1/CX_ECSSERVEREXCEPTION
    /AWS1/CX_ECSCLIENTEXC
    /AWS1/CX_ECSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_family TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

You must specify a family for a daemon task definition. This family is used as a name for your daemon task definition. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.

it_containerdefinitions TYPE /AWS1/CL_ECSDAEMONCONTNRDEFN=>TT_DAEMONCONTAINERDEFNLIST TT_DAEMONCONTAINERDEFNLIST

A list of container definitions in JSON format that describe the containers that make up your daemon task.

Optional arguments:

iv_taskrolearn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The short name or full Amazon Resource Name (ARN) of the IAM role that containers in this daemon task can assume. All containers in this daemon task are granted the permissions that are specified in this role.

iv_executionrolearn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container agent permission to make Amazon Web Services API calls on your behalf. The task execution role is required for daemon tasks that pull container images from Amazon ECR or send container logs to CloudWatch.

iv_cpu TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The number of CPU units used by the daemon task. It can be expressed as an integer using CPU units (for example, 1024).

iv_memory TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The amount of memory (in MiB) used by the daemon task. It can be expressed as an integer using MiB (for example, 1024).

it_volumes TYPE /AWS1/CL_ECSDAEMONVOLUME=>TT_DAEMONVOLUMELIST TT_DAEMONVOLUMELIST

A list of volume definitions in JSON format that containers in your daemon task can use.

it_tags TYPE /AWS1/CL_ECSTAG=>TT_TAGS TT_TAGS

The metadata that you apply to the daemon task definition 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.

RETURNING

oo_output TYPE REF TO /aws1/cl_ecsregdaemntskdefnrsp /AWS1/CL_ECSREGDAEMNTSKDEFNRSP

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->registerdaemontaskdefinition(
  it_containerdefinitions = VALUE /aws1/cl_ecsdaemoncontnrdefn=>tt_daemoncontainerdefnlist(
    (
      new /aws1/cl_ecsdaemoncontnrdefn(
        io_firelensconfiguration = new /aws1/cl_ecsfirelensconf(
          it_options = VALUE /aws1/cl_ecsfirelensconfopts00=>tt_firelensconfoptionsmap(
            (
              VALUE /aws1/cl_ecsfirelensconfopts00=>ts_firelensconfoptsmap_maprow(
                value = new /aws1/cl_ecsfirelensconfopts00( |string| )
                key = |string|
              )
            )
          )
          iv_type = |string|
        )
        io_healthcheck = new /aws1/cl_ecshealthcheck(
          it_command = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
            ( new /aws1/cl_ecsstringlist_w( |string| ) )
          )
          iv_interval = 123
          iv_retries = 123
          iv_startperiod = 123
          iv_timeout = 123
        )
        io_linuxparameters = new /aws1/cl_ecsdaemonlinuxparams(
          io_capabilities = new /aws1/cl_ecskernelcapabilities(
            it_add = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
              ( new /aws1/cl_ecsstringlist_w( |string| ) )
            )
            it_drop = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
              ( new /aws1/cl_ecsstringlist_w( |string| ) )
            )
          )
          it_devices = VALUE /aws1/cl_ecsdevice=>tt_deviceslist(
            (
              new /aws1/cl_ecsdevice(
                it_permissions = VALUE /aws1/cl_ecsdevcgroupperms_w=>tt_devicecgrouppermissions(
                  ( new /aws1/cl_ecsdevcgroupperms_w( |string| ) )
                )
                iv_containerpath = |string|
                iv_hostpath = |string|
              )
            )
          )
          it_tmpfs = VALUE /aws1/cl_ecstmpfs=>tt_tmpfslist(
            (
              new /aws1/cl_ecstmpfs(
                it_mountoptions = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
                  ( new /aws1/cl_ecsstringlist_w( |string| ) )
                )
                iv_containerpath = |string|
                iv_size = 123
              )
            )
          )
          iv_initprocessenabled = ABAP_TRUE
        )
        io_logconfiguration = new /aws1/cl_ecslogconfiguration(
          it_options = VALUE /aws1/cl_ecslogconfoptsmap_w=>tt_logconfigurationoptionsmap(
            (
              VALUE /aws1/cl_ecslogconfoptsmap_w=>ts_logconfoptionsmap_maprow(
                value = new /aws1/cl_ecslogconfoptsmap_w( |string| )
                key = |string|
              )
            )
          )
          it_secretoptions = VALUE /aws1/cl_ecssecret=>tt_secretlist(
            (
              new /aws1/cl_ecssecret(
                iv_name = |string|
                iv_valuefrom = |string|
              )
            )
          )
          iv_logdriver = |string|
        )
        io_repositorycredentials = new /aws1/cl_ecsrepositorycreds( |string| )
        io_restartpolicy = new /aws1/cl_ecscontainerrestrtply(
          it_ignoredexitcodes = VALUE /aws1/cl_ecsintegerlist_w=>tt_integerlist(
            ( new /aws1/cl_ecsintegerlist_w( 123 ) )
          )
          iv_enabled = ABAP_TRUE
          iv_restartattemptperiod = 123
        )
        it_command = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
          ( new /aws1/cl_ecsstringlist_w( |string| ) )
        )
        it_dependson = VALUE /aws1/cl_ecscontainerdepende00=>tt_containerdependencies(
          (
            new /aws1/cl_ecscontainerdepende00(
              iv_condition = |string|
              iv_containername = |string|
            )
          )
        )
        it_entrypoint = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
          ( new /aws1/cl_ecsstringlist_w( |string| ) )
        )
        it_environment = VALUE /aws1/cl_ecskeyvaluepair=>tt_environmentvariables(
          (
            new /aws1/cl_ecskeyvaluepair(
              iv_name = |string|
              iv_value = |string|
            )
          )
        )
        it_environmentfiles = VALUE /aws1/cl_ecsenvironmentfile=>tt_environmentfiles(
          (
            new /aws1/cl_ecsenvironmentfile(
              iv_type = |string|
              iv_value = |string|
            )
          )
        )
        it_mountpoints = VALUE /aws1/cl_ecsmountpoint=>tt_mountpointlist(
          (
            new /aws1/cl_ecsmountpoint(
              iv_containerpath = |string|
              iv_readonly = ABAP_TRUE
              iv_sourcevolume = |string|
            )
          )
        )
        it_secrets = VALUE /aws1/cl_ecssecret=>tt_secretlist(
          (
            new /aws1/cl_ecssecret(
              iv_name = |string|
              iv_valuefrom = |string|
            )
          )
        )
        it_systemcontrols = VALUE /aws1/cl_ecssystemcontrol=>tt_systemcontrols(
          (
            new /aws1/cl_ecssystemcontrol(
              iv_namespace = |string|
              iv_value = |string|
            )
          )
        )
        it_ulimits = VALUE /aws1/cl_ecsulimit=>tt_ulimitlist(
          (
            new /aws1/cl_ecsulimit(
              iv_hardlimit = 123
              iv_name = |string|
              iv_softlimit = 123
            )
          )
        )
        iv_cpu = 123
        iv_essential = ABAP_TRUE
        iv_image = |string|
        iv_interactive = ABAP_TRUE
        iv_memory = 123
        iv_memoryreservation = 123
        iv_name = |string|
        iv_privileged = ABAP_TRUE
        iv_pseudoterminal = ABAP_TRUE
        iv_readonlyrootfilesystem = ABAP_TRUE
        iv_starttimeout = 123
        iv_stoptimeout = 123
        iv_user = |string|
        iv_workingdirectory = |string|
      )
    )
  )
  it_tags = VALUE /aws1/cl_ecstag=>tt_tags(
    (
      new /aws1/cl_ecstag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  it_volumes = VALUE /aws1/cl_ecsdaemonvolume=>tt_daemonvolumelist(
    (
      new /aws1/cl_ecsdaemonvolume(
        io_host = new /aws1/cl_ecshostvolumeprps( |string| )
        iv_name = |string|
      )
    )
  )
  iv_cpu = |string|
  iv_executionrolearn = |string|
  iv_family = |string|
  iv_memory = |string|
  iv_taskrolearn = |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_daemontaskdefinitionarn( ).
ENDIF.

To register a daemon task definition

This example registers a daemon task definition in the monitoring-agent family with a single container that runs a CloudWatch agent.

DATA(lo_result) = lo_client->registerdaemontaskdefinition(
  it_containerdefinitions = VALUE /aws1/cl_ecsdaemoncontnrdefn=>tt_daemoncontainerdefnlist(
    (
      new /aws1/cl_ecsdaemoncontnrdefn(
        io_logconfiguration = new /aws1/cl_ecslogconfiguration(
          it_options = VALUE /aws1/cl_ecslogconfoptsmap_w=>tt_logconfigurationoptionsmap(
            (
              VALUE /aws1/cl_ecslogconfoptsmap_w=>ts_logconfoptionsmap_maprow(
                value = new /aws1/cl_ecslogconfoptsmap_w( |/ecs/daemon/monitoring-agent| )
                key = |awslogs-group|
              )
            )
            (
              VALUE /aws1/cl_ecslogconfoptsmap_w=>ts_logconfoptionsmap_maprow(
                value = new /aws1/cl_ecslogconfoptsmap_w( |us-east-1| )
                key = |awslogs-region|
              )
            )
            (
              VALUE /aws1/cl_ecslogconfoptsmap_w=>ts_logconfoptionsmap_maprow(
                value = new /aws1/cl_ecslogconfoptsmap_w( |ecs| )
                key = |awslogs-stream-prefix|
              )
            )
          )
          iv_logdriver = |awslogs|
        )
        it_environment = VALUE /aws1/cl_ecskeyvaluepair=>tt_environmentvariables(
          (
            new /aws1/cl_ecskeyvaluepair(
              iv_name = |USE_DEFAULT_CONFIG|
              iv_value = |true|
            )
          )
        )
        iv_cpu = 128
        iv_essential = ABAP_TRUE
        iv_image = |public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest|
        iv_memory = 256
        iv_name = |cloudwatch-agent|
      )
    )
  )
  iv_cpu = |128|
  iv_executionrolearn = |arn:aws:iam::123456789012:role/ecsTaskExecutionRole|
  iv_family = |monitoring-agent|
  iv_memory = |256|
  iv_taskrolearn = |arn:aws:iam::123456789012:role/ecsDaemonTaskRole|
).