Commit Graph
1986 Commits
Author SHA1 Message Date
Vũ Thế Huy 11d04276a3 refactor(core): move library usages to imports (#3873) 2026-09-18 23:53:35 -05:00
Priamo Germosen bbaf3568c5 feat(codeartifact): support publishing and reading generic-format package versions (#3839)
Adds PublishPackageVersion, DescribePackageVersion, and GetPackageVersionAsset
for CodeArtifact's generic package format, matching AWS's own wire restriction
that PublishPackageVersion accepts only the generic format. Includes real
asset hashing (MD5, SHA-1, SHA-256, SHA-512), SHA-256 integrity verification
against the caller's x-amz-content-sha256 header, correct Unfinished/Published
status transitions, and the documented AWS quotas for this action (350 assets
per version, 5 GB max asset size), all returning ServiceQuotaExceededException
when exceeded.

Asset bytes are kept out of the JSON/WAL-backed package-version store
(@JsonIgnore on PackageAsset.content) and instead go through a dedicated
asset store, a disk file in persistent/hybrid/wal mode or a side map in
memory mode, the same split S3Object/S3Service already uses for object
bytes. Without this, a publish rewrote every asset of every package version
on disk each time, growing quadratically under this action's own
350-asset/5GB quotas. The asset name is also validated against the wire
model's AssetName pattern (no control characters), not just its length,
since it is echoed back verbatim in the X-AssetName response header on
GetPackageVersionAsset.

Verified against the real botocore service-2.json wire model and the AWS
CodeArtifact User Guide (including its PDF for the quotas table, since the
HTML quotas page is JS-rendered). Live-verified with the real AWS CLI and
the AWS SDK for Java v2 against a running Floci instance, including an exact
byte-for-byte asset round-trip and the real ConflictException when
republishing an already-Published version.
2026-09-18 23:49:21 -05:00
Priamo Germosen e190f7d340 feat(iam): implement CreateLoginProfile, UpdateLoginProfile, DeleteLoginProfile (#3865)
* feat(iam): implement CreateLoginProfile, UpdateLoginProfile, DeleteLoginProfile

GetLoginProfile previously existed as a permanent stub always returning
NoSuchEntity, and the docs claimed the other three actions were supported
even though the query handler had no case for them at all.

Adds a LoginProfile model and the full lifecycle on IamService: a user
holds at most one login profile, Create/Get/Delete default UserName to
the caller's resolved identity (matching AWS), Update requires it
explicitly, and Update leaves an omitted field (Password or
PasswordResetRequired) unchanged rather than resetting it. The password
is validated against AWS's wire character-class/length rule and, when
the account has one, against the existing account password policy
(PasswordPolicyViolation).

Verified against the real AWS IAM API reference for all four actions'
request/response shapes and error lists.

* fix(iam): block DeleteUser on a login profile and carry it through UpdateUser rename

Login profiles now persist, so deleteUser left an orphaned profile that a
recreated user of the same name would inherit, and a rename dropped the
profile. DeleteUser now returns DeleteConflict while a login profile
exists, as AWS does, and UpdateUser moves the profile to the new name.
2026-09-18 23:49:11 -05:00
Priamo GermosenandJason van Zyl 052da93515 fix(ec2): store omitted tag values as empty strings (#3880)
* fix(ec2): store omitted inline tag values as empty strings

* fix(ec2): normalize omitted tag values on CreateTags and every tag-spec path

---------

Co-authored-by: Jason van Zyl <jason@vanzyl.ca>
2026-09-18 23:49:02 -05:00
Priamo GermosenandJason van Zyl 75fee00adc fix(ec2): delete VPC default security group, route table and network ACL with the VPC (#3878)
* fix(ec2): delete VPC default security group, route table and network ACL with the VPC

* test(ec2): check deleted VPC defaults by VPC scope instead of by ID

---------

Co-authored-by: Jason van Zyl <jason@vanzyl.ca>
2026-09-18 23:48:38 -05:00
Hector Ventura 25fc8e452f refactor(cloudformation): move ApiGateway v1 core types into ApiGatewayRestApiCfnProvisioner (#3885)
Move the six coupled REST API Gateway types (RestApi, Resource, Method, Deployment, Stage, Authorizer) out of the CloudFormationResourceProvisioner monolith into a new ApiGatewayRestApiCfnProvisioner. The shared OpenAPI Body and BodyS3Location resolver, used by both AWS::ApiGateway::RestApi and AWS::ApiGatewayV2::Api, is extracted into OpenApiDocuments so the monolith's V2 arm reuses it rather than keeping a copy. With the v1 arms gone, the monolith no longer needs its apiGatewayService dependency, so that constructor parameter is dropped.

The move preserves Ref, but it is not a pure move for Fn::GetAtt: it also resolves four keys the monolith never populated. Once a type is owned by a registry provisioner, CfnSchemaCoverageTest requires every readOnly attribute to be published or recorded as a gap, so the new provisioner sets RestApiId, ResourceId, AuthorizerId and DeploymentId, which previously resolved to the literal "Logical.Attr". RootResourceId was already set. The inventory tsv, fixture wiring and a focused unit test cover the six types.
2026-09-18 23:39:14 -04:00
Hector Ventura 21beccceb1 fix(cloudformation): reconcile or replace EC2 instances on stack update (#3884)
AWS::EC2::Instance provisioning launched a new instance on every UpdateStack, leaking the prior one and breaking Ref. Reuse the existing instance when no createOnly property changed, republishing its attributes and reconciling its tags in place. Replace it only when ImageId, SubnetId or KeyName differs, recording the displaced instance through ReplacementCleanup so the stack removes it after the update commits.

The reuse lookup tolerates a prior instance terminated out of band: describeInstances raises InvalidInstanceID.NotFound for an unknown id, and a terminated instance lingers in the store, so both fall back to launching a fresh instance instead of failing the update or pointing Ref at a dead instance. Republishing an instance's attributes now clears the ones it does not set, so a replacement never inherits the prior instance's PublicIp or DNS names.

Deferred: mutable properties are not applied to a reused instance in place (SecurityGroupIds, UserData, IamInstanceProfile), an in-place InstanceType change is not applied, and createOnly changes to properties the provisioner does not read (PrivateIpAddress, AvailabilityZone) do not force replacement.

Refs #3810
2026-09-18 23:36:46 -04:00
TATSUNO “Taz” Yasuhiro ec4943380b refactor(kms): split KmsService by key type (#3882)
* refactor(kms): split crypto per key type

* refactor(kms): reduce redundant comments
2026-09-18 23:24:22 -04:00
Vũ Thế Huy fbc0d4d3f2 fix(cloudformation): update nested stacks in place (#3859) 2026-09-18 21:51:38 -05:00
Vũ Thế Huy 29b601834b feat: add DynamoDB to Redshift zero-ETL replication (#3872)
* feat: add DynamoDB to Redshift zero-ETL replication

* fix(redshift): preserve zero-etl account polling state

* fix(redshift): preserve zero-etl target account
2026-09-18 22:35:10 -04:00
TATSUNO “Taz” Yasuhiro 82a3c1dbac feat(dynamodb): improve PartiQL grammar coverage (#3798)
* feat(dynamodb): improve PartiQL grammar coverage

An attribute reference is now a path, so a.b and a[0] work in SELECT columns,
WHERE conditions and UPDATE SET and REMOVE targets. SELECT reports a path from
its last named component on, so SELECT a.b[0] answers b[0].

Values take map, list and set literals, exponent numbers and a doubled single
quote. An empty set, a mixed set and a set with a repeated member are refused
in the AWS words.

WHERE takes OR, NOT, parentheses, IN with a list literal, IS MISSING and IS
NULL with their negations, and the contains, attribute_type and size
functions. Each becomes the matching filter or condition expression, so the
existing evaluator does the work.

UPDATE SET takes a sum or difference, list_append, set_add and set_delete. A
predicate beside the key equality becomes a condition on the write, so a false
one answers ConditionalCheckFailedException and leaves the item. UPDATE is not
an upsert and needs the key to hold an item already, while a DELETE on a key
holding no item stays a no-op. A clause omitting a key attribute says so.

RETURNING runs all four variants on UPDATE and ALL OLD * on DELETE. It answers
one row on Items, and no row when the projection is empty. DELETE refuses the
other three and ExecuteTransaction refuses the clause outright.

SELECT takes ORDER BY on the key, pages the sorted rows, and refuses the shapes
AWS refuses. A FROM path takes at most two components and no empty one. INSERT
refuses an index qualifier as a parse error, UPDATE and DELETE refuse the
operation on an index, and a keyed read filtering on an attribute the index
does not project is refused.

ExecuteTransaction runs a transaction of nothing but SELECT as a read, runs
EXISTS as a condition check, refuses a mix of reads and writes, and no longer
applies twice on a replayed ClientRequestToken. A BatchExecuteStatement member
carries the short error code and echoes TableName when it reached its table.

Two update engine bugs came out of this and are fixed for UpdateItem as well.
list_append on a nested path wrote a new top-level attribute, and ADD or DELETE
with an operand of another type replaced or ignored the stored value.

* fix(dynamodb): read key equalities inside a grouped AND in PartiQL

* fix(dynamodb): subtract without spaces and refuse trailing tokens in PartiQL

* fix(dynamodb): refuse a negative list index in PartiQL

* fix(dynamodb): refuse a non-string type in PartiQL attribute_type

* fix(dynamodb): refuse a value that is not a set in PartiQL set_add and set_delete

* fix(dynamodb): refuse duplicate members in a PartiQL bag

* fix(dynamodb): check PartiQL parameters before reading the statement

* fix(dynamodb): refuse two PartiQL reads of one item in a transaction

* fix(dynamodb): read only by the key in a PartiQL transaction SELECT

* fix(dynamodb): check unprojected attributes inside grouped PartiQL conditions

* fix(dynamodb): refuse an ADD or DELETE operand type before reading the item

* fix(dynamodb): skip line and block comments in PartiQL

* fix(dynamodb): apply a sign to a PartiQL number literal

* fix(dynamodb): refuse a parameter inside a PartiQL collection literal

* test(dynamodb): read a parameter in IN on a non-key attribute

* fix(dynamodb): refuse a PartiQL list index above the integer range

* fix(dynamodb): refuse a PartiQL literal nested 32 levels deep

* fix(dynamodb): refuse a non-number literal in PartiQL arithmetic

* feat(dynamodb): read attribute_exists and attribute_not_exists in PartiQL

* feat(dynamodb): compare a PartiQL condition with a boolean

* fix(dynamodb): match nothing when ordering a value against another type

* fix(dynamodb): read PartiQL key conditions spread over OR and IN like AWS

* fix(dynamodb): read a PartiQL transaction or batch SELECT only by its key

* fix(dynamodb): refuse two values for one key on a PartiQL write

* fix(dynamodb): cancel a PartiQL transaction that names a missing table

* fix(dynamodb): cancel a PartiQL transaction whose statement does not name one item

* fix(dynamodb): refuse a write that leaves an item nested too deep

* fix(dynamodb): refuse a PartiQL parameter only past the nesting limit AWS uses

* chore(dynamodb): drop comments that restate the code or a test

* perf(dynamodb): work out each PartiQL key branch once and cap how far it spreads

* chore(dynamodb): share one first key value helper across PartiQL key checks

* chore(dynamodb): throw the ADD or DELETE operand error and merge member loops

* chore(dynamodb): track PartiQL literal depth in one place and share truth helpers

* test(dynamodb): name the quoted table once and add statement and putItem overloads

* fix(dynamodb): cap IN operands and decomposed reads in PartiQL
2026-09-18 21:04:16 -05:00
XuJianandxujiantop-crypto 0142d443ac feat(cloudformation): provision CloudWatch log streams (#3869)
* feat(cloudformation): provision CloudWatch log streams

* fix(cloudformation): preserve conditional log stream name omission

---------

Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-18 20:45:44 -05:00
Priamo Germosen 86f3084ff0 refactor(s3): dedupe XmlElement child-count helper (#3844)
S3AnalyticsConfiguration and S3InventoryConfiguration each carried an
identical private count(XmlElement, String) helper (#3843), a
follow-up from review of #3835/#3836. That review comment also
suggested the two share a second Filter grammar of their own, but
checked against botocore: AnalyticsFilter supports Prefix/Tag/And
(the same shape #3835 covers) while InventoryFilter is Prefix-only,
so there's no real Filter-grammar duplication between these two to
extract, only this helper.

Turned it into an instance method on XmlElement itself in XmlParser,
alongside the existing child() method, rather than a second static
utility: it belongs on the type both files were already calling
.child()/.children() on. Updated both call sites from count(x, "Y")
to x.count("Y") and removed each file's own copy.

Also looked at the Destination/S3BucketDestination builders both
files have; left them separate since the actual fields differ
(AccountId vs BucketAccountId, different supported Format lists,
Encryption only on Inventory's side), and forcing a shared shape
across those differences would be a worse abstraction than three
similar lines.

No behavior change: verified against both configuration types' unit
and integration test suites plus XmlParserTest.
2026-09-18 20:17:44 -05:00
TATSUNO “Taz” Yasuhiro df3ce4a198 perf(iam): find sessions across accounts without scanning every session (#3881)
A request signed with temporary credentials resolves its account before the
request context exists. IamService found the session with scanAllAccountsAsMap,
which copied every session of every account into a map on each such request,
even with IAM enforcement off. Expired sessions leave the store only when they
are looked up, so this cost grew over time.

The session lookup now uses findAnyAccount. AccountAwareStorageBackend keeps
the set of accounts that own keys, so findAnyAccountEntry does one get per
account instead of a scan. The first cross-account lookup builds the set with
one scan, and later writes add their account. A store that never looks across
accounts pays one volatile read per write. Accounts are never removed, so a
stale one only costs a missed get.

findAnyAccountEntry now reads the caller's partition from the delegate and
calls get only when un-prefixed legacy data exists. It no longer waits on the
store monitor that the legacy migrations hold.

The S3, EC2 and Route53 callers of findAnyAccountEntry use the same path.
2026-09-18 17:38:29 -04:00
Simone Primarosa 0f6b5ee3a2 feat(eks): sign k3s service account tokens with the cluster OIDC key (#3783)
* feat(eks): sign k3s service account tokens with the cluster OIDC key

In real EKS, workloads authenticate via IAM Roles for Service Accounts (IRSA) using projected tokens signed by the cluster OIDC key with audience sts.amazonaws.com. In Floci, k3s launches with default signing flags, meaning it signs in-cluster pod tokens using its own internal auto-generated key under https://kubernetes.default.svc.cluster.local. Because Floci STS verifies tokens against Floci's per-cluster OIDC key and issuer, in-cluster pod tokens cannot be verified, forcing local workloads to use static credentials instead of IRSA.

To bridge this gap, Floci now passes the cluster's per-cluster OIDC keypair and issuer to the k3s container on cluster start and restore. EksClusterManager exports the cluster keypair as restrictive PEM files (0600) into /etc/rancher/k3s/ and configures kube-apiserver with signing keys, dual issuers, and dual audiences (https://kubernetes.default.svc.cluster.local and sts.amazonaws.com). Projected pod tokens now verify cleanly against Floci STS, while internal cluster components continue operating without disruption.

* fix(eks): isolate IRSA signing key files by account and region

Persist cluster OIDC signing keypairs under dataPath/keys/<accountId>/<region>/<clusterName> instead of only clusterName. Because EKS cluster names are unique only within an account and region, same-named clusters across different accounts or regions previously shared host key files, risking key overwrite during startup or restore.

* fix(eks): create signing key files with atomic owner-only permissions

Create the signing key and public key files with PosixFilePermissions rw------- atomically on creation via Files.createFile, avoiding any brief window where private key material is readable with default umask permissions.

* fix(eks): guard webhookPath against null cluster ARN and createdAt

Safely resolve accountId, region, and createdAt with fallbacks in webhookPath when cluster fields are null, and ensure integration tests populate cluster ARN and createdAt.
2026-09-18 17:22:12 -04:00
TATSUNO “Taz” Yasuhiro c603639e0b feat(cloudfront): Support HTTPS locally with correct key id (#3845)
* fix(core): route by the Host header on HTTP/2 requests

HTTP/2 carries the authority in :authority and sends no Host header, so every
lookup that reads Host fell through when a client negotiated HTTP/2. curl, the
AWS SDK for Java and Go, and browsers all do that over HTTPS, which left
CloudFront distribution domains, API Gateway execute-api and custom domains,
Lambda function URLs and Cognito custom domains unreachable over https://.

Copy the authority into a Host header before routing. S3 already covered this in
its own filter.

* feat(cloudfront): serve distributions over HTTPS on local hostnames

A distribution's assigned domain name resolves to nothing local, so a signed URL
could not be downloaded over https:// the way a viewer downloads one from
CloudFront.

Serve every distribution under <id>.cloudfront.localhost.floci.io and
<id>.cloudfront.localhost as well, and add both to the SANs of the generated
server certificate. The first resolves to 127.0.0.1 through public DNS on Linux,
macOS and in containers. The second needs no DNS at all but only resolves where
the runtime handles .localhost itself, which macOS and browsers do and
Debian-based images do not.

* fix(cloudfront): assign lower-case distribution domain names

AWS writes a distribution's domain name in lower case and keeps the id upper
case. Floci put the upper-case id straight into the host name, and a browser
lower-cases the authority it sends, so the rebuilt resource never matched the
one a signed URL was signed for and the download failed with 403.

* refactor(cloudfront): derive the local delivery hosts from the DNS suffixes

The suffix list was a fourth hardcoded copy of the emulator host suffixes, so a
configured FLOCI_HOSTNAME or FLOCI_DNS_EXTRA_SUFFIXES resolved and was covered by
TLS but did not route, and localhost.localstack.cloud did not either. Build it
from the same source the embedded DNS uses.

Match the host inside the scan findByHost already does, by comparing the host to
<id><suffix>, which drops a store read per request and the assumption that the
store keys distributions by an upper-case id. The tests read the default SAN list
from TlsConfigSource rather than copying it.

* fix(cloudfront): issue AWS-shaped public key ids

CreatePublicKey answered a UUID where AWS answers K followed by 13 characters,
the value a signed URL carries as Key-Pair-Id. Verified on AWS us-east-1
2026-09-18: a public key is K2VKB3XV74876Q, while key groups, cache policies,
origin request policies and response headers policies are UUIDs, which Floci
already matches.

* refactor(core): resolve the HTTP/2 authority in each host routing filter

The global Http2HostHeaderFilter made every service depend on a Host
header it wrote, and no service file showed that. RequestHost now returns
the Host header, or the HTTP/2 :authority when there is none. Each filter
that routes by host calls it. S3 and Cognito had their own copy of this
fallback and now use the helper.

* test(core): check host routing over HTTPS and HTTP/2 against the real SANs

The HTTP/2 routing test now boots with a CA-issued leaf that carries the
default SANs. The client trusts only the Floci CA and checks each
CloudFront local delivery host against that leaf. This replaces the
HTTP/1.1 local delivery test, which only set a Host header and never
reached TLS.

S3 drops three resolveHost tests that RequestHostTest now covers. Its
HTTP/2 bucket tests still guard the call to the helper.
2026-09-18 17:01:50 -04:00
lex00 c664b9e136 fix(rds): report the monitoring and lifecycle settings a DB instance was given (#3688)
* fix(rds): report the monitoring and lifecycle settings a DB instance was given

CreateDBInstance and ModifyDBInstance accepted MonitoringInterval,
MonitoringRoleArn, EnablePerformanceInsights,
PerformanceInsightsRetentionPeriod, EngineLifecycleSupport,
EnableCloudwatchLogsExports and MaxAllocatedStorage, then dropped every one of
them. DescribeDBInstances reported none, so a caller that set them read its own
configuration back as absent and treated the instance as changed.

DbInstanceSettings carries the seven, DescribeDBInstances writes them, and each
one takes the default its member documents. MonitoringInterval defaults to 0,
PerformanceInsightsRetentionPeriod to 7 days and EngineLifecycleSupport to
open-source-rds-extended-support. MaxAllocatedStorage and
EnabledCloudwatchLogsExports stay absent when storage autoscaling is off and no
log type is exported, matching what a live account returns. The valid values
each member documents are enforced, so 45 as a monitoring interval and 94 as a
retention period are rejected the way AWS rejects them.

withEffectiveWindows rebuilt the settings through the constructor and would
have dropped the new members, so it now goes through withWindows, which keeps
every member it is not resolving.

* fix(rds): require a monitoring role whenever the interval is not zero

Review feedback on #3688. MonitoringInterval and MonitoringRoleArn are
documented as a pair, in both directions and on both CreateDBInstance and
ModifyDBInstance. An interval other than 0 needs a role, and a role needs an
interval other than 0. The other rules on these members were already enforced
and this was the piece left out.

The check takes the values that will be in effect rather than the ones the
request carried. A modify may raise the interval on an instance that already
holds a role, or attach a role to an instance whose interval is already
non-zero, and judging the request alone would refuse both.

Three tests cover a create with an interval and no role, a create with a role
and a zero interval, and a modify that turns monitoring off while a role stands.
The existing modify test now raises the interval without naming a role, which
proves the effective-value reading.

Also turns the three inline fully-qualified names in the test into imports, per
the review.

* fix(rds): keep ModifyDBInstance to its own monitoring and log-export contract

Two review blockers on #3688, both from ModifyDBInstance being held to
CreateDBInstance's shape.

The pair rule is create-only. CreateDBInstanceMessage words it with "you must
supply a MonitoringRoleArn value" and "you must set MonitoringInterval to a
value other than 0". ModifyDBInstanceMessage drops the "must" from both, and its
MonitoringInterval adds "To disable collection of Enhanced Monitoring metrics,
specify 0" with no mention of clearing the role. Enforcing the pair on a modify
refused the documented way to turn monitoring off, and the previous test pinned
that as if it were correct. It now asserts the opposite.

ModifyDBInstance carries no EnableCloudwatchLogsExports at all. It sends
CloudwatchLogsExportConfiguration with EnableLogTypes and DisableLogTypes,
applied to the stored set as deltas. The shared parser only looked for the
create-only key, so a real request to change exports on a live instance was a
silent no-op. Modify now has its own branch, the way StorageEncrypted and
KmsKeyId already do behind includeEncryption, and LogExportChanges folds the two
lists into what the instance holds.

Three tests cover it. Disabling by interval 0 while the role stands is accepted
and both values are reported. An enable and a disable are applied together. A
modify that omits the configuration leaves the set alone. Neutralising the parse
turns the delta test red.
2026-09-18 16:30:51 -04:00
Hector Ventura 00d1037635 fix(cloudformation): reconcile EC2 security group rules and tags on stack update (#3863)
The security group provisioner was additive only and tag blind: on UpdateStack it authorized newly declared inline rules but never revoked a rule the template dropped, and never read or reconciled Tags. It now revokes, on update, only the inline rules this resource authorized on a prior run (recorded in internal __FlociSg{Ingress,Egress}Rules attributes) and no longer declares, so a rule owned by a standalone SecurityGroupIngress/Egress resource is never touched. Tags are reconciled against the group's current tags on create and update. Second of the EC2 provisioner follow-ups from #3810.
2026-09-18 16:30:30 -04:00
XuJianandxujiantop-crypto de54409fc6 fix(ecs): apply volumesFrom to task containers (#3811)
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-18 14:38:13 -04:00
Vũ Thế Huy 023af51627 feat(redshift): manage master password with secrets manager (#3871)
* feat(redshift): manage master password with secrets manager

* fix(redshift): align managed password contract

* fix(redshift): expose managed password secret arn
2026-09-18 13:55:13 -04:00
Attila Kis 004d562f34 fix(apigateway): return stored method, policy, and stage settings (#3857)
* fix(apigateway): return stored method, policy, and stage settings

Store and return method request parameters, the REST API policy, and stage
access log settings, tracing, and tags. These writes were accepted but never
saved, so Terraform planned the same changes on every run.
Support the patch paths Terraform uses for these fields.
Return the policy escaped the same way AWS does.
Tag stages by their own ARN instead of tagging the REST API.
Add REST regression coverage.

* test(apigateway): add Terraform compat test for REST read-back

Apply a REST API gateway module with Terraform, then check that it converges.
Check that the method, policy, and stage settings read back after apply.
Check that a second apply succeeds and the plan after it has no changes.
Check that changing a request parameter or a stage tag applies and re-plans clean.
Use the deployment trigger hash from the bug report, which used to fail with
"Provider produced inconsistent final plan".
2026-09-18 13:12:25 -04:00
z9rtm e32266537e feat(ecs): support fluentd FireLens routers and s3-hosted FireLens config (#3790)
* feat(ecs): route awsfirelens logs through a generated Fluent Bit router

Start the router first, point awsfirelens containers at the generated unix socket, and store firelensConfiguration as registered.

* feat(ecs): carry FireLens config through CloudFormation and aim outputs at Floci

AWS::ECS::TaskDefinition provisioning now keeps each container LogConfiguration and FirelensConfiguration, so a stack that registers a FireLens router reaches the same launch path as RegisterTaskDefinition.

The generated router points each awsfirelens output at Floci container-reachable base URL through Endpoint, and the app container awsfirelens log config uses fluentd-async, which Docker 28 accepts, instead of the removed fluentd-async-connect.

Only s3, cloudwatch and firehose receive that endpoint: they are the AWS-written Go plugins and parse the value as a URL. The upstream C plugins (cloudwatch_logs, kinesis_firehose, kinesis_streams) hand it to getaddrinfo as a bare host name and always dial TLS, with no output-level switch for either, so a URL is a guaranteed DNS failure on Fluent Bit 1.9 and 5.0.9 alike, and a bare host plus port only reaches Floci plain HTTP port before certificate verification fails. Those outputs keep whatever the task definition gave them.

* feat(ecs): support fluentd FireLens routers and s3-hosted FireLens config

A fluentd FireLens router is now acted on at launch instead of being stored and ignored. Floci generates the config the ECS agent generates for that type: unix and forward sources, a grep filter per include-pattern and exclude-pattern, a record_transformer filter for the ECS metadata, the include of an external config, and one match block per awsfirelens container keyed on its @type. Fluentd takes its output plugin name from the log option @type rather than Name, its tags end in ** rather than *, and it gets neither the healthcheck sections nor Mem_Buf_Limit, both of which the agent emits for Fluent Bit only. The router image is handed /fluentd/etc/fluent.conf, so the config archive contents and its destination directory are now chosen per router type.

config-file-type=s3 now reads the object from Floci's own S3 instead of ignoring the option, and writes it to the fixed external.conf path next to the generated config, /fluent-bit/etc/external.conf or /fluentd/etc/external.conf, which is where the agent mounts what it downloads. The object is read before any container is created, so a missing bucket or key stops the task with the agent's own wording as the stopped reason, Unable to download firelens s3 config file: unable to download s3 config <key> from bucket <bucket>: <detail>, rather than leaving a router running behind a task that already failed.

RegisterTaskDefinition enforces the same split ECS does. A Fargate-compatible task definition cannot take its config from S3, and is rejected with Fargate launch type does not support FirelensConfiguration config file from 's3'; a config-file-value that does not name an S3 object is rejected as Invalid arn syntax. An EC2-compatible task definition keeps s3, and a Fargate task can still source its config from S3 the way AWS documents, through the aws-for-fluent-bit init process and its aws_fluent_bit_init_s3_* environment variables, which ECS never inspects and Floci passes through. Floci serves no ECS task metadata endpoint, so that init path fetches nothing locally yet, which docs/services/ecs.md now states.

* fix(ecs): rejoin awsvpc tasks to the security-group namespace

The FireLens launch loop stopped calling withNetworkMode(container:<helper>)
and dropped the workload label, so prepareNetwork's ENI/nftables had nothing
to isolate. Cover the join with a firewallManager-wired unit test.

* test(ecs): assert FireLens router and app both join the SG namespace

* test(ecs): verify FireLens router and app lifecycle in SG namespace test

* refactor(ecs): reuse extractTaskId for FireLens cluster name

* docs(ecs): note the launchType/compatibilities gap next to FireLens S3

* docs(ecs): scope the FireLens TCP-listen rationale to non-shared namespaces

* fix(ecs): reject a FireLens type that is missing or not fluentd/fluentbit

AWS requires firelensConfiguration.type and accepts only fluentd or
fluentbit. parseFirelensConfiguration returned null for a missing type,
registering the container as if FireLens were absent, and persisted any
other string, so an unknown type only became ineffective later when
findFirelensRouter recognized neither value.

Both are now rejected at the RegisterTaskDefinition JSON boundary with
the smithy validation wording, and are covered in
EcsJsonHandlerRuntimePlatformLogConfigurationTest.
2026-09-18 11:54:32 -04:00
Vũ Thế Huy caab63c602 fix(s3): delete null object versions (#3867) 2026-09-18 11:14:11 -04:00
Matthew Ingle d15b388aca fix(ec2): apply filters to transit gateway route table lookups (#3820)
* fix(ec2): apply filters to transit gateway route table lookups

matchesFilter had no arm for TransitGatewayRouteTable, so every filter fell
through to the permissive default and DescribeTransitGatewayRouteTables answered
with every table in the region regardless of transit-gateway-id.
GetTransitGatewayRouteTableAssociations never read its filters at all.

A caller that filters associations down to its own attachment therefore sees
somebody else's, concludes its own association is missing, and tries to create
one, which then fails as Resource.AlreadyAssociated once a route table has more
than one attachment.

* fix(ec2): compare the association state in the associations filter

GetTransitGatewayRouteTableAssociations reports the association's state, so
routing its "state" filter through the shared attachment matcher compared the
attachment lifecycle state instead. Filtering on "associated" matched nothing
while "available" matched every association on the table.

* fix(ec2): limit the associations listing to its documented filters

GetTransitGatewayRouteTableAssociations models resource-id, resource-type and
transit-gateway-attachment-id. Forwarding the rest of the request into the
attachment matcher also honored transit-gateway-id, vpc-id, vpc-owner-id and the
tag filters, none of which AWS exposes on this action, and honored a state filter
it does not model at all.

Retaining only the three modeled names drops that surface, which also removes the
association state handling added earlier in this branch: the fix there was to stop
answering a filter AWS does not document rather than to answer it correctly.

* fix(ec2): apply the documented filters to the propagations listing

GetTransitGatewayRouteTablePropagations accepts resource-id, resource-type and
transit-gateway-attachment-id, but propagationsOf ignored filters entirely and
matchesFilter had no arm for TransitGatewayRouteTablePropagation. A caller that
narrows the listing to its own attachment got every propagation on the table
back instead.

Retaining only the modeled names also keeps the tag filters out. Those are
handled ahead of the per-resource arms and read getResourceTags, which has no
propagation case, so a tag:Name filter emptied the listing rather than being
ignored as an unmodeled filter. The associations listing models the same three
names, so the allowlist is one constant shared by both.

* chore(ec2): cover the transit gateway filter arms that had no test

The route table listing's state and transit-gateway-route-table-id arms, and
resource-id and resource-type on both the association and propagation listings,
read the right fields but nothing exercised them over the Query protocol.

Each now gets a matching and a non-matching value, so an arm that falls through
to the permissive default cannot pass. Verified by pointing each arm at a
plausible wrong getter and confirming the suite fails.
2026-09-18 10:53:38 -04:00
Vũ Thế Huy 677cdbe053 feat(redshift): authorize COPY and UNLOAD with IAM_ROLE (#3815)
* feat(redshift): parse IAM_ROLE clause on COPY and UNLOAD

* feat(s3): add signed-principal authorization wrappers for role sessions

* feat(redshift): authorize COPY/UNLOAD S3 access through an IAM_ROLE session

* feat(redshift): thread IamService through the Redshift auth proxy chain

* test(redshift): cover IAM_ROLE resolution and signed authorization in prepareCopy

* fix(redshift): complete IAM_ROLE S3 authorization

* test(redshift): cover IAM_ROLE authorization end to end

* docs(redshift): document IAM_ROLE COPY and UNLOAD

* fix(redshift): retain IAM_ROLE session during COPY

* style(test): use Mockito static imports

* fix(native): initialize redshift copy simulator at runtime

* fix(redshift): address IAM role review feedback

* test(redshift): use valid proxy relay keys

* fix(redshift): require IAM roles to be associated

* test(compat): recover CodeArtifact create retries

* fix(redshift): parse IAM role location names

* fix(docs): exclude Redshift IAM role member label

* chore: remove unrelated CodeArtifact test
2026-09-18 10:21:10 -04:00
Vũ Thế Huy c3ec3819ae fix(ec2): attach Docker-hosted Floci to VPC networks (#3862) 2026-09-18 10:17:20 -04:00
luiseterc fdec637c27 fix(eks): preserve worker webhook scope in the URL path (#3849)
* fix(eks): preserve worker webhook scope in the URL path

* docs(eks): clarify scoped and legacy webhook routes
2026-09-18 09:35:00 -04:00
Vũ Thế Huy bd9700db0d fix(autoscaling): prevent reconciler resurrecting deleted groups (#3818)
* fix(autoscaling): prevent reconciler resurrecting deleted groups

* fix(autoscaling): narrow reconciler group locking
2026-09-18 09:29:44 -04:00
Matheus Oliveira eb787672b8 feat(timestream-influxdb): add Timestream for InfluxDB backed by InfluxDB 2.x containers (#3683)
* feat(timestream-influxdb): add Timestream for InfluxDB backed by InfluxDB 2.x containers

Implements all 24 AmazonTimestreamInfluxDB operations; DB instances and
read replica clusters run real influxdb:2.7 containers.

* Fix #2566

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* fix(timestream-influxdb): reject unsupported RestoreFromDbBackup parameters

Point-in-time restore needs a continuous backup, and REPLACE_EXISTING
accepts no configuration overrides, so both are rejected instead of
silently restoring on-demand data or dropping the overrides.

* Fix #2566

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* style(timestream-influxdb): import the classes used instead of naming them inline

Replaces the inline fully-qualified LinkedHashMap, Comparator, Predicate
and TimestreamInfluxDbService references with imports.

* Fix #2566

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-18 09:09:51 -04:00
Priamo Germosen 918a09f54a fix(appsync): move the GraphQL engine to a sidecar, out of the native image (#3534)
graphql-java (~3.8MB with transitive deps) was an unconditional dependency,
so it and its schema/execution/parser classes were reachable in every
native image regardless of whether AppSync was ever used (issue #2917),
the same systemic pattern already fixed for Kubernetes (#2914) and Kafka
(#2916).

Schema parsing and query execution now run in floci/floci-sidecar-graphql,
published from floci-io/floci-sidecars, the same model #3799 already moved
Cedar onto: GraphqlSidecarManager lazily starts the pinned image and checks
the contract version it reports on /health, refusing a sidecar speaking
another contract major with a message naming the image and the variable to
change. GraphqlSidecarClient talks to it over plain HTTP. graphql-java is
no longer a dependency of this repository at all, not even test-scoped:
its schema/execution/parser classes, the query planner, and the 17 AWS
scalar coercions now live entirely in the sidecar's own repository.

The sidecar itself carries zero AppSync-specific knowledge, and zero AWS
vocabulary: its scalars are generic named coercion kinds a caller maps its
own scalar names onto, so SidecarSchemaCompiler now sends a scalars mapping
(AWSDateTime -> date-time, and so on for all 17) alongside every SDL, or
AWS scalar validation would silently degrade to pass-through coercion. It
exposes three endpoints: schema validate/compile, a query planner that
lists every (typeName, fieldName) coordinate a query would visit plus the
directives on each (with zero interpretation of what they mean), and
execute, which accepts an opaque denyFields list and nulls those
coordinates out with the caller-supplied error. All @aws_auth/IAM/
Cognito/Lambda-authorizer interpretation stays in Floci
(SidecarFieldAuthorizationPlanner, AppSyncAuthRequirements), computed from
the planner's output before /v1/execute is ever called, so a query the
planner can't fully analyze fails closed (refuses the request) instead of
silently running unauthorized. SidecarSchemaCompiler replaces
AppSyncSchemaParser: it still injects AppSync's directive declarations and
the 17 scalar type declarations into the customer's SDL (pure string work)
before handing the SDL to the sidecar.

While the scalar coercion logic was still being ported to the sidecar's
repository, testing surfaced a real bug: every scalar's parseLiteral()
delegated to parseValue(), which throws CoercingParseValueException;
graphql-java's literal validator only catches CoercingParseLiteralException,
so an invalid literal argument (as opposed to an invalid variable) escaped
as an unhandled exception instead of a spec-correct GraphQL
ValidationError. Fixed in the sidecar before it was ever published.

QueryRegistry, QueryExecutor, AuthFieldWrapper, AuthorizationDataFetcher's
live DataFetcher wrapper, and AppSyncFieldUnauthorizedException are
deleted: their in-process execution role no longer exists. The directive
interpretation half of AuthorizationDataFetcher survives as
AppSyncAuthRequirements, now taking generic data instead of live
graphql-java objects, shared rather than duplicated.

Verified end to end against the published image: pulled
floci/floci-sidecar-graphql:0.2.0 fresh and ran the full AppSync suite
(190 integration tests across schema lifecycle, auth, and execution)
through the real GraphqlSidecarManager, including the sidecar starting
and stopping as a real sibling container over the mounted Docker socket.
2026-09-18 07:57:15 -05:00
Vũ Thế Huy 6f87973649 feat(ecs): add FireLens task logging support (#3768)
* feat(ecs): add FireLens task logging support

* fix(docker): omit extra hosts for container network mode

* fix(ecs): bind FireLens router port to loopback
2026-09-18 08:57:02 -04:00
XuJianandxujiantop-crypto 172bfb32b0 fix(cognito): align pre-authentication trigger events and errors (#3861)
* fix(cognito): include user status in pre-authentication events

* fix(cognito): preserve pre-authentication trigger errors

* fix(cognito): constrain pre-authentication payload handling

---------

Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-18 08:53:35 -04:00
luiseterc 5ec3fb67a8 fix(ec2): resolve instance profile names through IAM (#3856) 2026-09-18 08:46:22 -04:00
Hector Ventura 6e034837ad fix(cloudformation): tolerate an already-gone EC2 instance or security group on stack delete (#3842)
Ec2InstanceCfnProvisioner.delete and Ec2SecurityGroupCfnProvisioner.delete called terminateInstances / deleteSecurityGroup directly, so a group or instance removed out of band turned DeleteStack into DELETE_FAILED. Wrap both in CfnDeletes.safeDelete with the specific not-found code (InvalidInstanceID.NotFound, InvalidGroup.NotFound), per AGENTS.md step 5, so already-gone is tolerated while a real error such as DependencyViolation still propagates.
2026-09-18 07:41:10 -05:00
Kenshin Okinaka 938eca1fe9 refactor(ses): drop the tenant-free suppression overloads from SesService (#3860)
The four short signatures of putSuppressedDestination,
getSuppressedDestination, deleteSuppressedDestination and
listSuppressedDestinations only passed null as the TenantName to the
tenant-aware version, which then forwarded straight to SesSuppressionService.
The v2 controller always passes a TenantName, so nothing in src/main called
them; the only callers were tests seeding or reading suppression entries.

SesSuppressionService already exposes those exact three-argument signatures,
so the tests reach it through the builder accessor instead, the way
SesSuppressionServiceTest already did. They keep the facade for what is
actually facade behavior: sendEmail and resolveSuppressionReason.

Retitle the suppression section and fold its two comment paragraphs into one.
The heading still claimed "account attributes + list" although the account
attributes moved to SesSuppressionService in the store split and are read and
written by the v2 controller; only the tenant-routed list operations remain.

Also squash the four runs of consecutive blank lines in the file, including
the one the earlier inspection cleanup left before the Templates section
comment.
2026-09-18 08:32:32 -04:00
Kenshin Okinaka 6e53c5275a refactor(ses): clean up what the controller split left behind (#3841)
Four leftovers from splitting SesController by domain, none of them changing
behavior.

SesInspectionController now injects SesSentEmailService and calls listAll and
clear on it. SesService.getEmails and clearEmails were one-line forwards to
that service, the last pure delegations the split missed, so they go; the
field comment and the class Javadoc that still claimed inspection read through
the facade are corrected. SesServiceTestBuilder gains a sentEmailService
accessor and SesServiceSmtpTest reads through it, matching how the other
domain services are reached from tests.

Three test classes are renamed to the service they actually drive:
SesServiceDkimLookupCacheTest and SesServiceLegacyDkimTokensTest become
SesIdentityDkimLookupCacheTest and SesIdentityLegacyDkimTokensTest, and
SesServiceSuppressionLegacyKeyTest becomes SesSuppressionLegacyKeyTest. None
of them was referenced from anywhere else.

SesSendController imports JsonProcessingException instead of writing it out
inline, and SesService drops six imports left unused by earlier steps.
2026-09-18 06:59:25 -04:00
Priamo Germosen 18a2f36eda refactor(s3): dedupe Filter grammar between IntelligentTiering and Metrics (#3836)
S3IntelligentTieringConfiguration and S3MetricsConfiguration each
independently implemented the S3 Filter sub-resource grammar
(Prefix/Tag/And) and shared an identical tagsXml helper, found via
CPD as an 18-35 line overlapping block (#3835). MetricsFilter
additionally accepts AccessPointArn as a conjunct, which
IntelligentTieringFilter does not (verified against botocore's
service-2.json: MetricsFilter/MetricsAndOperator carry AccessPointArn,
IntelligentTieringFilter/IntelligentTieringAndOperator don't), so the
two weren't byte-identical.

Extracted the shared skeleton into S3FilterGrammar.filterXml(xml,
extraConjuncts) in core.common, parameterized by which extra
conjuncts a caller's Filter type supports: IntelligentTiering passes
List.of(), Metrics passes List.of("AccessPointArn"). tagsXml and
requireText, which were fully identical, moved with it.

S3AnalyticsConfiguration and S3InventoryConfiguration also parse a
Filter grammar, but through a different XmlElement-based parser, not
the XmlParser string-based approach these two share, so they're a
different implementation and out of scope here.

No behavior change: verified against both configuration types'
existing unit and integration test suites, which directly exercise
Prefix/Tag/And/AccessPointArn and every malformed-filter case.
2026-09-17 22:37:34 -05:00
XuJianandxujiantop-crypto 313f91e06c fix(ec2): return and filter image tags (#3808)
* fix(ec2): return and filter image tags

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>

* fix(ec2): persist refreshed image tags

---------

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-17 23:12:19 -04:00
Hector Ventura 180aef5e44 refactor(cloudformation): move the EC2 SecurityGroup and Instance types into per-service provisioners (#3810)
* refactor(cloudformation): move the EC2 SecurityGroup and Instance types into per-service provisioners

AWS::EC2::SecurityGroup moves out of CloudFormationResourceProvisioner into a
new Ec2SecurityGroupCfnProvisioner with its six helpers, and AWS::EC2::Instance
into a new Ec2InstanceCfnProvisioner. The code moves as written: the only
changes are the ProvisionContext helpers in place of the monolith's identical
private ones, explicit types and imports in place of var and inline qualified
names, and a comment reworded around an em-dash.

SecurityGroup gets its own class rather than joining
Ec2SecurityGroupRuleCfnProvisioner: the schema coverage gate attributes
attributes per type only through a statement switch on the resource type,
and the rule provisioner has one shared path, so joining it would have meant
restructuring that class too. The rule provisioner's shared rule mapping is
still the one both use.

Leaving the legacy switch puts both types under CfnSchemaCoverageTest. The
read-only attributes neither arm set before are recorded as gaps rather than
published, which would change what Fn::GetAtt returns: SecurityGroup Id, and
Instance VpcId and State.

The legacy switch goes from 23 to 21 types, the monolith from 3,413 to 3,133
lines, and its constructor loses ec2Service.

* fix(cloudformation): guard EC2 instance provisioning when Properties is absent

Ec2InstanceCfnProvisioner read props.path("NetworkInterfaces") without the props != null guard the rest of provision() uses, so an Instance declared with no Properties (valid: the registry schema has no required properties) threw an NPE and the resource went CREATE_FAILED. Guard the NetworkInterfaces block like the LaunchTemplate, SecurityGroupIds and Tags accesses above it. A carried-over gap from the monolith, surfaced by the move in this PR.
2026-09-17 22:12:14 -05:00
Chris Jovanovski 33a95e92f2 fix(iam): evaluate policies against real request resources and conditions (#3765)
* fix(iam): evaluate real request resources and S3 sub-resource actions

* fix(iam): add global context to managed policy evaluation
2026-09-17 22:42:06 -04:00
Kenshin Okinaka 1d009b9614 refactor(ses): rename SesController to SesSendController (#3837)
The controller kept its generic name while it held every v2 endpoint. After
the per-domain split it serves only the three /v2/email/outbound-* routes, so
the name now says what it holds. Pure rename: no endpoint, path, status or
body changes.

Drop two leftovers from the days when this was the only SES v2 controller.
The ten domain controllers opened their Javadoc with "split out of
SesController", which the rename would have made misleading, since those
endpoints were never send endpoints, and which documented history git already
records while coupling ten files to one class for nothing else. This class
claimed to follow LambdaController in throwing AwsExceptions directly, but it
catches and remaps them in three places, LambdaController documents no such
pattern, and AwsExceptionMapper is a global provider that covers every JAX-RS
resource anyway.

Add the class Javadoc the split left missing. SesSendController records which
three endpoints it keeps and why the send path stayed behind the facade.
SesService had no class Javadoc at all; it now states the survival rule that
decides what lives on the facade, the categories that rule leaves behind, and
that its name is historical rather than a claim to own SES as a whole.
2026-09-17 22:27:22 -04:00
Kenshin Okinaka 00e94d84f0 refactor(ses): split the identity endpoints into SesIdentityController (#3834)
* refactor(ses): split the identity endpoints into SesIdentityController

The thirteen /v2/email/identities endpoints, sending authorization
policies included, and their seven helpers move byte-for-byte out of
SesController into SesIdentityController. The reads and the
single-domain attribute writes call SesIdentityService directly, and so
do the v1 handler's fourteen identity actions and its four policy
actions through SesPolicyService, so SesService drops eighteen
delegations and its verified-domain probe reads the service directly.
Create, delete, the v2 policy operations and the default configuration
set stay on the facade for their cross-domain checks. The two DKIM unit
tests now drive SesIdentityService through the builder. The new class is
registered on the SES descriptor. No wire behavior changes.

* refactor(ses): brace the null guard moved into SesIdentityController
2026-09-17 20:43:07 -04:00
Chris Jovanovski cf235cfb81 fix(cloudformation): resolve SecretTargetAttachment targets in the stack region (#3740)
Use the provisioning context region for RDS and DocumentDB target lookups.
2026-09-17 18:36:48 -05:00
Chris Jovanovski 573094720d fix(cloudformation): resolve intrinsics in IAM policy documents before storing them (#3739)
Fail stacks when IAM policy document references cannot be resolved.
2026-09-17 18:36:31 -05:00
Attila Kis ad20699a6b fix(apigateway): complete API Gateway API key responses (#3817)
Return timestamps, stage keys, tags, and customer ID across create, get, list,
and update operations to prevent Terraform provider crashes and state drift.
Generate opaque IDs by default while preserving legacy generateDistinctId=false behavior.
Keep API key values hidden unless explicitly requested.
Add REST, SDK, and CloudFormation regression coverage.
2026-09-17 16:01:43 -04:00
David 30b491a546 feat(glue): table version reads and deletes, batch partition delete, SearchTables (#3828)
GetTableVersion answers one archived version by VersionId, or the
current table when none is given; an unknown version is
EntityNotFoundException and a non-integer one InvalidInputException.
DeleteTableVersion and BatchDeleteTableVersion drop archived versions,
the batch form reporting per-version Errors; the current version is
refused, as AWS refuses it on the console and the API, since DeleteTable
is the way to drop it.

BatchDeletePartition deletes up to 25 partitions and reports the ones
not found in Errors, the shape the other batch partition calls use.

SearchTables searches every table of the catalog: SearchText as a
substring of name, database, description, owner, columns and parameter
values (exact when quoted), Filters with the API reference's tokenised
match for string keys and a Comparator for the time fields, SortCriteria
on the same fields, and MaxResults with NextToken paging.

Closes #3826
2026-09-17 14:43:10 -04:00
David 54a5cf3e9c feat(rds): global clusters and FailoverDBCluster (#3819)
CreateGlobalCluster creates an Aurora global database, empty or with an
existing Aurora cluster as its primary, in which case engine, version,
database name and encryption come from that cluster and may not be
given. CreateDBCluster with GlobalClusterIdentifier joins a cluster: the
first becomes the primary, every later one a secondary in a region that
holds no member yet, with the primary's credentials and database name and
a point-in-time copy of its data through the pg_dumpall mechanism that
snapshots and read replicas use. DescribeGlobalClusters answers the real
records for RDS, with IsWriter and Readers per member; DocumentDB and
Neptune keep the shared empty answer.

SwitchoverGlobalCluster and FailoverGlobalCluster promote the named
secondary and demote the current primary to a secondary, the topology
AWS keeps on switchover and restores after a managed failover.
RemoveFromGlobalCluster detaches a member into a standalone cluster and
the primary goes last; DeleteGlobalCluster needs an empty, unprotected
global cluster; ModifyGlobalCluster renames, protects or upgrades, with
members following.

DBCluster now carries the writer role: the first instance is the writer,
IsClusterWriter reports it instead of true for every member, deleting the
writer promotes a remaining member, and FailoverDBCluster moves the role
to the named reader or the first one; a cluster without a reader is
refused with InvalidDBClusterStateFault.

Closes #3778
2026-09-17 14:35:01 -04:00
Mario Toffia 22b0627245 test(compat): assert recorded metric filter publishing through the SDK modules (#3809)
* feat(logs): add metric filters with per-event metric publication

Implements PutMetricFilter, DescribeMetricFilters, DeleteMetricFilter and
TestMetricFilter on the CloudWatch Logs JSON 1.1 handler, backed by a filter
pattern engine for term, space-delimited and JSON patterns. The grammar is
checked against 148 TestMetricFilter cases recorded from AWS, kept as
fixtures under src/test/resources/cloudwatchlogs and recaptured with the
opt-in script under tools/aws-capture/cloudwatchlogs.

Validation follows the observed AWS wire behavior: the five regex-bearing
filters per log group quota is shared with subscription filters through one
canonical backend monitor, a filter pattern may hold at most two regular
expressions, defaultValue must be a JSON number, DescribeMetricFilters
requires metricName and metricNamespace together in both directions, and
TestMetricFilter reports one-based event numbers with an empty public
extractedValues map for JSON patterns.

Ingested events publish samples into CloudWatch Metrics per event at the
event timestamp: matching events contribute the extracted or literal value,
non-matching events contribute defaultValue, dimensions are all-or-none, and
system dimensions only attach to matching events. Failed publications are
retried from a bounded queue of 10,000 samples with stable publication ids.

Resettable gains beforeReset and afterReset default hooks so the metric
filter publisher can pause and drain before a state reset wipes storage and
resume afterwards. EmulatorInfoController.performReset is serialized and
calls the hooks around the existing container teardown and storage wipe,
running afterReset in a finally block so a failed wipe cannot leave a
publisher paused. The GetMetricStatistics and GetMetricData Query responses
now carry the CloudWatch namespace so both read paths return the same
samples.

* feat(cloudformation): provision AWS::Logs::MetricFilter

Adds LogsMetricFilterCfnProvisioner for creates, in-place updates, name
changes and deletes. Ref and PhysicalResourceId are the filter name alone,
as observed on AWS; the log group is kept as private resource metadata.
A replacement deletes the old filter before creating the new one, matching
the DELETE then CREATE event order AWS emits, and a failed replacement
recreates the previous definition on rollback.

Every mutation records an APPLIED, NOT_APPLIED or UNKNOWN outcome under the
service lock so a failed or ambiguous call can never authorize deleting or
overwriting a filter the stack does not own. Ownership that cannot be proven
is resolved conservatively before the next mutation.

The engine gains three small provisioner hooks that this type needs and
others may reuse:

- ProvisionContext carries a progress consumer so a provisioner can emit
  the intermediate DELETE_IN_PROGRESS and DELETE_COMPLETE events of a
  delete-first replacement while provision is still running.
- rollbackUpdate(resource, progress) lets a provisioner restore its own
  previous state during UPDATE_ROLLBACK and report the steps as events.
- hasPendingRollbackCleanup and retainsFailedUpdateState let a provisioner
  tell the engine that an UPDATE_FAILED resource still holds its own
  rollback snapshot, so the engine neither restores the previous resource
  over it nor refuses a later DeleteStack. Both default to false; only this
  provisioner overrides them.

The type is listed in supported-resource-types.tsv, the generated resource
table and CfnProvisionerFixture, with unit, integration, storage reload and
SDK coverage.

* docs(logs): document metric filters and the AWS verification record

Describes the metric filter operations, publication semantics and
CloudFormation support in docs/services/cloudwatch.md and adds
cloudwatch-metric-filters-verification.md, the record of what was observed
on AWS in eu-west-1, with which tools, and where each recorded fixture came
from. Registers the handler and the verification page with the docs tooling
and teaches the service inventory test to count facet pages.

* feat(logs): publish metric filter samples off the PutLogEvents thread

PutLogEvents evaluated each filter and wrote one CloudWatch Metrics sample
per filter and event on the request thread while holding the filter-store
monitor, up to a million writes for a maximal request, so ingestion latency
depended on the Metrics sink and every PutMetricFilter waited behind the
whole batch.

The request thread now only evaluates the group's filters as they are at
ingestion and hands the resulting immutable samples, with their stable
publication ids, to a bounded queue of 100,000 samples. The existing single
worker drains it and writes one sample per monitor acquisition, so a
PutMetricFilter or a reset waits for at most one write. A batch that does
not fit the queue is written inline on the request thread rather than
dropped. Failed writes still land in the 10,000 sample retry map with the
same ids and cadence as before.

Reset pauses the worker, discards queued and failed samples and bumps a
generation counter so a batch taken before the reset is never written into
the wiped store. Shutdown drains the queue before storage shuts down and
clears the retry map only after the worker has terminated. Samples ingested
while Metrics is disabled are discarded at startup.

Integration and SDK tests poll for the sample, as they would against AWS.

* test(compat): assert recorded metric filter publishing through the SDK modules

Extends the Java compatibility module with the publishing scenarios recorded
from AWS: mixed defaults and quiet traffic, extraction and ordinary dimension
series, system dimensions on matches only, and a Sum alarm driven by quiet
defaults. Each series is read through the SDK's CloudWatch JSON protocol and
again as a signed legacy Query request, so GetMetricStatistics and
GetMetricData agree on every sample, timestamp, unit and dimension set.

Expected values come from module-local copies of the root fixture
metric-filter-publishing-aws.json. MetricFilterFixturePackagingTest checks
the Java copy loads from the classpath and the root
CloudWatchLogsMetricFilterFixturePackagingTest fails when either SDK module
copy drifts from the root file.

The Python module gains tests/metric_filter_replay.py, an opt-in replay of
the same scenarios against a Floci endpoint or, with explicit profile,
region and write acknowledgement, against AWS. Its logic is covered offline
by tests/test_metric_filter_replay.py with the network blocked. Both module
Dockerfiles are unchanged: the Java image already runs the whole suite and
the Python image already copies tests/.

* test(compat): assert every recorded statistic and poll for published samples

The SDK publishing assertions compared only Sum and SampleCount although the
AWS fixture also records Minimum and Maximum for the default-value scenarios.
Both the SDK JSON reads and the signed legacy Query reads now assert every
statistic the fixture carries, on GetMetricStatistics and GetMetricData.

Publication now happens shortly after PutLogEvents returns, so present series
are polled and absent series are asserted only after a later positive control
of the same filter is visible, which the publisher's ordering guarantees. The
read window ends at second 59 so a sample stamped on the following minute is
never in scope.

The live replay's Region check names the commercial partition explicitly.
botocore already defaults get_available_regions to partition_name="aws", so
GovCloud and China Regions were rejected before; the offline test now pins it.

* test(compat): keep the metric filter SDK test on the Java 17 API of the compat image

List.getLast() is Java 21; the sdk-test-java image compiles with Temurin 17.
2026-09-17 13:53:35 -04:00
Vũ Thế Huy a3da2a3767 feat(rds): add SQL Server support to RDS (#3752)
* feat(rds): add SQL Server support

* fix(rds): align SQL Server master handling

* fix(rds): reject SQL Server DBName

* fix(test): import Mockito matchers
2026-09-17 13:42:15 -04:00
Mohamed Amine ALOUINI 7e539155e1 fix(ec2): report the calling account as resource owner (#3814)
EC2 froze every resource's owner to the configured default account at
construction time, so OwnerId came back as 000000000000 no matter which
account the request resolved to. Per-account isolation itself worked, but
the reported owner contradicted what STS returns for the same credentials
and what SQS embeds in its ARNs.

The visible consequence was DescribeImages --owners: the filter was honored
but matched against the frozen value, so filtering on the account actually
in use returned nothing, and the common Terraform pattern of pinning an AMI
to a known owner account failed with "Your query returned no results".

Resolve the owner per request through callerAccountId() instead, for the
ownerId fields, the generated ARNs and the self owner alias. Callers outside
a request scope (startup seeding, internal provisioning) still fall back to
the configured default account.

Closes #3775
2026-09-17 13:36:30 -04:00