Repository navigation
Closed
Labels
Milestone
Description
What
v0.86.0 added the 50-tag-per-resource limit
and reserved aws: key rejection on every tag-on-create path.
Two documented restrictions from the same Tag restrictions table are still not
enforced:
- Maximum key length – 128 Unicode characters
- Maximum value length – 256 Unicode characters
Substrate accepts a key or value of any length, so a consumer that would hit AWS's
ceiling gets success here and a rejection there — the same silent-success shape #469
closed for the count.
Notes on getting it right
- The limits are in Unicode characters, not bytes. A key of 128 emoji is legal at
128 characters and illegal if counted as UTF-8 bytes. Useutf8.RuneCountInString,
notlen— this is the detail a test with ASCII-only fixtures will not catch, so the
test table needs a multi-byte row. aws:-prefixed keys: the count exemption in EC2: the 50-tag-per-resource limit is unmodelled (TagLimitExceeded never fires) #469 does not obviously extend to
length, and substrate's ownaws:ec2:fleet-idis far under both limits either way.
Check the documentation rather than assuming, and state which way it went.- The error code needs research.
InvalidParameterValueis the likely candidate by
analogy with the reserved-key rejection, but per
#487 the message text needs its
own source — a capture, or moto/LocalStack — or it ships as substrate's own text,
labelled as such in the comment. - The check belongs beside the existing two in
ec2_tags.go, so it applies to
CreateTags,DeleteTags, and every tag-on-create path at once, and before
anything is created — same rollback property EC2: RunInstances and other tag-on-create paths accept reserved aws: tag keys #468 established. - A launch template's instance-scoped tags are checked at
CreateLaunchTemplate/
CreateLaunchTemplateVersionas well as at launch, following EC2: a launch template's TagSpecifications and IamInstanceProfile are not parsed #471.
Acceptance criteria
- A 129-character key and a 257-character value are each rejected, HTTP 400; 128 and
256 are accepted. - Length is counted in Unicode characters — a multi-byte fixture at exactly the
limit is accepted. - The rejection lands before any resource is created or tagged, on every
tag-on-create path. - Launch-template tags are covered at template creation and at launch.
-
docs/services.mdreplaces its "Two documented restrictions substrate does not
enforce" paragraph, and the message's provenance is stated.
Referenced as tracked separately from docs/services.md's
50-tag-per-resource limit section
and the v0.86.0 CHANGELOG.
Activity
feat(ec2): enforce the documented tag key and value length limits (#490…
scttfrdmn commentedon Aug 2, 2026
Fixed in
468e785(#505), shipping in v0.87.0. Your open question is settled, and the answer is the opposite of the convenient one.The
aws:exemption does not extend to length. You flagged this as needing research. The tag restrictions list scopes the exemption to the count alone — "Tags with theaws:prefix do not count against your tags per resource limit" — and nothing on that page exempts a reserved key from the length limits. So reserved keys are length-checked. That makesec2CheckTagLengthsdeliberately narrower than #469'sec2CheckTagLimit, which does exempt them, and since the two functions sit adjacent the comment carries the quote — a reader finding one function exemptingaws:and its neighbour not is going to assume one is a bug. Substrate's ownaws:ec2:fleet-idis far under both limits, so nothing this emulator stamps is affected.Two other details from the same list, both worth a test row:
lenby accident — which is the implementation a reader would write first.> 0 &&guard would have rejected it.DeleteTagsnames keys with an optional value, so it checks what is supplied and no more.On provenance, this is the weakest claim in the release and is marked as such.
InvalidParameterValue(400) is by analogy withec2ReservedTagKeyError— as your report says, that is the strongest available basis, and no capture of a real length rejection exists (moto and LocalStack were checked and neither enforces it either). The message is substrate's own, naming which limit was exceeded and by how much, followingsqsMessageTooLong's precedent, and the comment says so. #487 covers the general problem.Wiring, per your third criterion: the check runs wherever
ec2CheckReservedTagKeysruns —CreateTags,DeleteTags, and every tag-on-create path throughec2LaunchTagsForResource/ec2TagSpecificationTags— before any resource is created, per #468's rollback rule. SoRunInstanceswith an over-long tag creates no instance, andCreateImageandCreateNatGatewaycreate nothing. It also runs inec2CheckTemplateTags, so a launch template's instance-scoped tags are rejected atCreateLaunchTemplateandCreateLaunchTemplateVersionas well as at launch, following #471.The #468 and #469 suites pass unchanged.
chore(release): v0.87.0 (#515)