Skip to content

EC2: CreateTags accepts reserved aws:-prefixed tag keys that real EC2 rejects #452

Closed

Description

@scttfrdmn

What

Real EC2 rejects a CreateTags request whose key starts with aws::

InvalidParameterValue: Tag keys starting with 'aws:' are reserved for internal use

The Tag your resources page confirms the prefix is reserved — "reserved for AWS use… you can't edit or delete" — and that such tags do not count against the 50-tag limit.

Substrate accepts them. A consumer's error branch for the reserved-prefix rejection is therefore unreachable, and a test of it passes vacuously.

Why this was deliberately deferred

Filed out of the #443 work rather than fixed alongside it. Before v0.84.0 stamped aws:ec2:fleet-id automatically, applying that tag by hand was the parsl-aws-provider workaround for having no fleet→instance route at all. Tightening CreateTags in the same release that removed the need for the workaround would have broken that consumer on upgrade with no overlap window.

v0.84.0 makes the workaround unnecessary. This can land one release later, giving consumers a window to drop it.

Acceptance criteria

  • CreateTags with a key matching aws: (case-insensitive — confirm against the AWS reference) fails with InvalidParameterValue, HTTP 400, and AWS's message.
  • The check applies to every resource type CreateTags accepts, not just instances.
  • Substrate's own internal tagging — aws:ec2:fleet-id from CreateFleet (EC2: CreateFleet does not apply the aws:ec2:fleet-id tag, so a fleet's instances can't be found #443) — is unaffected, since it does not go through the CreateTags request path. Add a test that pins this: a fleet still stamps its tag after the restriction lands.
  • DeleteTags on a reserved key: check what AWS does before deciding, and cover it either way.
  • Reserved tags do not count against the 50-tag limit, per the docs.
  • docs/services.md records the restriction and removes the note saying substrate does not yet enforce it.

Activity

  1. added this to the v0.85.0 milestone on Aug 1, 2026
  2. scttfrdmn commented on Aug 2, 2026

    @scttfrdmn
    OwnerAuthor

    Shipped in v0.85.0 (#463). Three things worth reporting back, one of which corrects the issue.

    The prefix match is case-sensitive, not case-insensitive

    The issue asks to confirm whether the match should be case-insensitive. It should not. The EC2 Tag your resources → Tag restrictions page states that tag keys and values are case-sensitive, and every observed rejection quotes the lowercase form:

    Tag keys starting with 'aws:' are reserved for internal use
    

    So AWS:foo and Aws:foo are ordinary user tags and are accepted. A case-folded check would have traded the infidelity you reported for a new one in the opposite direction — rejecting a tag AWS permits. There are explicit test cases pinning AWS:foo, Aws:foo, aws-foo and awsfoo as accepted, and bare aws: with an empty suffix as rejected.

    The DeleteTags answer is a documentation inference, not a captured error

    You asked what DeleteTags should do. Substrate now applies the same check there, but the evidence is weaker than for CreateTags and it is worth you knowing which is which:

    • CreateTags — the code and message come from two independent captures of real-AWS responses, byte-identical, one recording Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue. Note that both captures are of RunInstances tag-on-create rather than CreateTags; the message is evidently shared across the tagging paths, but substrate has not observed it on CreateTags directly.
    • DeleteTags — no captured error was found. The code and message are inherited from the CreateTags capture. What the documentation does state unambiguously is the outcome: such a tag "can't be edited or deleted" by a caller. A DeleteTags that returned success while leaving the tag in place would be its own infidelity, so refusing is the closer of the two available behaviours.

    docs/services.md and the CHANGELOG both state this plainly rather than implying a doc citation. If you have a captured DeleteTags rejection, it would firm this up.

    The 50-tag exemption is vacuous today

    The issue asks that reserved tags not count against the 50-tag-per-resource limit. That is currently true only because the limit does not exist — TagLimitExceeded fires nowhere in substrate. Filed as #469 rather than bundled here, because it needs its own semantics: reserved tags exempt from the count, and the rule that real AWS still permits overwriting an existing key on a resource that already has 50 tags. A check written as len(existing) + len(new) > 50 gets that second one wrong.

    Also deliberately not covered

    RunInstances tag-on-create is unrestricted, which is a real remaining gap given that both captures above are from that operation. It is blocked on substrate's own fleet path: launchFleetPool stamps aws:ec2:fleet-id (#443) by building a synthetic RunInstances param map, so restricting that parse would reject substrate's own tagging and silently remove the only route from an instant fleet back to its instances — which is the thing #443 existed to give you. Filed as #468 with the restructuring it needs. A regression test pins that a fleet still stamps the tag and that DescribeInstances filtered on tag:aws:ec2:fleet-id still returns its instances.

    Behaviour you can rely on

    The whole request is refused before any resource is modified. CreateTags accepts up to 1000 resource IDs, and rejecting partway through the apply loop would leave a prefix of them tagged — a state real EC2 never produces. A request mixing one legal tag with one reserved tag leaves every resource it named untouched, asserted directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions