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.
2.9 KiB
Amazon Lightsail
Floci exposes Amazon Lightsail through the AWS JSON 1.1 protocol:
- Endpoint:
POST / - Target prefix:
Lightsail_20161128.* - Signing name:
lightsail
The local implementation keeps Lightsail state in Floci storage and is designed for SDK and AWS CLI compatibility on common development workflows.
Supported local workflows
- Instances: create, get, list, start, stop, reboot, delete, state lookup, and public port management
- Disks: create, get, list, attach, detach, and delete
- Static IPs: allocate, get, list, attach, detach, and release
- Key pairs: create, import, get, list, delete, and download default key pair
- Discovery: regions, blueprints, bundles, active names, operations, and operations for resource
- Tags: tag and untag local Lightsail resources, by
resourceNameorresourceArn
Each resource's ARN carries an id Floci mints for it, as AWS's do
(arn:aws:lightsail:us-east-1:000000000000:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE), not its
name; a resource stored before keeps the ARN it was made with.
Read-only list operations for cloud-side Lightsail resource families that are not locally implemented yet return empty AWS-shaped lists. Cloud-only provisioning workflows such as container services, distributions, managed databases, load balancers, buckets, and snapshots are recognized from the AWS Lightsail API model and return an explicit UnsupportedOperation error instead of a custom endpoint or non-AWS response shape.
IAM
With IAM enforcement on, each action is checked on the resources the AWS Service Authorization
Reference lists for it, read from the request: an instance, disk, static IP or key pair a request
names by its name (instanceName, diskName, staticIpName, keyPairName) is checked on the ARN
Lightsail stores for it, arn:aws:lightsail:<region>:<account>:Instance/<id>, and a tag call on its
resourceArn. A tag call 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. An
aws:ResourceTag condition reads the tags Floci keeps on the instance, disk, static IP or key pair.
Examples
aws --endpoint-url http://localhost:4566 lightsail get-blueprints
aws --endpoint-url http://localhost:4566 lightsail create-instances \
--instance-names web-a \
--availability-zone us-east-1a \
--blueprint-id ubuntu_22_04 \
--bundle-id nano_3_0
aws --endpoint-url http://localhost:4566 lightsail allocate-static-ip \
--static-ip-name web-ip
aws --endpoint-url http://localhost:4566 lightsail attach-static-ip \
--static-ip-name web-ip \
--instance-name web-a
Persistence
Lightsail resources use StorageFactory and follow the global storage mode by default. Configure the service with:
floci:
services:
lightsail:
enabled: true
storage:
services:
lightsail:
flush-interval-ms: 5000