register_daemon_task_definition
¶
register_daemon_task_definition(
family: String,
container_definitions: DaemonContainerDefinitionList,
*,
config_overrides: Optional[ECSClientConfig] = None,
task_role_arn: Optional[String] = None,
execution_role_arn: Optional[String] = None,
cpu: Optional[String] = None,
memory: Optional[String] = None,
volumes: Optional[DaemonVolumeList] = None,
tags: Optional[Tags] = None,
pid_mode: Optional[DaemonPidMode] = None,
ipc_mode: Optional[DaemonIpcMode] = None,
) -> RegisterDaemonTaskDefinitionResponse
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.
Parameters:
-
family(String) –You must specify a
familyfor 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. -
task_role_arn(Optional[String], default:None) –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.
-
execution_role_arn(Optional[String], default:None) –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.
-
container_definitions(DaemonContainerDefinitionList) –A list of container definitions in JSON format that describe the containers that make up your daemon task.
-
cpu(Optional[String], default:None) –The number of CPU units used by the daemon task. It can be expressed as an integer using CPU units (for example,
1024). -
memory(Optional[String], default:None) –The amount of memory (in MiB) used by the daemon task. It can be expressed as an integer using MiB (for example,
1024). -
volumes(Optional[DaemonVolumeList], default:None) –A list of volume definitions in JSON format that containers in your daemon task can use.
-
tags(Optional[Tags], default:None) –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.
-
-
pid_mode(Optional[DaemonPidMode], default:None) –The PID namespace mode for the daemon. The valid values are
noneandshared. The default isnone.If
noneis specified or no value is provided, the daemon runs with its own PID namespace, isolated from other tasks. Ifsharedis specified, the daemon joins the host PID namespace, making it accessible to non-daemon tasks that usepidMode: "host"or other daemons that usepidMode: "shared". -
ipc_mode(Optional[DaemonIpcMode], default:None) –The IPC namespace mode for the daemon. The valid values are
noneandshared. The default isnone.If
noneis specified or no value is provided, the daemon runs with its own IPC namespace, isolated from other tasks. Ifsharedis specified, the daemon joins the host IPC namespace, making it accessible to non-daemon tasks that useipcMode: "host"or other daemons that useipcMode: "shared".
Raises:
-
AccessDeniedException–You don't have authorization to perform the requested action.
-
ClientException–These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.
-
InvalidParameterException–The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
LimitExceededException–The limit for the resource was exceeded.
-
ServerException–These errors are usually caused by a server issue.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
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.
>>> client.register_daemon_task_definition(family='monitoring-agent', container_definitions=[{'name': 'cloudwatch-agent', 'image': 'public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest', 'memory': 256, 'cpu': 128, 'essential': True, 'logConfiguration': {'logDriver': 'awslogs', 'options': {'awslogs-group': '/ecs/daemon/monitoring-agent', 'awslogs-region': 'us-east-1', 'awslogs-stream-prefix': 'ecs'}}, 'environment': [{'name': 'USE_DEFAULT_CONFIG', 'value': 'true'}]}], cpu='128', memory='256', execution_role_arn='arn:aws:iam::123456789012:role/ecsTaskExecutionRole', task_role_arn='arn:aws:iam::123456789012:role/ecsDaemonTaskRole')
Source code in docs_src/capo_ecs/_services/ecs.py
3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 | |