Skip to content

Add ECS Task Metadata client #3136

Open
@mdomsch-seczetta

Description

@mdomsch-seczetta

Describe the feature

Similar to the existing Aws::EC2Metadata client class, it would be helpful to have a metadata client class that retrieves and presents data from the ECS Task Metadata endpoint described here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html

While I could retrieve the response from the ECS Task Metadata endpoint and parse the Cluster field from it, having a built-in method to retrieve this would be simpler and cleaner, and is in keeping with how I get the EC2 instance ID already.

Use Case

I want to use this client class to let an application running in ECS on EC2 retrieve the name of the ECS Cluster name it is a part of, for use when calling UpdateContainerInstancesState https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateContainerInstancesState.html
. This method requires passing in the cluster name, as well as the EC2 instance ID, to set the status to a value. I want to set the status to DRAINING to prevent ECS from placing a task on an EC2 instance that is in one of the Terminating states, but ECS is not aware of this. Because I can control when an EC2 instance is put into a Terminating state, I can also put the ECS container instance state to DRAINING at the same time.

Proposed Solution

Implement similar to the Aws::EC2Metadata client class.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

3.165.0

Environment details (OS name and version, etc.)

Ruby 3.1.2 on Linux, e.g. ruby:3.1.2-slim-bullseye from docker hub

Metadata

Metadata

Assignees

Labels

feature-requestA feature should be added or improved.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions