[FEAT] Serve every AWS partition (aws-cn, aws-us-gov, aws-iso*, aws-eusc) from AWS's published partition data
Service
Core (core.common): ARNs, hostnames, regions, service principals, managed policies, STS/IAM global model. Touches every service that mints an ARN or a hostname.
API Action / Feature
Full multi-partition support. Floci today is a commercial-partition (aws) emulator with partial partition awareness: regionless ARNs (IAM, STS, S3, CloudFront, Organizations) are minted arn:aws: in every deployment, isForeignPartition is literally !"aws".equals(...), and src/main carries 174 arn:aws: literals, 16 hardcoded hostname patterns, us-east-1 assumptions and single-value per-region tables. The goal is that a deployment started with FLOCI_DEFAULT_REGION=cn-north-1 (or any region of the eight partitions), and a request signed for such a region, get the partition AWS would give them: arn:aws-cn:..., amazonaws.com.cn hosts, that partition's region list, and the services it publishes.
Backward compatibility is non-negotiable: a us-east-1 deployment with unsigned or us-east-1-signed requests produces byte-identical output after every phase.
AWS Documentation
- AWS General Reference, partitions: https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html
- ARN format and the partition segment: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html
- The data every SDK resolves endpoints from (botocore, MIT):
partitions.jsonhttps://github.com/boto/botocore/blob/develop/botocore/data/partitions.json andendpoints.jsonhttps://github.com/boto/botocore/blob/develop/botocore/data/endpoints.json - Service principals are
<service>.amazonaws.comin every partition (AWS CDKregion-info): https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/region-info/lib/default.ts
Why is this needed?
Teams deploying to China, GovCloud or the EU Sovereign Cloud run the same SDK code with a different default region, and today Floci hands back arn:aws: ARNs, commercial hostnames and the commercial region list, so anything that compares or parses those values (IAM policies, CloudFormation AWS::Partition, S3 website URLs, trust policies, VPC endpoint service names) diverges from what the same code sees against AWS. The design decisions and the grounding for each phase live in a local plan; the short version:
- One deployment partition, derived from the default region, pinnable with
FLOCI_PARTITIONS_ID; startup refuses a contradiction. - Per-request partition from the SigV4 credential scope region, as LocalStack and moto do it, so one process can serve several partitions. The scope region of a global service is a signing region only, never a place to put regional resources.
- Nothing hand-typed:
aws/partitions.jsonandaws/region-facts.jsonare generated from botocore and the CDK/Terraform tables and CI-checked; open questions without a published source (China CloudFront distribution suffix, non-commercial STS audiences, console client ids) are printed escapes or docs rows, never guessed values. - A CI guardrail so the commercial assumption cannot grow back: a per-file baseline of partition literals in
src/mainthat only shrinks.
Plan and status
Each phase is one PR, in order; every later phase is rebased onto the merged predecessor before it is opened. The baseline count after each phase is the acceptance number.
- P0 Guardrail:
tools/partition/partition_literals.py, baseline.tsv (272 gated literals across 114 files at merge), Makefile targets, python-only workflow. #4270, merged 2026-09-24 - P1 Foundation:
AwsPartitionscatalog from vendoredpartitions.json,AwsPartitionrecord,RegionResolverpartition awareness,RequestContext.partition,FLOCI_PARTITIONS_ID,<partition>-globalpseudo-regions, DescribeRegions from the catalog (17 commercial regions by default, 34 withAllRegions=true), TLS SANs and EKS region lists. Baseline 274 (main had grown by two since P0). #4317, merged 2026-09-24 - P2 Parse sites: partition-tolerant ARN and Step Functions integration-id parsing (
StatesIntegration), IAM policy evaluation,IamEnforcementFilter. Baseline 195. #4358, merged 2026-09-25 - P2b Region validation (added 2026-09-24 from the multi-region audit): a SigV4 scope region no partition publishes or admits by its region pattern is refused with a 400 (S3's
AuthorizationHeaderMalformed,InvalidSignatureExceptionelsewhere), as moto and LocalStack do by default;FLOCI_PARTITIONS_ALLOW_UNKNOWN_REGIONSrestores the old any-label behaviour. Slotted before P3 because P3 mints ARNs from whatever region the resolver accepts. Baseline unchanged. #4393, merged 2026-09-25 - P3 Build sites: every regional ARN minted in the request's partition through
Arn.of; CloudFormationAWS::PartitionandAWS::URLSuffixfollow the stack region; SAM emitsarn:${AWS::Partition}:. S3 bucket-policy checks name the bucket in the partition of its own region, inS3Serviceand under IAM enforcement. Baseline 71. #4444, merged 2026-09-26 - P4 Hostnames:
AwsEndpointsbuilds and recognises hosts in every partition (S3 virtual-host and website forms, execute-api, EMR, dual-stack where published). Baseline 40. #4451, merged 2026-09-26 - P5 Region rules: AWS's CreateBucket
LocationConstraintrules per endpoint region (moto's verified matrix), WAFCLOUDFRONTscope only where CloudFront exists, Lightsail commercial-only. Baseline 40. #4494, merged 2026-09-27 - P6 Region facts: per-region hosted zones (ELB, NLB, S3 website, CloudFront), SAML sign-on URLs and VPC endpoint service prefixes from
aws/region-facts.json, generated from the Terraform provider and the CDK. Baseline 34. #4545, merged 2026-09-29 - P7 Service principals:
ServicePrincipalsuniversal<svc>.amazonaws.com, legacy per-partition forms accepted in policy matching (the CDK's retired table), service-linked role paths. Baseline 4. #4633, merged 2026-09-30 - P8 Managed policies:
AwsManagedPolicies.forPartition, the commercial catalog derived per partition with two substitutions (arn:<p>:and the region-bearingkms:ViaServicehosts). Baseline 3. - P9 STS/IAM global: global STS and IAM ARNs per partition,
GlobalEndpointTokenVersiononly where a global STS host exists,FLOCI_PARTITIONS_STRICTrefusing services AWS publishes in another partition but not the request's (signing-name join overendpoints.json). Baseline 2. - P10 Managed policies, phase 2 (future): the real per-partition policy subsets and whether documents differ in content; needs an in-partition account, no local source can supply it.
P2 to P9 are implemented and verified locally on a stacked set of branches; they will be opened one at a time as the predecessor merges. Baselines below are as measured on 2026-09-23 and shift by whatever main adds in the meantime.
Progress log:
- 2026-09-24: P0 merged (#4270). Note for later phases: the CostAnomalyService regex that landed after the gate (#4221) is fixed in #4314; the
ResourceExplorer2IntegrationTestpartition assertion is scoped to commercial regions until P3 moves the build sites, which tightens it back. - 2026-09-24: P1 merged (#4317). P2b (region validation) added between P2 and P3; the one behaviour change: a made-up scope region is now refused unless the new flag is set.
- 2026-09-24: P2 opened (#4358).
- 2026-09-25: P2 merged (#4358) and P2b merged (#4393). P3 opened (#4444) as a
fix, restoring the strict ResourceExplorer2 partition assertion that P0 relaxed. - 2026-09-26: P3 merged (#4444). Review round: bucket-policy checks in
S3Serviceused the request's partition, so a same-account request signed forcn-north-1could write past anarn:aws:deny on aus-east-1bucket (Greptile, confirmed and fixed); the IAM filter always evaluated S3 asarn:aws:, so a China bucket'sarn:aws-cn:policy was skipped under IAM enforcement, fixed withResourcePolicyProvider.resolveResourceArnre-minting an existing bucket's ARN in its own partition. Found in passing, not partition-related, and noted for a separate issue: under IAM enforcement alone a CopyObject source bucket-policy deny is not enforced. P4 consolidated on current main with the #4444 review follow-ups (Javadoc placement inIamEnforcementFilter, import order inIamAuthValidator, a bounded test-helper loop). - 2026-09-26: P4 opened (#4451).
- 2026-09-26: P4 merged (#4451). Review round: an update to an
AWS::S3::Bucketin a region without S3 dual-stack now drops a staleDualStackDomainName, and CloudTrail S3 data events built off-request (the log writer's own deliveries) take their host and ARNs from the event region. P5 opened (#4494). - 2026-09-27: P5 merged (#4494). Review rounds: a us-east-1 constraint on another regional endpoint is IllegalLocationConstraintException (moto aws_verified); the WAF CLOUDFRONT gate applies to every API operation against the request region, while CloudFormation creates are checked against the stack region. P6 rebased and in verification with the P5 review follow-ups (S3 model citation, S3 docs, Marketplace literals gated per line).
- 2026-09-27: P6 opened (#4545).
Behaviour changes a reviewer will see
All AWS-faithful and tested; each PR names its evidence.
- DescribeRegions lists the 17 commercial regions that need no opt-in by default, and all 34 with
AllRegions=true(P1). - CloudFormation's
AWS::PartitionandAWS::URLSuffixfollow the stack region (P3). - An S3 bucket policy is matched against the bucket's ARN in the partition of the bucket's own region, whatever partition the request was signed for (P3).
WebsiteURLuses the dash form in the nine legacy regions and ends with/;DualStackDomainNameis omitted where S3 has no dual-stack (P4).- CreateBucket on a non-
us-east-1endpoint without aLocationConstraintis a 400IllegalLocationConstraintException, as on AWS; the SDKs always send it (P5). - Network load balancers report their own hosted zone, distinct from the Application one (P6).
- IAM's GetAccountSummary reports
GlobalEndpointTokenVersiononly inaws(P9).
Are you willing to contribute a PR?
- Yes
- No
Source: floci-io/floci