Commit Graph
194 Commits
Author SHA1 Message Date
mrfelek eef1ccc4dc fix(ec2): write every instance's operator, and on each DescribeInstanceStatus item, as AWS does (#9683) 2026-11-28 17:55:48 -04:00
mrfelek faa4892239 feat(ec2): hide managed instances from list and filter calls unless IncludeManagedResources asks for them (#9501) 2026-11-28 15:50:40 -04:00
Andre KuraitandEmanuel Aseghehey 4ee43a0ce0 fix(ec2): add default IPv6 security group egress (#9497)
Security groups in a VPC with an IPv6 CIDR block get the default ::/0 outbound rule alongside 0.0.0.0/0, in the same -1 permission, as AWS adds it. Associating a VPC's first IPv6 block adds it to the default group and to every group whose outbound rules are still the original IPv4 one, under each group's lock, then refreshes the firewalls once. A failed group creation removes both default rule records.

Co-authored-by: Emanuel Aseghehey <aseghey@amazon.com>
2026-11-26 08:43:31 -04:00
Niels Kootstra 370b49861a fix(ec2): apply the shutdown behavior when an instance's guest powers itself off (#9475)
EC2 watches each instance container once it runs, and an exit Floci did not cause applies the instance's InstanceInitiatedShutdownBehavior: StopInstances by default, TerminateInstances for terminate, with the state reason Client.InstanceInitiatedShutdown. The behavior comes from RunInstances, its launch template or ModifyInstanceAttribute, is set before any container starts, is reported by DescribeInstanceAttribute, and must be stop or terminate. Reboots queue behind the container's other lifecycle operations, and the wait-stream exit watcher moves from Lambda to core.common.docker.

Fixes #9385
2026-11-26 01:14:24 -04:00
Niels Kootstra f046df07aa fix(ec2): attach launch-created EBS volumes as block devices when the instance runs (#9438)
Restore the data volumes a launch creates from its block device mappings as guest block devices through the StartInstances restore hook, run before the instance is marked running so they exist before UserData. DetachVolume takes the per-volume lock attach and delete already take, and the restore re-reads each volume under it, so a detach during a restore removes the device afterwards.
2026-11-25 22:06:55 -04:00
Allen Sanborn ad8498a813 fix(ec2): honour DryRun on the transit gateway, Client VPN, key pair, launch template and describe calls (#9075) 2026-11-25 21:48:56 -04:00
Priamo GermosenandAndre Kurait b012f4d6bf fix(iam): check VPC endpoint IDs in EC2 tag calls on their endpoint ARN (#9467)
CreateTags and DeleteTags checked a vpce- ID in their Resources list on `*`, because the generated table learns
each ID prefix from botocore's examples and botocore gives none for VPC endpoints. A grant on one endpoint was
refused and a deny on it never applied.

fetch_ec2_id_examples.py copies the identifier examples of the EC2 API reference's CreateVpcEndpoint page into
tools/aws/sources/ec2-id-examples.json, and the generator matches their XML paths to botocore's output shapes,
which gives VpcEndpointId the vpce- prefix. That prefix joins botocore's in the one prefix map and reads only the
tagging calls' generic list, so DeleteVpcEndpoints keeps its typed reader. The source names its namespace and
pages, and the shared source verifier checks it against the live page.

The regenerated table also takes in what the Service Reference added on 2026-11-25: CloudWatch's omni-slo,
experiment and lookup types, which its tag operations now act on, Elastic Load Balancing's proxy type and the
amplifygen3 namespace.

Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-25 17:22:55 -04:00
Andre Kurait 87ff8135a9 feat(ec2): retain IPv6 launch metadata and allocation properties (#9418) 2026-11-25 06:50:02 -04:00
Andre Kurait 874c3d6123 docs(ec2): describe ARN-owned stored tag lookup (#9416)
The EC2 IAM documentation still described the type list #9412 removed, saying only ID-bearing resources read their stored tags and that name-based ones kept their old lookup. It now says every concrete EC2 resource ARN reads its own stored tags in the ARN's account and Region, including when another service's request names it.
2026-11-24 23:52:04 -04:00
Andre Kurait b3c8db3022 fix(iam): read EC2 resource tags in the ARN scope (#9412)
EC2 resource-tag conditions read the tags of the resource an ARN names in the caller's account and Region, and a foreign ARN kept the caller's earlier tags. Ec2StoredResourceArns now answers storedTags for the resource in the ARN's account and Region, with the caller's account for an account-less image or snapshot ARN, so the shared resource-tag reader fills the table's keys for every EC2 type, other services' requests naming an EC2 ARN included. withEc2ResourceContext keeps only the generated record keys.

Ported from Emanuel Aseghehey's original change.
2026-11-24 23:19:17 -04:00
James McMahon 65dbaac26a fix: protect host consoles from systemd EC2 guests (#9355)
A privileged systemd EC2 guest could hang up the Docker host's virtual-console sessions. Systemd guests now start /sbin/init with systemd.mask= arguments for the getty units, which systemd reads from PID 1's command line once container=docker marks the guest as a container, and get /dev/null mounted read-only over /dev/console and /dev/tty0 through /dev/tty63. Pseudo-terminals stay available for SSH. Docker applies the mounts when it creates the container, so existing systemd instances need recreating.

Closes #9342
2026-11-24 11:40:25 -04:00
Priamo Germosen e82be2c5f5 feat(eks): give pods addresses from the VPC prefixes their node holds (#9288)
Pods got k3s's flannel addresses (10.42.0.0/16), which nothing outside
the node reaches, so a target group with TargetType ip, which the AWS
Load Balancer Controller registers, never saw a healthy target.

With floci.services.eks.vpc-pod-network, pods now take their addresses
from the /28 prefixes their node holds, as the VPC CNI's prefix
delegation gives them. k3s starts without flannel and its network
policy controller, with the VPC's range as its cluster CIDR, and the
node's entrypoint sets up the rest before k3s starts: the CNI plugins
the image ships, linked where containerd looks with flannel off, a
bridge holding each prefix's gateway address, host-local handing out
the prefixes, proxy ARP on the interface holding the node's VPC
address, as the VPC delivers a prefix's traffic to its interface, and
SNAT for traffic leaving the VPC only. Inside the VPC pods keep their
own addresses, so Floci's health checks and load balancers reach them.

The IMDS and Pod Identity rules for pod traffic match the prefixes
instead of 10.42.0.0/16. A surviving node started with another pod
network, or with prefixes it no longer holds all of, is replaced on its
data volume, as one with another capacity is. disable-cni, or a node
without an address or prefix in a Docker-backed subnet, keeps k3s's
own network, with a warning.

Closes #5929
2026-11-23 14:10:18 -04:00
Priamo Germosen 20e0ca6946 feat(eks): lease VPC /28 prefixes onto the cluster node's interface (#9279)
The Amazon VPC CNI plugin's prefix delegation hands a node IPv4 /28
prefixes of its subnet, listed on the node's network interface, and the
AWS Load Balancer Controller finds the interface behind a pod address
by looking for the prefix that holds it.

With floci.services.eks.vpc-pod-network, a node holding an address in a
Docker-backed subnet now also leases vpc-pod-prefixes /28 prefixes of
that subnet, two by default, as a node running pods holds under the VPC
CNI's default WARM_PREFIX_TARGET of one. DescribeInstances and
DescribeNetworkInterfaces list them on the node's interface in
ipv4PrefixSet.

EC2 leases a prefix from the top of the subnet down, clear of the
subnet's last address and of every address something holds, Docker's
own container addresses on the VPC network included, and counts its
sixteen addresses as held, so no instance or interface gets one and
AvailableIpAddressCount leaves them out. The node keeps its prefixes
across a restart as it keeps its address, re-reserving them; an adopted
node leases no new ones, and a stopped or failed start gives them back.

Part of #5929
2026-11-23 12:24:45 -04:00
Priamo Germosen 39fbc98efe feat(eks): give the cluster node instance its primary network interface (#9273)
An EKS node's primary network interface carries the cluster security
group, and the AWS Load Balancer Controller reads both from the node's
instance: it finds the interface behind a pod address there and opens
the target's ports on that group. Floci's node instance had neither.

A node holding an address in its subnet now has a primary interface
there, at that address, holding the cluster security group, and the
instance holds the group too. A node without one, whose address is then
its container's on another network, has no interface. DescribeInstances
reports them, and DescribeNetworkInterfaces lists the interface as it
lists an instance's launch-created one, with the same filters. Its ids
derive from the cluster, so they survive a restart.
ModifyNetworkInterfaceAttribute and the IPv6 address calls on it are
refused with OperationNotPermitted, as the node's lifecycle actions are,
and the cluster security group cannot be deleted while the node holds
it.

EC2 keeps a copy of the node once an action such as
ModifyInstanceAttribute is stored. The copy now keeps only what such
actions change: its interfaces are its own, so a change no longer
reaches the record the cluster serves, and the node's address, subnet
and interfaces follow the cluster, which may replace the node. The copy
is stored only while the cluster serves the node. Deleting the cluster
ends the node in EC2 as terminating it would: the copy is dropped, and
volumes attached to the node are detached, or deleted when their
DeleteOnTermination is set. Otherwise the copy would stay a running
instance holding the cluster security group, and the volumes in use.

Part of #5929
2026-11-23 11:04:27 -04:00
Alexy Grabov 624f1304d2 fix(ec2): preserve established host connections on ingress revoke (#9186)
With security-group enforcement on, revoking the last world-open ingress rule closes the relay's host listener at once and keeps the connections it already accepted, as AWS keeps tracked connections. When the instance's egress allows TCP to every address and port in the family the relay uses to reach the guest, AWS does not track those flows, so the revoke removes the relay and closes them immediately. A listener that cannot be closed falls back to removing the relay, one instance's failure no longer skips the group's other instances, and stop or terminate removes any draining relay. Ec2PublishedConnectionNightlyIntegrationTest covers both cases.
2026-11-22 14:53:21 -04:00
Andre Kurait a6a609d62f fix(ec2): report the network interface IPv6 address (#9027)
An ENI could have IPv6 addresses assigned while its top-level
ipv6Address was missing from CreateNetworkInterface and
DescribeNetworkInterfaces. The shared serializer now reports the first
assigned address there, keeps the ipv6AddressesSet list, and omits the
field when the interface has none.

Ported from Emanuel Aseghehey's AndreKurait/floci#1239.
2026-11-19 20:36:25 -04:00
Andre Kurait 875794c538 fix(iam): select EC2 interface and endpoint authorization resources (#8892)
* fix(iam): select EC2 interface and endpoint authorization resources
2026-11-19 19:24:56 -04:00
Niels Kootstra a25c0435ee fix(ec2): list the DynamoDB gateway endpoint service in DescribeVpcEndpointServices (#9016)
* fix(ec2): list the DynamoDB gateway endpoint service in DescribeVpcEndpointServices
2026-11-19 18:44:04 -04:00
Andre Kurait 7c2018ffd6 feat(ec2): create and list network interface permissions (#8891) 2026-11-19 00:28:03 -04:00
Simone b5f29c8434 fix(ec2): Returning origin-facing prefix list for ec2 (#8652)
DescribeManagedPrefixLists and GetManagedPrefixListEntries now include the AWS-managed com.amazonaws.global.cloudfront.origin-facing list (pl-3b927c52) with the 49 CLOUDFRONT_ORIGIN_FACING IPv4 ranges of ip-ranges.json, in commercial-partition regions only; China, GovCloud and the other partitions keep only the S3 and DynamoDB lists, and an accepted unknown region takes the deployment's partition. Like those lists, its MaxEntries is its entry count; the security-group rule quota is tracked in #8790. A prefix-list catalog that already declares the list keeps loading, the built-in list serving it.

Closes #8634
2026-11-18 21:27:15 -04:00
saranya15js 90b6d46317 fix(ec2): settle interrupted lifecycle states and prune terminated instances (#8779)
* fix(ec2): settle interrupted lifecycle states and prune terminated instances
* fix(ec2): address review findings on lifecycle recovery and pruning
* test(ec2): use Awaitility in the EC2 lifecycle tests
2026-11-18 07:49:13 -04:00
luiseterc f511cd8a44 fix(ec2): authorize launch template names against stored resource ARNs (#8850) 2026-11-18 07:27:48 -04:00
luiseterc 8349e690ca feat(ec2): add AMD and Intel instance metadata (#8752)
DescribeInstanceTypes now knows 61 virtual sizes of M7a, M8a, M7i, M8i, C7a and C7i, captured in us-east-1 on 2026-11-17: their vCPUs, memory, x86_64 architecture, AMD or Intel manufacturer and network limits, 24xlarge and 48xlarge included. One integration test checks both the Graviton and the x86 captures through the API, and the catalog inventory takes its expected names from those captures.

Closes #8755
2026-11-17 14:39:24 -04:00
Priamo Germosen 94fcf5cbf3 fix(lambda): hold the subnets a function's VpcConfig names (#8609)
On AWS a function's Hyperplane network interfaces sit in the subnets
its VpcConfig names, and EC2 refuses DeleteSubnet, and so DeleteVpc,
while one is there. Floci's Lambda never told EC2 a function used a
subnet, so DeleteSubnet succeeded under a VPC-configured function and
left it naming a subnet that was gone.

- LambdaService is a VpcDependencyProvider: a function of the caller's
  account, or a published version of one, holds each subnet its
  VpcConfig names and the VPC it is configured in
  (LambdaFunctionStore.listWithVersionsForAccount, which also reads a
  record stored before accounts were kept apart, unprefixed until it
  is next read).
- CreateFunction and UpdateFunctionConfiguration save a function that
  names subnets under EC2's subnet lock, so a DeleteSubnet either sees
  it or runs before it is stored. A VpcConfig the request set is
  resolved again under the lock, so a subnet deleted since the request
  was validated is unknown, as one never created is, and the function
  infers no VPC from it.

ECS awsvpc tasks already hold their subnet through the network
interface each task is given, which DeleteSubnet counts.

LambdaVpcResourceValidationIntegrationTest has DeleteSubnet refused
under a function, then under its published version once $LATEST moves
to another subnet, and allowed once the version is deleted, and a
subnet deleted while a function is created leaves it no inferred VPC.
LambdaFunctionStoreAccountScopeTest covers the unprefixed record.
ec2.md and lambda.md say so.
2026-11-16 15:04:43 -04:00
Priamo Germosen d8460bc305 feat(ec2): publish ports open to every address under security-group enforcement (#8610)
With security-group enforcement on, the socat publisher was switched
off, so an application port a security group opened was never reachable
from the host. Docker can replace a host client's address (Docker
Desktop shows every client as its gateway), so no rule narrower than the
whole internet can be judged on it.

Host-published access now counts as traffic from outside the VPC: with
enforcement on, a port is published only when an ingress rule opens it
to 0.0.0.0/0, or failing that ::/0, which admit a client whatever
address it arrives with. The sidecar dials the instance through its
protected namespace's helper, on the helper's network: on its IPv4
address, or on its Docker IPv6 address for a port only ::/0 opens, which
is not published on a network without IPv6. A client's family is still
seen on the host, so a port only one family's rule opens binds only that
family's host addresses. A port whose rules move family is republished,
the family is persisted for restore, and a restart brings each running
instance's forwards in line with its current rules. Ports opened after
launch publish and revoking removes them, as with enforcement off; a
port only a narrower CIDR, a prefix list or a group reference opens
stays reachable on the direct container path.

Also brings Ec2ServiceTest's never-allocates check onto the
three-argument allocatePrivateIp that #8598 introduced, which left
main's tests not compiling after #8576.
2026-11-16 13:26:43 -04:00
Priamo Germosen bb6b308fdb fix(ec2): give each account's VPC its own Docker network (#8598)
VpcNetworkManager keyed its VPC bindings, subnets and Docker networks
by Region and id alone, and every account's default VPC and subnets
share one id (vpc-default-<region>), so two accounts' default VPCs
shared one binding, one Docker network and one lease table: EC2
instances, Lambda functions, ECS tasks, EKS nodes and the MWAA,
CodeBuild and Batch containers of two accounts landed on the same
bridge. Ec2Service worked around the shared lease table by counting
every account's resources as holding the subnet's addresses.

- VpcNetworkManager takes the account on every call and keys bindings
  and subnets by account, Region and id. A network carries the account
  in its labels and, for any account but the default one, in its name;
  the default account's keeps the name it always had, so its live
  networks outlive the upgrade. A surviving network of another
  account's VPC of the same id is a collision, as another Region's is.
- Startup reconciliation asks which accounts declare a VPC of an id in a
  Region (DeclaredVpcs). A labelled network is kept while its account
  declares the VPC; one an older version labelled with no account
  belongs to the account declaring its VPC, the default account first,
  and a non-default account's VPC keeps using that account-less network,
  so its live containers stay attached across the upgrade.
- Ec2Service passes the caller's account, and the restore each stored
  VPC's, subnet's and instance's own. The helpers other services call
  (allocate, reserve, release, attach, detach) take the owning account
  and run as it, as a caller may run outside the owner's request: a
  provisioned or cross-account Lambda launch, a container removed in
  the background. Lambda, ECS, EKS and VpcContainerLeases (MWAA,
  CodeBuild, Batch) pass the account they already hold; Lambda's and
  EKS's leases carry it to their release.
- An address is held by the caller's account's resources alone, as its
  network and lease table are its own: the every-account holding check
  goes, and the container lease map is keyed by account.

VpcNetworkManagerTest covers two accounts' default VPCs getting a
network each (the second's identical CIDR substituted), another
account's surviving network as a collision, a labelled network kept
only while its account declares the VPC, and an older version's
unlabelled network kept and adopted for the account declaring it. Ec2ServiceTest's cross-account
tests now pin the per-account holding. ec2.md says so.
2026-11-16 12:11:28 -04:00
Priamo Germosen 3e52c94e39 feat(ec2): enforce security groups on ENI IPv6 addresses (#8593)
With security-group enforcement on, a managed ENI's identity was its
IPv4 address alone, so a rule naming an IPv6 range never matched a peer
on the IPv6 addresses its ENI now holds.

Each protected endpoint now carries its ENI's IPv6 addresses next to the
IPv4 one, and its helper's Docker IPv6 address next to the IPv4
transport. The compiler writes a peer's rules per identity: a rule
matching one of its IPv6 addresses admits it on the IPv6 transport only,
never on the IPv4 one, and on a Docker network without IPv6 there is no
IPv6 identity to match. Every transport a peer has is dropped after its
rules, as the IPv4 one already was. The EC2 and ECS registrations pass
the ENI's IPv6 addresses, the firewall manager reads the helper's Docker
IPv6 address, and AssignIpv6Addresses and UnassignIpv6Addresses update
the ENI's firewall identity. Every Docker address a managed peer has is
dropped after its rules, its IPv6 one included when its ENI holds no
IPv6 address, and an ICMP rule is written only for the family it
belongs to. IPv6 changes to one ENI serialize through their firewall
update; an assign the firewall refuses is taken back out of the store,
and an unassign reaches the firewall before it is stored.

The README now documents enforcement: what it filters, that it needs
rootful Docker with Linux containers, how to turn it on, and that an
application port opened after launch is not published while it is on.

Part of #2564.
2026-11-16 11:29:01 -04:00
Priamo Germosen ed49e63bfa feat(ec2): assign and unassign ENI IPv6 addresses (#8588)
A network interface held no IPv6 address: CreateNetworkInterface ignored
Ipv6Addresses and Ipv6AddressCount, AssignIpv6Addresses and
UnassignIpv6Addresses were not implemented, and nothing reported an
ipv6AddressesSet, so a dual-stack subnet's interfaces looked IPv4-only.

CreateNetworkInterface now takes the named addresses or a count drawn
from the subnet's associated IPv6 block, with a random host part. Left
out, the subnet's AssignIpv6AddressOnCreation gives one address; an
explicit 0 overrides it, as the API reference says.
AssignIpv6Addresses reads Ipv6Addresses.N (the name the SDKs send) or
Ipv6AddressCount, needs one of them, and reports only the addresses it
added; UnassignIpv6Addresses reports only the ones the interface held.
Both work on standalone interfaces and on an instance's launch-created
one. An address outside the subnet's blocks answers InvalidParameterValue
and one another interface holds InvalidIPAddress.InUse; prefix
delegation answers UnsupportedOperation, a list with any count
InvalidParameterCombination, and a reserved address (a block's four first
and its last) InvalidParameterValue. An interface holds at most as many
IPv6 addresses as private IPv4 ones, and a block without enough free hosts
answers InsufficientFreeAddressesInSubnet. DescribeNetworkInterfaces and
DescribeInstances report ipv6AddressesSet, and a supplied interface keeps
its addresses on the instance it launches. Termination now releases
interfaces under the topology lock, and an IPv6 change writes back only
what is still stored.

Part of #2564.
2026-11-16 10:20:41 -04:00
Matheus Oliveira 1dadaee351 fix(ec2): make default network resource IDs region-unique and AWS-format (#7738) 2026-11-16 09:10:33 -04:00
Priamo Germosen 82b7547f0a feat(ec2): support ModifyNetworkInterfaceAttribute (#8532)
ModifyNetworkInterfaceAttribute was not implemented, so a call to change
an interface's security groups, description, source/destination check
or DeleteOnTermination was refused, and with security-group enforcement
on an interface's groups could only change through ModifyInstanceAttribute.

The action now changes a standalone interface or one an instance was
launched with. The group list is read as SecurityGroupId.N, the name the
SDKs and the CLI send. On an instance's primary interface the groups and
the source/destination check are the instance's too. With enforcement
on, a group change reaches the interface's firewall before it is stored,
under the instance's lock, as ModifyInstanceAttribute does, so a policy
that cannot be applied leaves the groups as they were, and the ports the
instance's groups publish are reconciled after a primary-interface change.
The change re-checks the interface and its attachment in the critical
section that stores it, and AttachNetworkInterface and
DetachNetworkInterface now update the standalone record and the instance's
copy under the same topology lock.

ModifyInstanceAttribute no longer overwrites every interface's groups: on
an instance with more than one interface, a group or SourceDestCheck change
answers InvalidInstanceID ("There are multiple interfaces attached to
instance ... Please specify an interface ID for the operation instead."),
the code and message AWS returns, as the Terraform AWS provider quotes them.

The members Floci does not apply (EnablePrimaryIpv6, EnaSrdSpecification,
ConnectionTrackingSpecification, AssociatePublicIpAddress,
AssociatedSubnetIds and the attachment's ENA queue counts) answer
UnsupportedOperation, as ReplaceRoute refuses a target it cannot store,
rather than true with nothing changed.

Part of #2564.
2026-11-16 09:06:59 -04:00
Jackson PriceandAndre Kurait ac6f28a73b fix(ec2): skip raw block cleanup for logical root volumes (#8508)
EC2 deleted a terminated instance's root volume through the raw
block-device helper, though a root has no raw backing: it is the
container's own file system. Volume deletion now takes the same root
check that already skips the detach, so termination and reconciliation
remove a root's metadata and tags without calling the helper, while
data volumes keep their backing-storage cleanup. Failed-launch rollback
records the launch's root volume ids before terminating, so a root that
DeleteOnTermination=false kept, or that reconciliation detached first,
is deleted the same way.

Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-15 18:17:50 -04:00
Matheus André ea594d8d2a feat(ec2): CreateSnapshot, DeleteSnapshot and CopySnapshot for EBS volumes (#8360)
EC2 now serves CreateSnapshot, DeleteSnapshot and CopySnapshot for EBS
volumes. CreateSnapshot takes the volume's size and encryption, is owned
by the caller and accepts snapshot tags from TagSpecification.
DeleteSnapshot removes the snapshot and its tags, and refuses with
InvalidSnapshot.InUse while a registered AMI uses it. CopySnapshot copies
from SourceRegion into the request's Region as a new snapshot, encrypted
when the source is, when Encrypted=true or when the destination's
encryption by default says so, without the source's tags. All three
honor DryRun, keeping the error the real call would give.

An unsigned, unversioned CopySnapshot now routes to EC2, since Floci's
ElastiCache does not serve it. RegisterImage builds its snapshot records
through the same helper.

Closes #7943
2026-11-15 14:14:27 -04:00
Priamo Germosen 2fa6deb0d8 fix(ec2): serve placement/availability-zone-id from instance metadata (#8405)
IMDS answered /latest/meta-data/placement/availability-zone but not
availability-zone-id, which AWS serves and scripts read to pick
zone-specific resources. It now returns the zone's ID, the same one
DescribeSubnets and DescribeAvailabilityZones report for that zone.
2026-11-14 23:16:43 -04:00
Priamo Germosen 246d82ec57 fix(ec2): word an AMI and instance type architecture mismatch as RunInstances does (#8403)
RunInstances already refused an AMI whose architecture the instance type
cannot run, as AWS does, but said "The architecture 'x86_64' of the
specified image does not match the architecture supported by instance
type 'm6g.large'.". AWS names the instance type's architecture first:
"The architecture 'arm64' of the specified instance type does not match
the architecture 'x86_64' of the specified AMI."
2026-11-14 22:33:53 -04:00
luiseterc 16745c3804 fix(ec2): resolve interface identity for tag authorization (#8352)
* fix(ec2): resolve interface identity for tag authorization
* fix(ec2): read resource condition keys through the generated table
* fix(ec2): look up a tag batch's interfaces in one pass
2026-11-14 18:42:23 -04:00
Jimmy Liu Jia 045ecc4eeb fix(ec2): keep guest port 80 available with IMDS (#8225)
The in-guest IMDS relay listened on 169.254.169.254:80, so Apache and
other wildcard port-80 listeners could not start in an EC2 guest. The
relay now listens on its own port, 42169, and an iptables or nft NAT
rule routes local link-local port-80 traffic to it. The guest's own nft
rules are kept, and only Floci's relay rule is added or removed. With no
working NAT backend, the older port-80 listener keeps IMDS available.

A protected instance's restart retires a retained older listener before
the workload starts, and a failed start rolls back the IMDS registration
it made. The network helper image now includes iptables.

Closes #7937
2026-11-14 15:23:23 -04:00
soreavis 66bec3b89b fix(ec2): keep IPAM pool and allocation tags (#8158) 2026-11-14 15:16:29 -04:00
luiseterc a138f88094 fix(iam): resolve EC2 network resources and ownership tags (#8288)
EC2 network operations with resource-scoped policies were checked against
`*`, and stored ownership conditions were missing. Every EC2 request is
now read by the generated request-resource rules, its EC2 Query list
names from botocore, so a resource-scoped policy applies to each EC2
operation whose request names a resource. A list a type's ARN variable
names is the request's targets only when the request names nothing
else, and the sg-, acl-, rtb- and eni- id prefixes come from botocore's
examples.

Each target is evaluated with its own stored tags, under every EC2
type's Service Reference resource-tag keys, and tags on creation are
authorized separately. A forged SDK spelling cannot replace an EC2 wire
value. ENI creation tags are kept in the regional tag index and stay in
sync with CreateTags and DeleteTags.

Closes #8286
Closes #8287
Closes #8291
Closes #8295
Closes #8300
Closes #8306
2026-11-14 13:38:41 -04:00
Jackson PriceandAndre Kurait ae62fe04bc fix(ec2): keep security group rule description updates consistent (#8277)
Signed-off-by: Akash Kurait <akurait@amazon.com>
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-14 11:21:20 -04:00
irodotos7 2dc93aa087 fix(iam): derive EC2 instance authorization from AWS metadata (#8150)
Authorize generated instance targets with their own stored tags before mutation. Return malformed Query errors as XML HTTP 404, reuse enforcement group cleanup, and update generated-target regression coverage. Regenerate IAM metadata on current main.

Closes #8159
2026-11-13 16:05:26 -04:00
Andre Kurait 1820d6470d fix(ec2): preserve security group deletion scope and dependencies (#7920)
* fix(ec2): preserve security group deletion scope and dependencies

Coordinate group publication, attachment and deletion, preserve instance/interface group state, and reject invalid DryRun values before deletion.

Signed-off-by: Andre Kurait <akurait@amazon.com>

* fix(ec2): tolerate absent persisted group dependency fields

Keep unknown-state instance attachments blocking deletion while treating absent dependency collections as empty. Cover all nullable scan fields and missing identifiers without changing normal dependency semantics.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* fix(ec2): roll back failed security group creation

Retain the default rule identity before publication and compensate both group and rule writes when either store fails. Preserve the original exception and record cleanup failures without skipping the remaining cleanup.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* fix(ec2): serialize group rule references with deletion

Acquire the regional topology monitor before the source group monitor while resolving and publishing ingress and egress rules. Keep runtime reconciliation outside the mutation locks and preserve existing unknown-reference compatibility.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* fix(ec2): retain groups used by Instance Connect endpoints

Reject deletion before mutation when an Instance Connect endpoint uses the group. Return CannotDelete for default groups and reuse shared SDK clients in the existing fixtures.

Signed-off-by: Andre Kurait <akurait@amazon.com>

* refactor(ec2): share resource locks and deletion race helpers

Reuse the reference-counted lock lifecycle for volume operations and instance group assignments. Keep scoped keys and lock ordering unchanged. Reuse deletion tasks and blocked-or-done observations without weakening race assertions.

Signed-off-by: Andre Kurait <akurait@amazon.com>

---------

Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-12 20:31:14 -04:00
Allen Sanborn 639fbe38d0 fix(ec2): give privileged systemd guests a private cgroup namespace (#7353)
Systemd guests ran with --cgroupns=host and the host's /sys/fs/cgroup bound
in, so every guest's systemd managed the same cgroup tree as the Docker
host and as each other. Two guests running Kubernetes nodes (kubelet with
the systemd cgroup driver, as Kubernetes The Hard Way configures it)
shared one kubepods.slice: both nodes saw the same inode, and each kubelet
tore down the other's pod sandboxes, so every pod restarted in a loop
(SandboxChanged, "network namespace for sandbox ... is closed").

A private namespace without the bind, as kind runs its nodes, gives each
guest's systemd its own writable subtree, because Docker mounts it
read-write for a privileged container. Measured on OrbStack (cgroup v2):
two guests boot to 'running', each with cgroup 0::/init.scope on a
distinct cgroupfs root.

A guest under security-group enforcement runs unprivileged, and Docker
mounts an unprivileged container's private cgroupfs read-only, where
systemd cannot create its slices. That guest keeps the host namespace and
the read-write bind, so it boots as before; the docs say its cgroups stay
shared.

fix(ec2): keep the IMDS proxy out of a systemd guest's root cgroup

A privileged systemd guest now has a private cgroup namespace, and a
docker exec lands in that namespace's root. Floci leaves its link-local
IMDS proxy (socat) running from such an exec, so the guest's root cgroup
held a process. cgroup v2 will not enable controllers in a cgroup's
subtree_control while it holds processes, so the root's stayed empty and
kubelet with the cgroupfs driver died creating kubepods.slice
("openat2 /sys/fs/cgroup/kubepods.slice/pids.max: no such file or
directory"). Whether a node hit it depended on whether anything else
enabled the controllers before the proxy started.

The proxy's install and start scripts now move their own shell into the
leaf /sys/fs/cgroup/floci first, so socat and everything else they start
stay out of the root. They do so only at the root of a cgroup v2
namespace whose cgroupfs is writable; a host-namespace container, a
cgroup v1 host and a read-only mount run as before. A plain directory
rather than systemd-run, because the proxy starts while the guest's
systemd may still be booting, and systemd neither reaps nor moves a
cgroup it did not create. EKS's pod-identity proxy shares the script.

The Docker integration test launches a privileged systemd guest through the real
container spec. It now also reads /proc/self/cgroup, which must be 0::/ at the
namespace root, and creates and removes a directory under /sys/fs/cgroup, so
native Linux CI fails if the guest falls back to the host cgroup namespace.

Rewrap the class javadoc, rename the test to cover both the modules and the
cgroup namespace, and comment what each cgroup probe does and does not prove.
2026-11-12 11:28:20 -04:00
Allen Sanborn 475fb1822a feat(ec2): EC2 Instance Connect Endpoint tunnel (open-tunnel / eice SSH over WebSocket) (#7519) 2026-11-11 14:08:37 -04:00
Andre Kurait 0e244e5724 feat(ec2): delete launch template versions without reusing numbers (#7910)
Preserve default versions and the highest issued version across deletion, persistence and CloudFormation rollback.

Reject invalid DryRun values before deletion, tolerate only already-deleted versions during CloudFormation rollback, and preserve the resolution race fixture without reflective field mutation.

Reuse presence checks to retain name-specific disappearance errors and existing service-test factories.

Reuse existing EC2 test factories and the shared blocked-or-done wait while preserving all race assertions.

Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-11-10 15:50:33 -04:00
Jackson Price 3700a6b6fa fix(ec2): offer i4i.large in the instance type catalog (#7824) 2026-11-09 13:13:00 -04:00
Jackson PriceandAndre Kurait 068740794a fix(ec2): select the subnet VPC default security group (#7762)
Use the existing VPC-specific default-group lookup for instance launch, with
service and SDK placement regressions and documentation.

Source: AndreKurait/floci#524 (94f76eae34e46dc1e740b6349bbaed578a15e372).

Remove the obsolete regional resolver and its dedicated test assertions now
that instance launch uses the VPC-specific lookup. Keep legacy VPC resolution
coverage and remove its unused security-group fixture.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
2026-11-09 13:11:06 -04:00
Allen Sanborn 0de5566d22 feat(ec2): bind the host's /lib/modules read-only into systemd guests (#7354)
A systemd guest shares the Docker host's kernel but ships none of its
modules, so `modprobe br_netfilter` (Kubernetes node setup, e.g. Kubernetes
The Hard Way lab 9) fails with "Module not found in directory
/lib/modules/<kver>" even when the module is built in. kind binds the
host's tree the same way. Docker creates a missing bind source as an empty
directory, so hosts without /lib/modules still launch.

Privileged systemd guests can now load any module in that tree into the
shared host (or Docker Desktop / OrbStack VM) kernel, so docs/services/ec2.md
carries a warning saying so.

test(ec2): prove a systemd guest gets /lib/modules read-only on a real daemon

Ec2SystemdGuestDockerIntegrationTest launches through the real
Ec2ContainerManager container spec against Docker, with an Alpine image
standing in for a systemd cloud image (its busybox /sbin/init stays up as
PID 1), and checks the mount both from the daemon's inspect and from the
guest's /proc/mounts. It is skipped when Docker is unavailable.

docs/services/ec2.md now says that on Docker Desktop or OrbStack the tree
is the VM's and may not match its running kernel, and states exactly when
an instance runs privileged: only with security-group enforcement off. With
enforcement on, the guest joins the protected namespace unprivileged, and a
namespace that cannot be created fails the launch.

docs(ec2): say the read-only modules mount does not bind a privileged guest; keep test cleanup from masking failures

The read-only bind keeps an unprivileged guest from changing the tree, but a
privileged guest can remount it read-write, so the first paragraph no longer
claims the guest cannot load a module the host kernel lacks.

The systemd guest test now logs a failed container removal instead of
throwing it over the assertion error it is reporting.

fix(ec2): bind only the running kernel's /lib/modules dir into systemd guests; tear down the integration test via terminate()

test(ec2): pin that the guest's /lib/modules outside the bound kernel dir stays writable; document missing-dir and linux-modules caveats
2026-11-08 18:24:08 -04:00
Suja Shaj e27a307622 fix(cloudformation): give an instance its launch template's instance profile (#7761)
An AWS::EC2::Instance that names a launch template took the template's
image, type, key and metadata options but never its IamInstanceProfile,
so describe-instances showed no profile. When the instance declares no
profile of its own, it now launches with the template's, resolved the
same way RunInstances resolves it. The instance's own profile still wins.

A stack update that moves the instance to a template version naming
another profile, or none, changes or removes the profile in place, and a
dropped LaunchTemplate removes the profile it supplied. A rollback of an
update that changed the profile, whether the instance or its template
declared it, now puts the previous profile back instead of ending
UPDATE_ROLLBACK_FAILED.

Part of #7603
2026-11-08 05:25:15 -04:00
Robert Stupp a99119e3b9 fix(ec2): report block-device attachment failures (#7690) 2026-11-07 02:05:34 -04:00
Hector Ventura 7cf443fcee chore: rename the package to io.floci.aws (#7689)
Move the Java sources from io.github.hectorvent.floci to io.floci.aws, matching io.floci.gcp, io.floci.az and io.floci.oci. Generated by tools/rename/rename_package.py apply on the base commit, with no other edits.

Logger categories and the arn.fail-on-blank-region property move to the io.floci.aws prefix. The pom groupId becomes io.floci; the artifactId stays floci.

Refs #6589

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-06 11:07:21 -04:00