- Newest
- Most votes
- Most comments
Session tags are key-value pair attributes that you can pass when assuming a role, but they don't automatically propagate to resources created using those temporary credentials. Session tags are primarily designed for access control purposes rather than resource tagging.
When you assume a role with session tags, those tags are valid only for the duration of the session and are used primarily for:
- Controlling access to resources based on the tags (Attribute-Based Access Control)
- Passing the tags to subsequent role assumption operations (when marked as transitive)
For your ECS tasks scenario, session tags won't automatically be applied to the ECS tasks you create. The session tags exist at the authentication/authorization level, not at the resource creation level.
If you want to automatically tag ECS tasks, you would need to:
- Explicitly include the tags in your ECS task creation API calls, or
- Use a different mechanism like tag policies or resource-specific tagging features
For Amazon EC2 instances that run as ECS container instances, there are specific methods to propagate tags from EC2 to ECS using the container agent configuration parameter ECS_CONTAINER_INSTANCE_PROPAGATE_TAGS_FROM, but this is specific to container instances and not applicable to ECS tasks created by an application.
In summary, while session tags are powerful for access control and can be passed transitively across role assumptions, they don't automatically propagate to resources created during the session.
Sources
Pass session tags in AWS STS - AWS Identity and Access Management
Adding tags to an Amazon ECS container instance - Amazon Elastic Container Service
Grant Pods access to AWS resources based on tags - Amazon EKS
Controlling access to and for IAM users and roles using tags - AWS Identity and Access Management
Tag - AWS Security Token Service
Relevant content
asked a year ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
