We're using AWS fargate, and run services with a bunch of task. For logging purposes i would like to know the ARN of the "current Task" (the task that the code is running on). Before we were using EC2 and i could the AWS SDK for .NET (Amazon.Util.EC2InstanceMetadata.InstanceId) to get it.
So far i haven't found anything that could give met the ID / ARN of the task in the SDK or otherwise. Anyone aware of a way to retrieve this information?
In boto3 the python3 SDK, it have list_tasks(**kwargs)
as documented here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.list_tasks
Request Syntax
response = client.list_tasks(
cluster='string',
containerInstance='string',
family='string',
nextToken='string',
maxResults=123,
startedBy='string',
serviceName='string',
desiredStatus='RUNNING'|'PENDING'|'STOPPED',
launchType='EC2'|'FARGATE'
)
Not a .NET person but this might be what you are looking for
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/ECS/MECSListTasksListTasksRequest.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.