Commit Graph
3 Commits
Author SHA1 Message Date
Priamo Germosen 17e615ef36 fix(iam): check Amazon Lightsail requests on the resources they name (#10236)
Lightsail was one of the namespaces the request-resources table left unread ("a later batch"), so every request of
it was checked on *: a grant scoped to an instance's ARN never matched, a deny scoped to one never held, and an
aws:ResourceTag condition read nothing. lightsail joins the table now, so each request is checked on the resources
the Service Reference gives its action, read from the request.

A Lightsail ARN carries an id the service mints (Instance/${Id}), while a request names the resource by its name, so
the table asks the service to find it. LightsailStoredResourceArns answers the caller's instance, disk, static IP or
key pair of the name a request gives (instanceName, diskName, staticIpName, keyPairName) in the request's Region, as
the ARN Lightsail stores for it (LightsailService.findArn), and the tags Lightsail keeps on the resource an ARN names,
read in the account and Region the ARN names without moving it and matched on the whole ARN
(LightsailService.storedTags), which an aws:ResourceTag condition reads.

Both read the store in place, a resource stored before keys carried the account included: findArn through
AccountAwareStorageBackend.readInAccount, and storedTags through readAllInAccount, a new scanning counterpart of
readInAccount that also finds the default account's pre-multi-account entries, each read where it is. DMS's
storedArn, which carried the same scan inline, uses it too.

A tag call is checked on its resourceArn; one naming the resource by its resourceName alone, the reads (GetInstance,
GetDisk and the like) and the creates are checked on *, as the generated table reads them.

IamRequestResourceEnforcementIntegrationTest checks that a grant on one instance's ARN reboots the instance a
request names by its name and refuses another, and that an aws:ResourceTag condition reads the tags of the instance a
stop names. LightsailStoredResourcesTest checks each lookup against another Region, type, name and a type Floci keeps
none of, and the stored tags of an instance and a key pair against another account, Region, type, service, id or no
ARN, and that both find an instance stored before accounts without moving it. AccountAwareStorageBackendTest checks
readAllInAccount.
2026-12-05 09:59:00 -04:00
Priamo Germosen 508911da33 fix(lightsail): mint an id, not the name, in a resource's ARN (#10219)
Floci minted a Lightsail resource's ARN from its name (arn:aws:lightsail:<region>:<account>:Instance/web), while AWS
mints an id for it: the Lightsail API Reference gives an instance's ARN as
arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE, and a key pair's, a static
IP's and a disk's the same way, and the Service Authorization Reference writes every Lightsail type as <Type>/${Id}.
baseResource now mints a UUID for each instance, disk, static IP and key pair it makes, so an instance made again
under a name a deleted one had gets an ARN of its own, as on AWS. A request still names a resource by its name, and a
tag call by its name or by the stored ARN, which TagResource and UntagResource already matched on the whole ARN. A
resource stored before keeps the ARN it was made with.

This is the mint the request-resources table needs before Lightsail joins it: its rows find a resource by the name a
request gives and check it on the ARN Lightsail stores.

LightsailResourceProviderTest checks that each of the four types' ARNs carries a UUID after its type, that an
instance made again under a deleted one's name gets a new ARN, and that a tag call naming that ARN tags it;
LightsailIntegrationTest checks the ARN GetInstance answers.
2026-12-05 08:33:39 -04:00
kotov228 97b64a1d3b feat: add AWS Lightsail emulation (#1583)
* feat(lightsail): add AWS Lightsail emulation

* fix(lightsail): align error responses with AWS

* fix(lightsail): address review edge cases

* fix(lightsail): reject attached disk reattach

* fix(lightsail): reject static ip reattach

* fix: register lightsail docs handler
2026-07-10 20:43:42 -05:00