Commit Graph
115 Commits
Author SHA1 Message Date
TATSUNO “Taz” Yasuhiro 0492fc9842 feat(lambdaweb): CloudFormation types for Lambda Web Functions (#5722)
* feat(lambdaweb): CloudFormation types for Lambda Web Functions

AWS::Lambda::WebFunction, AWS::Lambda::WebFunctionRevision and
AWS::Lambda::WebFunctionEndpoint provision through the resource
registry. Ref of each is its ARN. Every property of a revision is
createOnly in the registry schema, so a changed revision mints a new one
and the displaced revision is deleted once the update commits. An
endpoint keeps its identity while its function, name, type and regions
stay the same. Fn::GetAtt on RegionalEndpoints is recorded as a gap.

Part of #5699

* fix(lambdaweb): compare a revision against the function's default log group

revisionMatches filled a request without a log group with the existing
revision's log group, so a template that dropped a custom log group kept
the old revision. The default is the function's log group, as when a
revision is created. replaceTags returns the updated function.

* fix(cloudformation): put a Lambda Web function or endpoint back after a failed stack update

A function's tags and an endpoint's mutable configuration are changed in
place on update. The provisioner now snapshots them before the change and
restores them from rollbackUpdate, as the other in-place provisioners do.
The function attributes after a tag update come from the updated
function, so UpdatedAt moves with the tag change.

* test(cloudformation): roll a Lambda Web stack update back after a failed revision

A revision that fails to create after the endpoint moved to a replaced
revision rolls the stack back. The endpoint returns to the kept revision
and the replacement is deleted. The doc page says that a CloudFormation
endpoint is always Disabled with RevisionWeights, since the schema has no
AutoDeploymentMode, and that a failed update puts in-place changes back.

* fix(cloudformation): refuse AutoDeploymentMode on a Lambda Web endpoint

The registry schema has no AutoDeploymentMode property and AWS fails a
template that sets it at validation. An endpoint from CloudFormation is
always Disabled and routes by RevisionWeights. Floci passed the property
through to the service, which accepted LatestRevision.

* refactor(lambdaweb): share the create and tag steps between the API and CloudFormation paths

createFunction and createFunctionShell both check the name and refuse a
duplicate under the function's lock. tagResource and replaceTags both
check the tags, lock, write, stamp and persist. Each pair now calls one
private helper, so the two paths cannot drift.
2026-10-15 19:02:50 -04:00
Allen Sanborn 1e423420ed fix(ec2): resolve a NAT gateway's network interface and mark its Elastic IP associated (#5622)
* fix(ec2): resolve a NAT gateway's network interface and mark its Elastic IP associated

CreateNatGateway gave each gateway address a networkInterfaceId of
"eni-" + randomHex(17), but nothing else knew about that interface:
DescribeNetworkInterfaces had no NAT arm, so the id DescribeNatGateways
publishes (aws_nat_gateway.network_interface_id) answered
InvalidNetworkInterfaceID.NotFound. The Elastic IP the gateway took was
also never marked associated, so DescribeAddresses showed a held
allocation as free.

The interface id is now derived from the gateway id, as endpoint ENIs
are, and DescribeNetworkInterfaces reports one requester-managed
nat_gateway interface per gateway address, built from the stored
address so the two reads cannot disagree. CreateNatGateway records the
association, interface and private address on the allocation (no
instanceId), and DeleteNatGateway clears them if the association is
still the gateway's.

* fix(ec2): refuse a NAT gateway on an occupied Elastic IP, keep its association, scope its ENI lookup to the account

CreateNatGateway rejects an allocation already held by an instance or another gateway
(Resource.AlreadyAssociated) under the lock that writes the association. DisassociateAddress
rejects an association owned by a NAT gateway. The NAT arm of DescribeNetworkInterfaces reads
gateways and subnets for the account asked about.

* fix(ec2): lock NAT gateway EIP release, treat a legacy gateway's EIP as held

DeleteNatGateway releases the Elastic IP under the lock CreateNatGateway
takes. CreateNatGateway also refuses an allocation any live gateway
references, covering gateways persisted before Address records were
marked. The CloudFormation networking test gives the replacement NAT
gateway a new EIP: replacement creates before it deletes, and AWS's
CreateNatGateway refuses an EIP still associated elsewhere.

* fix(ec2): AssociateAddress refuses a NAT gateway's Elastic IP; legacy gateways hold theirs

AssociateAddress checks for a gateway holding the allocation and writes
under the allocation lock CreateNatGateway and DeleteNatGateway take, so
an instance cannot take over an address the gateway still claims. The
gateway scan behind that check, and CreateNatGateway's, now includes
unmigrated pre-account-isolation gateway records for the default
account, never another account's.

* fix(ec2): scope NAT gateway ownership checks to the caller's records

callerNatGateways scanned every account's gateways before filtering. Read
the caller's own records, plus unprefixed legacy records only for the
default account.

* fix(ec2): create a NAT gateway failed on an Elastic IP already in use

CreateNatGateway with an allocation another gateway or an instance holds
no longer answers 400. As the NatGateway shape documents, the gateway is
created in state failed with FailureCode Resource.AlreadyAssociated and
FailureMessage "Elastic IP address <alloc> is already associated". It
gets no interface, claims nothing, and does not count as a holder.
AWS::EC2::NatGateway fails the resource and deletes the failed gateway.

ReleaseAddress on an allocation a NAT gateway holds, legacy gateways
included, answers InvalidIPAddress.InUse. DisassociateAddress and
ReleaseAddress run under privateIpAllocationLock. The NAT interface lookup
reads legacy unprefixed gateways and subnets for the default account. It
also loads the interface's tags, and DeleteNatGateway deletes them.
endpointEniId and natEniId become one helper, eniIdFromSeed.

* test(cloudformation): say why the replacement template keeps NatEip

The replacement template keeps NatEip for two reasons. On AWS a gateway
given an Elastic IP the displaced gateway still holds is created failed.
And Floci update cleanup deletes removed resources before the old copies
of replaced ones, so dropping the EIP while replacing its gateway would
try to release it while it is still held.

* fix(ec2): a failed NAT gateway does not pin its subnet or VPC

#5503 made DeleteSubnet and DeleteVpc refuse while a NAT gateway that is
not deleted sits in the subnet. A failed gateway was never created and
holds no interface, so it no longer counts, matching the Elastic IP
holder check.
2026-10-15 13:53:49 -04:00
Vũ Thế Huy d3fce14256 feat(redshift-serverless): add release track, managed workgroup and reservation reads (#5691)
* feat(redshift-serverless): add release track, managed workgroup and reservation reads

Add GetTrack, ListTracks, ListManagedWorkgroups, ListReservations,
ListReservationOfferings, GetReservation, GetReservationOffering and
CreateReservation so SDK, CLI and IaC clients no longer get an unknown
operation error. Floci models no zero-ETL managed workgroups and sells no
reservations, so the lists are empty and the reservation lookups answer
ResourceNotFoundException. The two release tracks are current and trailing.

Required members, patterns and lengths come from the AWS model through
RedshiftServerlessRequestShapes; only the track names, which the model leaves
unenumerated, are checked by hand.

* refactor(redshift-serverless): reuse Pagination.paginate and remove unused admin handle method

Rely on Pagination.paginate for maxResults and nextToken validation in listTracks and listWithoutItems, matching the other Redshift Serverless lists. Remove the unused handle method and its duplicate unknown-operation response in RedshiftServerlessAdminJsonHandler.
2026-10-15 13:46:35 -04:00
danielxoi fa682b2d62 fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types (#5503)
* fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types

A CidrBlock change, or a tenancy change other than dedicated to default,
replaces the VPC, but the provisioner never recorded the displaced one and had
no delete arm, so the old VPC was left behind; in-place Tags, EnableDnsSupport
and EnableDnsHostnames changes were not snapshotted, so a later failing
resource left the VPC changed and reported rollback as not implemented.

Ec2VpcCfnProvisioner now follows Ec2NetworkCfnProvisioner: ReplacementCleanup
records the displaced VPC and deletes it after the update commits or restores
it on rollback; a prior-state snapshot restores DNS attributes, tags and a
dedicated-to-default tenancy change on rollback, eagerly when provision itself
fails; and a delete arm through CfnDeletes.safeDelete removes the VPC on stack
teardown, tolerating only InvalidVpcID.NotFound so stack-external dependents
fail the delete with DependencyViolation, as on AWS.

* refactor(cloudformation): use the shared CfnRollback.guarded in the VPC provisioner

* fix(ec2): count instances and NAT gateways as subnet and VPC dependents

DeleteSubnet and DeleteVpc checked subnets, security groups, route tables,
ACLs, gateways and endpoints but not the instances and NAT gateways living in
a subnet, so a stack teardown could remove a subnet and its VPC out from under
an instance launched into it out of band. Both now fail with
DependencyViolation while an instance that is not terminated (shutting-down
still holds its interface) or a NAT gateway that is not deleted sits in the
subnet, as on AWS. The rollback integration test also pins Boom after the VPC
with DependsOn so the scenario cannot pass by ordering alone.

* fix(cloudformation): keep the VPC and subnet rollback snapshot until the restore succeeds

rollbackUpdate removed the in-place snapshot before restoring; a restore that
threw left the resource persisted as UPDATE_FAILED with no prior state for a
ContinueUpdateRollback retry. Ec2VpcCfnProvisioner and the pre-existing
Ec2NetworkCfnProvisioner now restore first and remove after, as the AgentCore
provisioner already did. The describeTags loop shared by Ec2Tags.reconcile and
the VPC snapshot moves to Ec2Tags.current.

* fix(ec2): count standalone network interfaces and interface endpoints as subnet dependents

A subnet is pinned by any network interface in it, not only the ones an
instance or NAT gateway owns: a standalone interface from
CreateNetworkInterface and an interface or Gateway Load Balancer endpoint
keep DeleteSubnet at DependencyViolation on AWS too. The endpoint test that
deleted a subnet out from under a live endpoint relied on that state being
reachable; it now asserts the refusal and that the published interface ids
are unchanged.

* fix(cloudformation): wait for terminated on instance delete and resolve VPC properties before creating

With real containers an instance is still shutting-down when the stack's
instance delete returns, so the subnet delete that follows was refused by the
new resident check and the stack ended DELETE_FAILED. The instance provisioner
now polls until the instance is terminated or gone, as CloudFormation does.

The VPC provisioner created the VPC before EnableDnsSupport, EnableDnsHostnames
and Tags were resolved, so a resolution failure left it untracked; the resolves
now run first, as the subnet provisioner does. Ec2Tags.current drops reserved
aws: keys so a rollback snapshot never tries to write one, and the replacement
integration test waits in the stack's own region.
2026-10-15 11:14:56 -04:00
XuJian 7f8383db38 feat(cloudformation): provision SES email identities (#4812)
* feat(cloudformation): provision SES email identities

* fix(cloudformation): retry pending SES update rollback

* fix(cloudformation): keep recovered SES resource complete

* fix(cloudformation): retain recovered SES state on failed replacement

* test(cloudformation): use shared waiter for SES DKIM verification
2026-10-15 10:26:40 -04:00
TATSUNO “Taz” Yasuhiro 6f78083080 feat(lambdaweb): Lambda Web Functions control plane (#5706)
* feat(lambdaweb): Lambda Web Functions control plane

The lambda-web service model (apiVersion 2025-03-07) signs as lambda, so
it is served under the lambda service at /2025-03-07/... with the AWS
wire shapes, state words and error wording of the 20 operations on web
functions, revisions, endpoints, tags and the resource policy.

Revisions and endpoints converge at once. They are stored Active and an
endpoint update is stored Successful, while the create and update
responses report the transitional state AWS reports, so a CLI waiter
settles on its first poll. Code comes from an S3 object that must exist.
IamAuth, the resource policy and the endpoint domain are stored but not
served yet.

Part of #5699

* fix(lambdaweb): carry the page position in the token

The nextToken of a list operation was a UUID keyed into an in-memory
anchor map that only grew and was not scoped to the account. The token
is now a core Pagination cursor that encodes the request (operation,
region, account, function, filters and page size) and the cursor of the
item the page ended on. A token reused with other parameters gets the
AWS "does not match the request" error and any other token the AWS
"invalid or has expired" error.

AWS issues UUID tokens and rejects any other shape, so Floci no longer
reproduces the pattern error for a malformed token.

* fix(iam): resolve a Lambda Web revision or endpoint named by its ARN

The route resource for IAM enforcement took the path segment after
revisions or endpoints as the id. A revision or endpoint ARN in that
position carries slashes, so the resource ARN ended in the ARN's first
segment and a policy scoped to the revision or endpoint did not apply.
The id is now the last segment of such an ARN.

* fix(lambdaweb): add the values of a repeated state filter

AWS lists a function when any state filter in the request names its
state. A later state filter replaced the earlier one, so a request with
state=Active followed by state=Failed listed nothing.

* fix(lambdaweb): refuse empty arrays in a resource policy

AWS answers an empty Action or Resource array with the policy syntax
error and an empty principal array with the invalid principal error,
which wins when all three are empty. Floci stored such a policy.

* fix(lambdaweb): judge a wildcard principal by the operator and value of its condition

A trusted condition key alone kept an Allow for every principal out of
the public check. AWS blocks the policy unless a positive operator pins
the key: StringNotEquals and the IfExists forms do not count, nor does a
wildcard in an account value or in the account field of an ARN value,
while a wildcard elsewhere in an ARN and a literal * under StringEquals
do.
2026-10-15 06:46:52 -04:00
Mario Toffia a5228a0bf7 fix(cloudformation): apply TimeToLiveSpecification on DynamoDB tables (#4951)
* feat(dynamodb): add typed time-to-live operations to the table access

DynamoDbTableAccess gains timeToLive and updateTimeToLive next to the
stream operations. The native engine reads the TTL flag and attribute
from the table definition and calls DynamoDbService.updateTimeToLive
under the scope's account; the Local engine sends DescribeTimeToLive
and UpdateTimeToLive.

* fix(cloudformation): apply TimeToLiveSpecification on DynamoDB tables

An AWS::DynamoDB::Table declaring TimeToLiveSpecification reached
CREATE_COMPLETE while DescribeTimeToLive answered DISABLED, because the
provisioner never read the property.

The provisioner now reconciles TTL against what the table reports, so
UpdateTimeToLive is called only when the setting differs: enabled turns
it on, Enabled false or a block removed on an update turns it off with
the current attribute name, and renaming an enabled attribute fails with
the DynamoDB ValidationException before anything changes. Enabled with
no AttributeName fails with ValidationError before the table is created.

An in-place table update now records the tags, stream and TTL setting
it replaces, and rollbackUpdate puts all three back, so a stack whose
update fails on a later resource ends UPDATE_ROLLBACK_COMPLETE instead
of UPDATE_ROLLBACK_FAILED. A restore that throws keeps the snapshot.

* fix(cloudformation): roll back and clean up failed DynamoDB table provisions

A table's in-place update that failed after its snapshot, for example on
UpdateTimeToLive after the tags and the stream had changed, lost the
snapshot: the engine put the previous resource back and reported
UPDATE_ROLLBACK_COMPLETE with the changes still live. The provisioner
now retains a failed attempt that carries its snapshot, so the engine
hands it to rollbackUpdate. A failure before the snapshot changed
nothing and still uses the engine's restore.

A provision that failed after createTable left the new table behind,
on create and on a replacing update alike. The provisioner now deletes
a table this attempt created, tolerating ResourceNotFoundException, and
never one it adopted or updates in place. A delete that fails is logged
and leaves the physical id and the rollback ownership marker, so the
stack's create rollback retries it. A table recreated because the
update target was gone takes no snapshot, since it has no prior state.

* fix(cloudformation): match the AWS status reasons for invalid TimeToLiveSpecification

Renaming an enabled TTL attribute and enabling TTL without an
AttributeName now fail with the handler message AWS CloudFormation
reports, as measured in eu-west-1, and with its InvalidRequest handler
error code. The resource status reason is the AWS inner text exactly;
the type and logical id prefix are gone, since AWS does not include them.

* fix(cloudformation): scope DynamoDB table TTL to the stack and validate Enabled

- An update leaves TTL alone when neither the template nor the previous
  one declared TimeToLiveSpecification, so TTL enabled outside the stack
  survives, as on AWS.
- A TimeToLiveSpecification without Enabled, or with a non-Boolean one,
  fails model validation before the table is created.
- A replacing update whose created table cannot be deleted reports a
  rollback failure naming the table instead of leaving it untracked.
2026-10-14 15:57:36 -04:00
Nazimuddin Tajuddin Basha daef71ca76 feat(guardduty): add Malware Protection plans and AWS::GuardDuty::MalwareProtectionPlan (#5373)
* feat(guardduty): add Malware Protection plans and AWS::GuardDuty::MalwareProtectionPlan

Adds CreateMalwareProtectionPlan, GetMalwareProtectionPlan,
UpdateMalwareProtectionPlan, DeleteMalwareProtectionPlan and
ListMalwareProtectionPlans, and routes plan ARNs through the shared tag
operations.

Adds a CloudFormation provisioner for AWS::GuardDuty::MalwareProtectionPlan.
Ref and Fn::GetAtt MalwareProtectionPlanId return the plan id, and Arn,
CreatedAt, Status and StatusReasons are set. Role, object prefixes, the
tagging action and tags update in place; a different BucketName is rejected
because the update API cannot change the bucket.

Management plane only: no scan runs, so a plan stays ACTIVE.

Closes #4657

* fix(guardduty): address review findings on Malware Protection plans

- Apply a plan update all-or-nothing: validate every supplied field before
  storing any, so a rejected request no longer changes the role.
- Page ListMalwareProtectionPlans by the last returned id instead of an
  offset, so deleting a plan between pages neither fails nor skips, and use
  the documented default page size of 100.
- Restore a plan on a failed CloudFormation stack update from a snapshot
  taken before the first change, and delete a plan an update created in
  place of one deleted out of band.
- Clear ObjectPrefixes and Actions on a stack update that drops them.
- Apply the creation tag rules to the shared tag routes.
- Require the role to be an IAM role ARN.
- Use explicit types instead of var.

* style(guardduty): import ArrayList instead of fully qualified name

* test(cloudformation): wire GuardDuty into CfnProvisionerFixture

CfnProvisionerFixtureTest requires every provisioner to be reachable through a public Builder setter. Add a guardDuty(...) setter that registers GuardDutyMalwareProtectionPlanCfnProvisioner.

* fix(guardduty): address second review round on Malware Protection plans

- Rolling back a stack update that recreated a plan deleted out of band now
  restores the prior plan's Arn, CreatedAt, Status and StatusReasons, not only
  its id, so Fn::GetAtt no longer names the deleted replacement. The
  out-of-band test now changes the plan's properties: unchanged resources are
  skipped on update, so it never reached the create before.
- Plan tag keys are checked against GuardDuty's documented TagKey pattern
  (^(?!aws:)[a-zA-Z+-=._:/]+$) on creation and on TagResource.
- The tag routes require the supplied ARN to equal the stored plan's ARN, so
  a matching plan id under another account, service or partition is
  ResourceNotFoundException.
- The /malware-protection-plan routes move behind a @PreMatching filter that
  rewrites only guardduty-signed requests to /_guardduty, as DlmRouteFilter
  does, so path-style S3 requests for a bucket of that name reach S3.

* style(guardduty): import Instant and List, drop em-dash, document the plan route

Review on #5373: GuardDutyController used an inline java.time.Instant and its
Javadoc carried an em-dash, which AGENTS.md rules out. The Javadoc's routing
paragraph now names /malware-protection-plan next to /detector and /admin and
says GuardDutyRouteFilter keeps a same-named S3 bucket reachable. The
CloudFormation and plan integration tests import List and nullValue instead of
spelling them out.

* refactor(core): share signed-service route rewriting across DLM, GuardDuty and Resource Explorer 2

DlmRouteFilter, GuardDutyRouteFilter and ResourceExplorer2PathRewriteFilter each
repeated the same path test, credential-scope check and rewrite. They now
delegate to SignedServiceRoute in core.common.

The helper also reads the signing service from the X-Amz-Credential query
parameter when there is no Authorization header, as ServiceEnabledFilter does
(which now uses the same lookup), so a query-signed plan request reaches
GuardDuty instead of S3.

A request sent straight to an internal prefix that is not signed for the
service is refused as S3 refuses that bucket name, rather than reaching the
service's routes. Resource Explorer 2's prefix moves from /re2 to /_re2, since
re2 is a valid bucket name.
2026-10-13 13:17:16 -04:00
Allen Sanborn 63b48342d6 feat(redshift): add snapshot copy and snapshot schedule operations (#5574)
* feat(redshift): add snapshot copy and snapshot schedule operations

Terraform's aws_redshift_snapshot_copy, aws_redshift_snapshot_schedule and
aws_redshift_snapshot_schedule_association failed with InvalidAction because
the Query handler had no arms for these actions.

- EnableSnapshotCopy / DisableSnapshotCopy / ModifySnapshotCopyRetentionPeriod
  store the copy settings on the cluster, and DescribeClusters reports
  ClusterSnapshotCopyStatus while copy is enabled. RetentionPeriod defaults
  to 7 and ManualSnapshotRetentionPeriod to -1. Faults follow the Redshift
  model: SnapshotCopyAlreadyEnabledFault, SnapshotCopyAlreadyDisabledFault,
  SnapshotCopyDisabledFault (modify), InvalidRetentionPeriodFault and
  SnapshotCopyGrantNotFoundFault.
- Create/Describe/Modify/DeleteSnapshotSchedule and
  ModifyClusterSnapshotSchedule. The association lives on the cluster, so
  DescribeSnapshotSchedules derives AssociatedClusters (state ACTIVE) and
  filters by ClusterIdentifier from it, and a deleted cluster cannot leave a
  stale association. Deleting a schedule in use is refused with
  InvalidClusterSnapshotScheduleState.
- Snapshot schedules take part in CreateTags/DeleteTags/DescribeTags as
  resource type snapshotschedule.

No snapshot is copied to another region or taken on a schedule; the docs
say so.

* fix(redshift): reject malformed snapshot schedules and in-use copy grant deletion

* fix(redshift): validate snapshot copy region and snapshot schedule identifier

EnableSnapshotCopy now refuses a DestinationRegion that is not a published
AWS region with UnknownSnapshotCopyRegionFault (404), as the model lists.

CreateSnapshotSchedule now refuses a ScheduleIdentifier containing anything
but letters, digits and hyphens with InvalidParameterValue (400). The API
reference allows alphanumerics; the management guide's example uses a hyphen.
2026-10-13 13:12:34 -04:00
Vũ Thế Huy b8e628356c feat(cloudformation): provision ElastiCache serverless caches (#5423)
* feat(cloudformation): provision ElastiCache serverless caches

Add the AWS::ElastiCache::ServerlessCache provisioner on top of the serverless cache API, with dotted Endpoint.* and ReaderEndpoint.* Fn::GetAtt attributes, in-place modification, rejected immutable changes and replacement on rename.

* fix(cloudformation): reject a malformed NoPasswordRequired on ElastiCache users

* fix(cloudformation): restore serverless cache settings on a failed update and reset removed ones

* refactor(elasticache): inject ElastiCacheService once into the serverless service

* fix(cloudformation): replace a serverless cache on its create-only properties

Register AWS::ElastiCache::ServerlessCache in create-only-properties.json so a
change to ServerlessCacheName, SubnetIds, KmsKeyId or SnapshotArnsToRestore is
reported as a replacement instead of being applied in place or ignored.

Share one Docker availability probe across the ElastiCache integration tests and
validate the tag count in one place in ElastiCacheServerlessService.

* fix(cloudformation): reject custom-named serverless cache replacement on create-only properties

* fix(cloudformation): simplify serverless create-only update check and share replacement error
2026-10-13 13:00:16 -04:00
danielxoi f50437efba feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory (#5226)
* feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory

The AgentCore control plane is emulated but had no CloudFormation provisioner,
so the three types fell through to the generic stub that exposes only Arn and
a template using Fn::GetAtt [Memory, MemoryArn] in an IAM policy failed the
stack. BedrockAgentCoreCfnProvisioner maps every template property the
services can store onto CreateAgentRuntime / CreateAgentRuntimeEndpoint /
CreateMemory, publishes Ref as the registry schema's primaryIdentifier and
Fn::GetAtt for every read-only property, updates in place when the
create-only properties are unchanged and replaces otherwise, and deletes on
stack teardown. Properties the emulated services have no model for are logged
once at warn and listed in the docs.

* fix(cloudformation): make AgentCore updates rollback-aware and authoritative

Reachable through CfnProvisionerFixture (two-service inference arm). In-place
updates snapshot the prior runtime, endpoint and memory configuration and tags,
restore them on rollback, and delete a created entity when a later step of the
same provision fails. The template is authoritative: UpdateAgentRuntime replaces
the full configuration as AWS's PUT does (omitted authorizer, protocol and
environment are cleared on the SDK path too), and the partial-update Memory and
Endpoint calls get a replace-omitted overload for the provisioner. Nested
AWS::NoValue members are omitted rather than stored blank, and the control
service validates networkMode and serverProtocol with the API's
ValidationException wording.

* fix(cloudformation): accept AGUI runtimes and share the guarded provision helper

The protocol check left out AGUI, which the AgentCore API and the Runtime
schema allow, so an AG-UI runtime was refused through the API and in a stack.

Ec2NetworkCfnProvisioner and BedrockAgentCoreCfnProvisioner carried the same
guarded helper; it now lives on CfnRollback, taking the provisioner's
in-place undo as a callback, and both use it.
2026-10-12 21:38:57 -04:00
Jay aff6f0eec4 fix(cloudformation): expand a SAM function's EventInvokeConfig (#5524)
* fix(cloudformation): expand a SAM function's EventInvokeConfig

SAM's EventInvokeConfig was dropped, so a function declaring retries, a maximum
event age or invoke destinations deployed with Lambda's defaults and no
destination at all. It now expands as AWS's SAM translator expands it: an
AWS::Lambda::EventInvokeConfig on $LATEST or the AutoPublishAlias alias, the
inline role policy for each destination, the SQS queue or SNS topic SAM creates
for a destination given only its Type, and SAM's conditions and error messages.

The function's Condition, DeletionPolicy and UpdateReplacePolicy now reach every
resource generated for it, as SAM passes them through. A condition naming another
with anything but a string is rejected as CloudFormation rejects it, which also
fails the template SAM produces for a conditional function with a conditional
destination, as on AWS.

* fix(cloudformation): resolve SSM parameters for the SAM transform and omit NoValue destinations

CloudFormation resolves an AWS::SSM::Parameter::Value<String> parameter before it
runs the SAM transform, so a destination Type taken from one is the stored value.
The transform now gets the given parameter values over each Default, with
SSM-typed parameters read from Parameter Store, wherever it runs.

A Destination of AWS::NoValue passes through SAM unchanged and leaves its side
without an ARN, which CloudFormation's validation rejects. The event invoke config
provisioner resolved it to an empty string and stored that; it now omits
AWS::NoValue, so the destination fails as the schema requires.

* refactor: share SHA-1 as Digests.sha1

The SAM transform's generated condition names, EC2 key pair fingerprints and
the SAML assertion name qualifier each made their own one-shot SHA-1 digest.
They now share Digests.sha1 beside sha256. Also moves samTransformParameters
above resolveSsmParameters' Javadoc, which it had been inserted beneath.
2026-10-12 18:34:39 -04:00
Vũ Thế Huy 86b32584f3 feat(cloudformation): provision ElastiCache users and user groups (#5422)
* feat(cloudformation): provision ElastiCache users and user groups

Add AWS::ElastiCache::User and AWS::ElastiCache::UserGroup provisioners with authentication mode handling, create-only UserName, membership deltas, engine changes and replacement on rename.

* fix(cloudformation): address review findings for ElastiCache users and user groups

- Require Engine property when provisioning AWS::ElastiCache::User

- Reject invalid and conflicting AuthenticationMode combinations

- Add setUserGroupMembers to atomically update group membership under lock

- Require UserIds property when provisioning AWS::ElastiCache::UserGroup

- Snapshot and restore User and UserGroup on stack update rollback

- Tighten replaced subnet group deletion assertion in integration test

* refactor(elasticache): share user authentication and user group update logic

Move the AuthenticationMode / Passwords / NoPasswordRequired decision into
UserAuthentication so the query handler and the CloudFormation provisioner
no longer duplicate it. Make modifyUserGroup and setUserGroupMembers share
one locked update path, and drop the concurrency test that passed without
the lock.
2026-10-12 14:28:27 -04:00
Alessandro Lattao 85e0061a6f feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping (#5038)
* refactor(apigateway): move the v2 domain and API mapping rules into the service

CreateDomainName and CreateApiMapping on /v2/domainnames kept their rules in
ApiGatewayController: the one-configuration check, the refusal of inputs Floci
does not emulate, the flattening onto the shared custom-domain store, the API
and stage existence check, the mapping key conflict check, the API type the
mapping is routed as, and the mapping id. A CloudFormation provisioner cannot
reach a controller, so it would have had to copy them.

They now live in ApiGatewayService. createV2DomainName validates the body and
creates the domain; createApiMapping checks the API and stage, refuses a key
that is taken and routes the mapping as the API's protocol type; getApiMapping,
deleteApiMapping and apiMappingId follow. ApiGatewayService takes
ApiGatewayV2Service for the API and stage lookup, so the whole rule sits in one
place and a caller needs one service. Nothing on the v2 side depends on the v1
service, so this adds no cycle. Leaving the lookup in ApiGatewayV2Service was
tried first, but then every caller had to resolve the API before calling into
ApiGatewayService, and the rule was split across two classes again.

The code is moved, not rewritten: messages, error codes, the order of the
checks and the id scheme are unchanged, and the controller delegates.

* feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping

Both types were left to the stub arm. A stack reported CREATE_COMPLETE, but no
domain or mapping existed, Fn::GetAtt on the domain resolved to literals such
as DomainResource.RegionalDomainName (so a Route 53 alias built from it pointed
nowhere), and with allow-stub-unsupported-resource-types off the stack rolled
back.

ApiGatewayV2DomainCfnProvisioner creates them through the v2 rules in
ApiGatewayService and injects only that service. Ref on a domain is its name
and Fn::GetAtt returns DomainNameArn, RegionalDomainName and
RegionalHostedZoneId as GetDomainName reports them. Ref on a mapping is its
ApiMappingId, which is also its only attribute.

Updates follow AWS. DomainName is the only createOnly property of either type,
and everything else changes in place: the domain's configuration is replaced as
a whole, as DomainNameConfigurations is on AWS, and a mapping's ApiId, Stage and
ApiMappingKey change without a new id. To keep the id across a key change, a
mapping now stores the apiMappingId it was given instead of deriving it from
its key on every read. A record persisted before is still read under the
derived id, and a new mapping gets the id it always had unless another mapping
holds it. Deriving the id and documenting the difference was the first version;
it was dropped because Ref changed where AWS keeps it, and the change set
already reported the key change as an update.

A replacement creates the new entity and leaves the displaced one to
ReplacementCleanup, so it is deleted in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS,
kept under UpdateReplacePolicy: Retain, and put back when a later resource
fails the update. The first version deleted the old domain inside provision, as
the v1 provisioner does, and a failed rename then ended in
UPDATE_ROLLBACK_FAILED with the original domain and its mappings already gone.
A mapping moved to another domain gets an id the displaced mapping does not
hold, since two mappings under one physical id cannot be told apart, and the
domain of each displaced id is recorded beside the cleanup. An in-place update
snapshots what it changes, so a failed stack update restores it instead of
ending in UPDATE_ROLLBACK_FAILED.

CDK templates needed the v2 rules to match AWS in two more places.
apigateway.DomainName with a multi-level basePath maps a REST API through
AWS::ApiGatewayV2::ApiMapping, so a mapping now accepts a REST API stage. And
the restrictions AWS documents for API mappings are enforced, in the API and in
templates alike: no v2 call on an edge-optimized domain, with AWS's message;
TLS_1_2 for an HTTP API or a multi-level key, which also keeps such a domain on
TLS_1_2; no WebSocket API beside an HTTP or REST API; and AWS's key characters
and length.

The id-only delete accepts <ApiMappingId>|<DomainName>, the type's primary
identifier, which is how Cloud Control names a mapping; a bare id still answers
NotFoundException, so Cloud Control cannot report a delete that did not happen.
The integration test deploys two templates aws-cdk-lib 2.272.0 synthesized,
checked in with the app that produced them, and compat-cdk deploys the same
shapes.

* fix(apigateway): answer v2 domain and API mapping calls as API Gateway does

The review of this PR found four places where Floci answered differently
from API Gateway. Each was measured against API Gateway in eu-west-1 on
2026-10-04, with an imported certificate on a throwaway domain.

An HTTP API custom domain is regional. CreateDomainName and
UpdateDomainName with an endpoint type of PRIVATE, or one API Gateway does
not know, give a REGIONAL domain, where Floci refused the first and stored
the type on an update. EDGE is refused with "EDGE endpoint type is not
supported for APIGatewayV2 domainName", not the message for v2 calls on an
existing edge-optimized domain.

API mapping keys are checked as API Gateway checks them, with its messages:
a key does not end with '/', does not start with '/' or hold '//', holds
letters, digits and $-_.+!*'(), between its levels, and is at most 300
characters. No key, an empty one, or on a create one of whitespace only, is
the root; an update refuses whitespace only. Floci took "/" for the root and
had its own message for the characters, without the comma.

UpdateApiMapping and UpdateDomainName answer over the v2 HTTP API, not only
from CloudFormation. What an UpdateApiMapping leaves out keeps its value.

Cloud Control identifies an AWS::ApiGatewayV2::ApiMapping by the type's
primary identifier, <ApiMappingId>|<DomainName>, while CloudFormation's Ref
stays the bare id: CloudControlService derives the identifier from the
desired state, as it already names primary identifier fields by type, and
the provisioner deletes by it with the create-time attributes too.

* fix(apigateway): refuse a v2 update of an edge domain, and recover a compound identifier whole

The second review pass found three gaps in the previous commit.

UpdateDomainName through the v2 API converted a v1-created edge-optimized
domain to REGIONAL. The v2 API does not manage an edge-optimized domain, so
the update is refused with the message every other v2 call on one gets, and
the CloudFormation in-place update goes through the same check.

A v2 UpdateDomainName without a configuration returned the domain unchanged
without looking at the rest of the body, so a mutual TLS request was
silently dropped. ApiGatewayService.updateV2DomainName now refuses what
Floci does not emulate, and the edge-optimized domain, either way.

Cloud Control's recovery of a create that finished just before a restart
took the identifier after the last '|' of its key, which for an API
mapping's <ApiMappingId>|<DomainName> left only the domain. It now takes
everything after the key's third separator.

A later review pass found four more points.
UpdateApiMapping fills in what its body leaves out under the lock the update
takes, so two partial updates of one mapping cannot write back each other's
old values. A v2 domain's certificate is stored as the v1 API's regional
certificate, which is what a regional domain reports through both APIs; a
domain the v2 API wrote before still reports the one it holds until its
configuration is replaced. The domain ARN both APIs and both CloudFormation
provisioners build comes from ApiGatewayService.domainNameArn, the Cloud
Control test waits with the awaitSuccess helper main has since gained, and
requireMappingAllowed's javadoc is back on it.
2026-10-12 11:28:04 -04:00
Anders Wasen bfa9c2fbcc feat(cloudformation): provision Application Auto Scaling targets and policies (#5407)
* feat(cloudformation): provision Application Auto Scaling targets and policies

AWS::ApplicationAutoScaling::ScalableTarget and ::ScalingPolicy had no
provisioner, so a template that scales an ECS service failed on those two
resources although the Application Auto Scaling service behind them, including
the ECS capacity adjuster, was already there. This wires the two together.

A scalable target has no name of its own: it is keyed by the triple of service
namespace, resource id and scalable dimension, and CloudFormation's Ref is those
three joined by a pipe. That composite is the physical id, which is also what a
policy's ScalingTargetId carries when a template points one at the other with
Ref, so the provisioner splits it back into the triple. A policy's Ref is its
ARN rather than its name, so deleting one resolves the ARN through
findPolicyByArn to recover the name and triple the service deletes by.

Because the target's id is derived from the triple, changing any part of it
replaces the target rather than updating it, so both types go through
ReplacementCleanup to deregister what they displaced. Deletes tolerate only
ObjectNotFoundException through CfnDeletes.safeDelete: a target takes its own
policies with it, so a stack teardown reaches an already-deleted policy by
ordinary ordering, while any other failure still surfaces as DELETE_FAILED.

The properties each schema marks required are enforced rather than defaulted.
MinCapacity and MaxCapacity on a target, and PolicyName and PolicyType on a
policy, would otherwise register a target that never scales or accept a template
CloudFormation itself rejects.

The two scaling configuration blocks are parsed by the same code the
PutScalingPolicy API path uses, extracted to ScalingConfigurationParser, since
CloudFormation spells their members exactly as the API does. One parser means a
template and an API call cannot disagree about what a policy means.

ScheduledActions on a target is logged rather than dropped silently: Floci does
not run scheduled scaling, and a template that scales on a clock should not look
fully provisioned when nothing is scheduled.

* fix(cloudformation): resolve intrinsics inside the scaling configuration blocks

Review on #5407: the two scaling configuration blocks and SuspendedState reached
the parser as raw template JSON, so an intrinsic inside one was never resolved.
That is worse than it sounds, because an intrinsic is still a non-null node:
hasNonNull passes and the value is read with asDouble, asText or asBoolean,
which answer 0, "" and false. A policy written as TargetValue: !Ref TargetCpu
registered as a policy targeting 0 percent rather than failing, a ResourceLabel
built with Fn::Join arrived empty, and a flag behind Fn::If read false.

Each block now goes through ctx.engine().resolveNode first, which is what
AutoScalingScalingPolicyCfnProvisioner already does with its own block. Only
nested objects were affected: the top-level properties were already read through
ctx.resolveOptional, which resolves.

A target's Tags were dropped as well, passed to the service as an empty map
rather than read with ctx.resolveTags.

ScheduledActions now carries a note in the generated resource-type table rather
than only a warning in the log, so the gap is visible before someone wonders why
their clock-based scaling never fires.

* test(cloudformation): make the SuspendedState intrinsic test fail without its fix

Review on #5407: anIntrinsicInsideSuspendedStateIsResolvedToo passed against the
previous commit too. REFS had no Suspend entry, so the flag resolved to an empty
string and read false either way, and assertNotNull held regardless because the
raw block was already an object. The test pinned nothing.

REFS now maps Suspend to true and the assertion is on
isDynamicScalingInSuspended(), so it fails with expected: <true> but was:
<false> when SuspendedState is read without resolveNode. The redundant copy of
the properties node is gone.
2026-10-11 12:19:25 -04:00
Vũ Thế Huy bac2c7cbf9 feat(elasticache): add serverless cache APIs (#5366)
* feat(elasticache): add serverless cache APIs

Add CreateServerlessCache, DescribeServerlessCaches, ModifyServerlessCache and DeleteServerlessCache over the Query protocol. Each cache is backed by a hidden cluster that the ordinary cluster APIs do not list, with its own user-group authentication path in the proxy.

* fix(elasticache): sua loi container rollback, validation tag, leak log stream va npipe hang

- Thu hoi container va storage khi tao Memcached provisioning that bai
- Format thong bao loi deleteCacheCluster chua cluster id
- Validate tag key trong CreateServerlessCache khi co tag value
- Chuan hoa case-insensitive cho userGroupId va region key cho nhom attachment
- Giai phong dung logStream khi stop container trong ElastiCache va Memcached container manager
- Tat validateAfterInactivity tren npipe trong FlociDockerHttpClient de tranh deadlock tren Windows

* fix(elasticache): release serverless backing on reset and make delete and list tolerant

- release backing clusters and user group attachments in clear()
- let DeleteServerlessCache be retried after the backing cluster is already gone
- keep DescribeServerlessCaches working when one cache has lost its backing
- drop the unused replaceTags and document that tags are create-only

* fix(core): drop the named-pipe stale-connection change, #5400 makes it
2026-10-11 08:53:07 -04:00
Aymen JAMAAOUI 61fe304619 feat(cloudformation): provision CloudFront public keys, key groups and functions (#5390)
* fix(cloudfront): reject CreateFunction when the name already exists

* feat(cloudformation): provision CloudFront public keys, key groups and functions

* fix(cloudformation): validate CloudFront function properties and always drop its tags on delete

* fix(cloudformation): require the CloudFront function comment and reuse resolveOptional
2026-10-11 00:16:51 -04:00
Vũ Thế Huy 475d230ebc feat(cloudformation): provision ElastiCache cache clusters and subnet groups (#5307)
* feat(cloudformation): provision ElastiCache cache clusters and subnet groups

Add AWS::ElastiCache::CacheCluster and AWS::ElastiCache::SubnetGroup provisioners with Ref, Fn::GetAtt endpoint attributes, create-only replacement and update handling. Subnet group updates now carry tags through modifyCacheSubnetGroup, and Memcached clusters record their network type.

* fix(elasticache): validate cluster name, rollback subnet groups and preserve memcached tags

* fix(elasticache): align in-use error wire code and enforce schema required properties
2026-10-10 11:11:00 -04:00
Mario Toffia 233d05eab1 docs(cloudformation): scope required AppSync resources (#4897)
The AppSync page did not say which AWS::AppSync resource types
CloudFormation provisions, what Ref and Fn::GetAtt return for them, or
what happens to the AppSync types Floci does not serve. A CDK app that
deploys a GraphQL API had to read the provisioner to find out.

The page now has a CloudFormation section. It lists the six provisioned
types with their Ref value and Fn::GetAtt attributes, and the
differences measured by deploying the same template to AWS and to
Floci: Ref on GraphQLApi and ApiKey returns the id where AWS returns the
ARN, GraphQLEndpointArn is not modeled, the URL and DNS attributes point
at Floci, and AWS refuses Fn::GetAtt Id on a GraphQLSchema while Floci
resolves it. It also states that a schema given only by S3 location
and S3 code locations are refused, and that the remaining AppSync types
are stubbed by default.

The generated CloudFormation resource-type table gets a row note with
the Ref difference and a link to that section.
2026-10-09 14:54:03 -04:00
Matheus Oliveira c6304a26c8 feat(cloudformation): provision AWS::Transfer::User (#5076)
* feat(cloudformation): provision AWS::Transfer::User

Adds the user type to TransferCfnProvisioner with in-place update and replacement.

* Fix #4655

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

* docs: count the IAM SSH public key operations in the service matrix

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

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-04 18:19:43 -04:00
Vũ Thế Huy 99a6b4050c feat(redshift-serverless): add running workgroups and Data API WorkgroupName support (#5012)
* feat(redshift-serverless): add running workgroups and Data API WorkgroupName support

Redshift Serverless workgroups get full CRUD (Create/Get/List/Update/Delete),
tagging by ARN, and the AWS::RedshiftServerless::Namespace and ::Workgroup
CloudFormation types with dotted Fn::GetAtt keys taken from the registry
schema. A namespace has at most one workgroup, and DeleteNamespace is refused
while one is attached.

Each workgroup runs a PostgreSQL container behind an authenticating proxy,
sharing the managers and the proxy port pool with provisioned Redshift. Add
GetCredentials, accept WorkgroupName (name or ARN) in the Redshift Data API,
and push a changed namespace adminUserPassword down to the running backend.
The runtime is re-attached when Floci restarts.

Not covered: snapshots, usage limits, endpoint access, and COPY/UNLOAD/Spectrum
on workgroups.

* fix(redshift-serverless): stop the runtime when workgroup creation fails after it started

If persisting the workgroup record failed after the container and proxy were
already running, the runtime was left behind with no record. createWorkgroup
now stops it (best effort) and releases the endpoint on the failure path.

Fix the CloudFormation error for a NamespaceName change: suggesting a new
WorkgroupName can never succeed because a namespace holds only one workgroup.

* fix(redshift-serverless): reset omitted CloudFormation properties and order startup observers

When UpdateStack drops a property from the template, the provisioner now sends
its default (BaseCapacity, EnhancedVpcRouting, PubliclyAccessible, Port,
TrackName, PricePerformanceTarget) instead of keeping the stored value, which
matches CloudFormation semantics. MaxCapacity has no default and keeps its
stored value.

Give the workgroup StartupEvent observer a @Priority after RedshiftService so
every persisted cluster has reserved its proxy port before workgroups restore
theirs.

Also remove an unused import and move DEFAULT_DATABASE to the top of
RedshiftContainerManager.

* fix(redshift-serverless): address review findings on password rotation and namespace updates

- Roll the backend password back when a rotation cannot be completed or stored, and apply
  it last so validation failures never leave the backend ahead of the stored namespace.
- Keep a workgroup endpoint reserved when its runtime cannot be stopped during clear().
- Reject an in-place DbName change in CloudFormation, since it is fixed at creation.
- Reset an omitted KmsKeyId and DefaultIamRoleArn on CloudFormation updates.

* fix(redshift-serverless): keep rollback failures from masking errors and drop stale GetAtt role

- Do not reset the proxy password when the role restore fails, and attach restore
  failures to the original exception instead of replacing it.
- Remove Namespace.DefaultIamRoleArn from the stack resource when an update no
  longer declares a default role.

* docs: correct the Redshift Serverless operation count in the service matrix

* fix(redshift-serverless): expose Workgroup.ConfigParameters through Fn::GetAtt

* fix(redshift-serverless): parse ConfigParameters resolved from a GetAtt attribute

* docs(redshift-serverless): list every unsupported operation group
2026-10-04 15:34:24 -04:00
Mario Toffia 66f04cde25 feat(eventbridge): provision AWS::Events::Archive (#4818)
* fix(eventbridge): make UpdateArchive a partial update

UpdateArchive reset the event pattern to null and the retention to 0
whenever a request omitted them. On AWS an omitted Description,
EventPattern or RetentionDays keeps the stored value, an empty
Description or EventPattern clears it, and RetentionDays 0 sets 0.

* feat(eventbridge): provision AWS::Events::Archive

CloudFormation stubbed AWS::Events::Archive with a fake ARN and created
nothing. EventsArchiveCfnProvisioner now creates a real archive through
EventBridgeService.

Ref is the archive name and Fn::GetAtt Arn the archive ARN. ArchiveName
is generated when omitted and kept across updates. Description,
EventPattern and RetentionDays update in place, sending only the
properties the template declares, and a failed stack update restores
them from a snapshot. Changing SourceArn or ArchiveName, or dropping an
explicit name, replaces the archive and deletes the displaced one once
the update commits. A replacement that keeps an explicit name is refused
with CloudFormation's custom-named resource error before any change.
KmsKeyIdentifier is ignored.

Closes #4815

* fix(eventbridge): reject an archive source that is not an existing bus of the account and region

CreateArchive now checks EventSourceArn as AWS does, before the archive
name: a bus in another account fails with AccessDeniedException, one in
another region with ValidationException, and a bus that does not exist
with ResourceNotFoundException. The AWS::Events::Archive provisioner goes
through the same service call, so a stack can no longer reach
CREATE_COMPLETE with an archive that could never capture an event.

* test(eventbridge): roll back an in-place archive update when a later resource fails

A stack update changes an archive's description and retention in place,
then fails on a second archive whose source bus does not exist. The stack
ends UPDATE_ROLLBACK_COMPLETE, DescribeArchive shows the original values
and the second archive was never created. The golden case passes on AWS
and is mirrored in the Floci integration test.

* fix(cloudformation): refuse declaring a generated archive name explicitly

Adding ArchiveName with the name CloudFormation generated for an unnamed
archive asks AWS to replace the archive under the same custom name, which
it refuses with the custom-named resource error and rolls the stack back.
Floci took the in-place path and reached UPDATE_COMPLETE; the existing
refusal now also fires when the previous name was generated.

* fix(cloudformation): provision a real archive when updating a stack whose archive was stubbed

A stack created before AWS::Events::Archive had a provisioner holds the dispatcher's stub, whose physical id names no archive. Its next update now creates the archive instead of failing to describe that id, and the stub id is left to the replacement cleanup.

* fix(eventbridge): validate archive description, pattern and retention as CreateArchive and UpdateArchive do

CreateArchive and UpdateArchive now reject a description over 512 characters, an event pattern over 4096 characters and a negative retention with the ValidationException AWS returns, all violations reported together. The check runs before the source, existence and duplicate checks, so it also fails the AWS::Events::Archive resource in a stack.
2026-10-04 13:39:49 -04:00
Aswin A 4d980a361f fix(docs): prevent stale service action counts (#5018)
* fix(docs): prevent stale service action counts

* test(docs): validate composite service action counts

* fix(docs): clarify action count validation coverage

* fix(docs): derive shared tagging route counts

* fix(docs): align service action counts
2026-10-04 08:18:53 -04:00
XuJian bcb50b765f feat(cloudformation): provision Transfer Family servers (#4809)
* feat(cloudformation): provision Transfer Family servers

* fix(cloudformation): clear Transfer update snapshot after success

* test(cloudformation): cover Transfer tag rollback

* fix(cloudformation): match Transfer server return values
2026-10-01 22:28:47 -04:00
Mario Toffia a338a430cc feat(cloudformation): provision Cloud Map namespaces and services (#4599)
* feat(cloudformation): provision Cloud Map namespaces and services

AWS::ServiceDiscovery::PrivateDnsNamespace, PublicDnsNamespace,
HttpNamespace and Service were stubbed, so a stack reported them created
while nothing existed in Cloud Map and Fn::GetAtt resolved to literals.

CloudMapCfnProvisioner creates them through CloudMapService. Ref returns
the id; Fn::GetAtt exposes Id and Arn, HostedZoneId on a DNS namespace and
Name on a service. An unnamed service is named <LogicalId>-<12 chars>, as
measured on AWS. Description, DnsConfig, HealthCheckConfig and Tags update
in place; a createOnly change replaces the resource through
ReplacementCleanup, and a rolled-back replacement restores the createOnly
record. A Ref to a Number parameter is coerced back to a JSON number for
DnsRecords TTL and FailureThreshold.

Closes #4596
* fix(cloudformation): roll back in-place Cloud Map updates

An in-place namespace or service update followed by a later resource
failing left the Cloud Map changes live and the stack in
UPDATE_ROLLBACK_FAILED, since rollbackUpdate only undid replacements.
The provisioner now keeps the description, DnsConfig, HealthCheckConfig
and tags an in-place update overwrites and puts them back on rollback;
a committed update drops the snapshot.
* fix(cloudmap): reject DNS record type changes on service update

UpdateService only changes the TTLs of a service's existing DNS records on AWS. An in-place CloudFormation update that changes the record types, or gives a DnsConfig to a service without one, now fails with InvalidInput instead of being applied, so it rolls back like on AWS and a rollback never has to remove a DnsConfig.
* fix(cloudmap): accept only TTL changes in a service DnsConfig update

UpdateService carries only DnsRecords on AWS and CloudFormation does not support a RoutingPolicy update. Comparing the record types as a set let a RoutingPolicy change or an added record of the same type through; the requested and stored DnsConfig now have to match apart from the TTLs.
* fix(cloudmap): ignore DNS record order in a service DnsConfig update

A TTL-only update that listed the same records in another order was rejected. The comparison now uses the sorted record types, so counts, types and RoutingPolicy still have to match.
* test(cloudformation): restore a real HealthCheckConfig in the Cloud Map rollback test

The in-place rollback test went from a null health check config to null, so dropping it from the snapshot would have passed.
2026-09-30 21:45:18 -05:00
Mario Toffia 5bad6774f6 refactor(dynamodb): isolate backend operation execution (#4379)
* refactor(dynamodb): route wire operations through a backend seam

Rename the native wire handlers to NativeDynamoDbJsonHandler and NativeDynamoDbStreamsJsonHandler.
Add DynamoDbOperations as the raw operation seam, plus typed DynamoDbItemAccess and DynamoDbTableAccess contracts.
Add NativeDynamoDbBackend behind the seam and DynamoDbBackendSelector as the one immutable selection.
Keep DynamoDbJsonHandler and DynamoDbStreamsJsonHandler as thin entry points that resolve account and region.
Add RequestScopes.callAsChecked and let AslExecutor delegate to it.

* refactor(dynamodb): route Java consumers through DynamoDbFacade

DynamoDbFacade hands out the selected item and table capabilities and is
now the one DynamoDB Resource Explorer provider in place of DynamoDbService.
CloudFormation, Step Functions, the IAM condition context and the Redshift
backfill call it with an explicit scope; the IoT dynamoDBv2 action writes as
the rule's owning account.
2026-09-25 14:57:13 -04:00
Mario Toffia 4abba5a218 fix(lambda): preserve CloudFormation event source mapping options (#4316)
AWS::Lambda::EventSourceMapping now forwards MaximumBatchingWindowInSeconds,
MaximumRetryAttempts, MaximumRecordAgeInSeconds, BisectBatchOnFunctionError,
FilterCriteria, DestinationConfig and ScalingConfig to LambdaService, so a
stack-created mapping matches an API-created one. On UpdateStack each of
these that the template omits is sent as null, which clears it.

ParallelizationFactor and TumblingWindowInSeconds are not modeled and remain
ignored; the resource-type table notes this.

Fixes #4313
2026-09-24 21:05:00 -04:00
XuJian 4a51c0e814 feat(dlm): manage lifecycle policies (#4335)
* feat(dlm): manage lifecycle policies

* fix(dlm): use shared partition regex
2026-09-24 15:08:34 -04:00
XuJian 7cf8ab7d85 feat(ce): manage anomaly monitors and subscriptions (#4221)
* feat(ce): manage anomaly monitors and subscriptions

* fix(ce): return JSON objects for empty responses
2026-09-24 08:20:17 -04:00
Hector Ventura 69ceb976c7 refactor(cloudformation): replace the retired monolith with CfnResourceDispatcher (#4269)
* refactor(cloudformation): replace the retired monolith with CfnResourceDispatcher

CloudFormationResourceProvisioner was the monolith that held every AWS::
provisioning arm. With the per-service migration complete it kept no arm:
LEGACY_SWITCH_TYPES and DELETE_NEEDS_STACK_RESOURCE were empty sets, five
private helpers duplicated ProvisionContext, six imports were unused, and its
UPDATE_ROLLBACK_* constants only re-exported CfnRollback. What it still did is
small: route provision and delete to the registry, stub a type nothing serves
(or refuse it in strict mode), answer the engine's update-lifecycle questions
through the owning provisioner, and give Cloud Control its stack-less entry
points.

That is now CfnResourceDispatcher in provisioners/, behaviour unchanged: the
same stub arm, warn lines, status reasons and strict-mode failure, with the
same logger category the unsupported-type test binds to. The dead overloads
go with the class (the 8-arg provision, the unused accountId on delete, the
short deleteStandalone forms). CloudFormationTemplateEngine gains a public
standalone(...) factory so the dispatcher can build Cloud Control's throwaway
engine from outside the package while the constructors stay package-private
for the tests that mock it. CloudFormationService reads the rollback markers
from CfnRollback directly.

The empty guards leave with the class: CfnDeletePrecedenceTest read only the
empty set, and CfnResourceInventoryTest no longer folds a legacy owner into
the inventory (the checked-in file had no such row). Javadocs that described
the switch as still present now describe the registry.

CfnResourceDispatcherTest pins the standalone engine's dynamic-reference
resolver, the prior identity reaching the ProvisionContext, and the
whole-resource delete form; every other test only changed the type it names.

* chore(cloudformation): retire the legacy-switch guards from tooling and instructions

The switch is gone, so nothing can carry a LEGACY_SWITCH owner: the schema
coverage test drops its skip, the docs generator's double-ownership check
generalises to any type with two provisioners, and its fixtures name real
owners. AGENTS.md and CONTRIBUTING.md tell contributors where types live
instead of warning them off a class that no longer exists.
2026-09-23 22:31:27 -04:00
stodan 34f4f72e82 fix(cloudformation): pass Lambda hot-reload code through to the Lambda service (#4093)
* fix(cloudformation): pass Lambda hot-reload code through to the Lambda service

AWS::Lambda::Function code of {S3Bucket: hot-reload, S3Key: /host/path} is
Lambda's bind-mount hot-reload convention: the bucket is a marker and the key
is a directory on the Docker host. The provisioner probed S3 for the pair
before calling CreateFunction, so no such object existed and the stack failed
with a ValidationError (or, with allow-stub-lambda-code on, quietly deployed
the stub handler).

Skip the S3 probe for the hot-reload bucket and hand the Code map to
LambdaService unchanged, which keeps enforcing hot-reload enablement, the
absolute-path rule and the allow-list, and reports its own error as the
resource status reason. Record a hot-reload code identity so a redeploy with
the same path is a no-op, and compare adopted functions by host path since a
hot-reload function carries no S3 bucket or key.

* fix(cloudformation): canonicalise the hot-reload code identity

LambdaService stores a hot-reload host path normalised (#4053), while the
provisioner recorded the raw template key as the code identity and compared
adopted functions against it. A template that spelled the same directory with
a trailing slash or a ".." segment, or a function adopted from a direct
CreateFunction, therefore looked like a code change and triggered an
UpdateFunctionCode that mounted the same directory again.

Build the identity from, and compare against, the normalised path. The raw key
still goes to Lambda so its validation and error messages are unchanged. Also
cover the documented SAM CodeUri form, s3://hot-reload//abs/path, through the
transform.
2026-09-23 18:03:35 -05:00
Allen Sanborn 4b3923712a feat(redshiftserverless): add namespace lifecycle and tagging (#3631)
* feat(redshiftserverless): add namespace lifecycle

Amazon Redshift Serverless was absent entirely: every call returned
UnknownOperationException, so Terraform's aws_redshiftserverless_namespace
could not be planned or applied against Floci.

Add a JSON 1.1 service under the RedshiftServerless. target prefix with
CreateNamespace, GetNamespace, ListNamespaces, UpdateNamespace, and
DeleteNamespace. Namespaces are account and Region scoped and stored through
StorageFactory. AWS defaults are applied on create (dbName dev, kmsKeyId
AWS_OWNED_KMS_KEY, empty logExports, status AVAILABLE), adminUserPassword is
accepted and never returned, DeleteNamespace returns the removed namespace
with status DELETING, and UpdateNamespace applies only the supplied fields.

Workgroups, snapshots, and the tagging operations remain unemulated.

* feat(redshiftserverless): add namespace tagging operations

Terraform's aws_redshiftserverless_namespace calls ListTagsForResource on
every read once tags are involved, so the namespace lifecycle alone left the
resource broken as soon as a config set tags.

Add ListTagsForResource, TagResource, and UntagResource. Lookup is by
resourceArn rather than namespace name, scoped to the caller's Region, since
that is how AWS keys these operations; the namespace is currently the only
taggable Redshift Serverless resource, so any other ARN is reported absent.
TagResource merges into the existing tags, UntagResource removes by key, and
tags passed to CreateNamespace are readable back and survive UpdateNamespace.

* fix(redshiftserverless): emit creationDate as ISO-8601 per the API model

The awsJson1.1 default is epoch seconds and 133 call sites use it, but this
model overrides it: TimestampFormatTrait ISO_8601 on creationDate (and on all
eleven other timestamp members in the package, audited). Strict clients broke
on the number: Terraform's Go SDK failed to decode and orphaned the created
namespace outside state; the Java SDK failed to unmarshall. Only botocore's
lenient parsing let CLI checks pass. Emitted via the repo's millisecond-ISO
idiom; format pinned by regex in the integration test and by a new
handler-level unit test class covering the wire layer that had none
(timestamp shape, nextToken emission, maxResults type guard). Checklist note
added to AGENTS.md + CONTRIBUTING.md so the next service checks the trait
before reaching for the epoch idiom.

* docs(redshiftserverless): the ISO-8601 rule is per member, not model-wide

Review follow-up: the earlier claim that every timestamp member in this model
carries TimestampFormatTrait(ISO_8601) is wrong — 15 of the model's 30 INSTANT
members carry no trait and fall back to the awsJson1.1 epoch default. The
shipped code is unaffected (creationDate, the only timestamp emitted, is
genuinely ISO_8601), but the claim was load-bearing guidance: whoever adds
snapshots or scheduled actions next would have applied ISO-8601 to trait-free
members and reintroduced the bug in the opposite direction. Narrowed in all
four places it appeared.

* fix(redshiftserverless): validate collection types, copy-on-update; drop em dashes

A present iamRoles, logExports, tags or tagKeys member that was not a JSON
array parsed to null and was then indistinguishable from an omitted member,
so a malformed UpdateNamespace silently kept the stored value and returned
200 instead of reporting the request as invalid. Only a missing or null
member now means "omitted"; a present member of the wrong type, or a
collection holding a non-string element, is a ValidationException naming the
member.

updateNamespace mutated the stored Namespace in place while GetNamespace and
ListNamespaces read without taking the same monitor, so a concurrent reader
could observe a torn object with some fields updated and some not. Build the
new state on a copy and store that instead, which also makes the write-back
explicit. The same in-place mutation was present in tagResource,
untagResource and deleteNamespace, so all four now copy. Merge semantics are
unchanged.

Replace the em dashes in the timestamp guidance with commas and periods, per
the repository ban.

* fix(redshiftserverless): reject Redshift reserved words as namespace names

CreateNamespace rejects a namespace name that is an Amazon Redshift SQL
reserved word, so names like select or user passed the length and
[a-z0-9-] checks here and were persisted. Add the documented reserved
word list to the shared namespace-name validator, which create, get,
update and delete all reach, so the rejection is consistent.
2026-09-23 10:13:24 -04:00
lex00 28ca34ad6c fix(cloudformation): apply an S3 bucket's declared configuration and its policy (#3950)
S3CfnProvisioner translated CorsConfiguration and VersioningConfiguration
and nothing else, and AWS::S3::BucketPolicy took a physical id and stopped,
so a stack reported CREATE_COMPLETE for a bucket with no lifecycle, no
public-access block, no default encryption, no tags and no policy.

PublicAccessBlockConfiguration, LifecycleConfiguration, BucketEncryption
and Tags are now translated into the XML their S3 API calls take and handed
to the same service methods, so they are validated and stored exactly as a
direct PutBucket* would be. The policy document has its intrinsics resolved
and is put on the bucket.

The policy's physical id is the bucket name, as the registry schema's
primaryIdentifier declares, and deleting the resource removes the policy,
tolerating a bucket the stack already deleted. The class javadoc names the
properties that are covered and those still dropped.

Closes #3947
2026-09-21 22:27:54 -05:00
Allen Sanborn 532bae5525 feat(dms): add replication subnet group lifecycle and tagging (#3630)
* feat(dms): add replication subnet group lifecycle

AWS DMS was entirely absent, so every terraform-aws-data-storage example
using aws_dms_replication_subnet_group failed at plan with
UnknownOperationException.

Adds a minimal dms service on AWS JSON 1.1 (X-Amz-Target prefix
AmazonDMSv20160101.) implementing CreateReplicationSubnetGroup,
DescribeReplicationSubnetGroups and DeleteReplicationSubnetGroup.
Subnets are resolved against the emulated EC2 service, so the VpcId and
Availability Zones a group reports are the ones its subnets actually
have, and AWS's own rules are enforced: the identifier is stored
lowercase, "default" is reserved, subnets must share a VPC, and a group
must cover at least two Availability Zones.

Tagging actions and replication instances, endpoints and tasks are out
of scope and still report UnknownOperationException.

* feat(dms): add resource tagging for replication subnet groups

Terraform's aws_dms_replication_subnet_group reads tags back through
ListTagsForResource, so without the tagging trio the resource could be
created but never read cleanly.

Adds ListTagsForResource, AddTagsToResource and RemoveTagsFromResource,
and stores the Tags member of CreateReplicationSubnetGroup with the
group. DMS does not return a subnet group ARN from describe, so the
provider builds arn:aws:dms:<region>:<account>:subgrp:<id> client side;
Floci parses that form back to the stored group and rejects anything
else, including another account's ARN, with ResourceNotFoundFault.

* fix(dms): address review findings

Emit IsReadOnly on ReplicationSubnetGroup, the one member of the model's
seven the response was missing. It is always false: a read-only group is
one DMS manages for a zero-ETL integration, which Floci does not emulate.

Fault a cross-Region ARN the way a cross-account one already faulted.
Storage is keyed by the caller's Region, so honouring an eu-west-1 ARN
from a us-east-1 caller silently reached the caller's own group of that
name rather than the one named.

Reject a subnet with no Availability Zone as InvalidSubnet. Set.copyOf
rejects nulls, so such a subnet raised a NullPointerException and
surfaced as a 500 instead of a client error.

Adds the user-realistic minimum-AZ case: two subnets sharing one AZ,
which the previous tests did not cover because they passed one subnet.

* fix(dms): reject wrongly-typed tag, filter and arn-list members

A present member of the wrong JSON type was coerced rather than
rejected. asText() on an object yields the empty string, so a tag whose
Value was an object stored an empty value and reported success; a
Filters or ResourceArnList member that was not a list was ignored
outright, which turned a filtered describe into an unfiltered one.

Every string member now answers SerializationException when it is
present with another JSON type, matching what AWS returns when a
json-1.1 member will not deserialize, and matching how Kinesis, Cognito
and KMS already report the same class of error here. An absent member
stays a parameter error: missing and mistyped are different faults.

* fix(dms): paginate DescribeReplicationSubnetGroups and validate the description

DescribeReplicationSubnetGroups returned every matching group in one response and
ignored both MaxRecords and Marker, so an SDK or Terraform paginator diverged from a
live account as soon as more than one page of groups existed.

Page through the shared opaque-cursor helper, keyed on the group identifier, so a
Marker stays resumable across groups created or deleted between requests. MaxRecords
defaults to 100 and is rejected outside the documented 20 to 100 range rather than
clamped, with the InvalidParameterValueException a live account answers. Marker is
emitted only while a further page remains: an SDK paginator treats any Marker as "ask
again", so one on the final page loops forever.

ReplicationSubnetGroupDescription now also enforces the model's printable-character
constraint, so a value carrying a control character such as 0x01 is rejected instead
of persisted.

* docs(dms): describe the Marker as the opaque cursor it is

* fix(test): DmsTest must compile at the sdk-test-java module's Java 17 target

List.getFirst() is a Java 21 SequencedCollection method. The main project
compiles at 21, but compatibility-tests/sdk-test-java pins source/target 17, and
DmsTest was the only file in that module using getFirst() -- so the native arm64
sdk-test-java image failed to build and every test in it was skipped.

This was not caught earlier because the previous head of this PR had no CI
rollup at all; the merge that made the branch mergeable is what first ran the
job. Replaced with get(0), which is what the rest of the module uses.

* style(test): import Objects and Collectors instead of naming them inline

AGENTS.md asks for imports rather than inline fully-qualified names.
DmsServiceTest had two: java.util.Objects::nonNull and
java.util.stream.Collectors.toMap. Neither was imported; both now are.
2026-09-21 19:45:01 -04:00
Vũ Thế Huy d227ef9195 feat(redshift): add ModifyClusterIamRoles, DescribeClusterVersions and DescribeOrderableClusterOptions (#3990)
ModifyClusterIamRoles adds and removes the IAM roles associated with a
cluster. The change is pushed to the running auth proxy, so COPY and
UNLOAD on new connections authorize against the updated role list.
Cluster IamRoles now report ApplyStatus in-sync.

DescribeClusterVersions and DescribeOrderableClusterOptions return static
data so IaC providers can validate node types before creating a cluster.
2026-09-21 11:32:09 -04:00
Priamo Germosen 8af15a71c4 fix(cloudformation): remove the login profile when deleting an IAM user (#3975)
Since login profiles became real state, DeleteUser returns DeleteConflict while one exists, so deleting a stack whose AWS::IAM::User was given a password out of band ended in DELETE_FAILED. The provisioner now deletes the login profile before the user, tolerating a user that has none. The resource-type table notes that the template LoginProfile and PermissionsBoundary properties are ignored.
2026-09-20 09:13:36 -05: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
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
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
Priamo Germosen 66bcdaf675 feat(codeartifact): add CodeArtifact control-plane support (#3713)
Floci had zero CodeArtifact support: no service package, no docs, nothing.
Any terraform apply touching aws_codeartifact_domain, aws_codeartifact_repository,
or either permissions-policy resource failed outright. This adds the full
CodeArtifact control plane: domain and repository CRUD, resource policies with
optimistic-locking revisions, tags, and the fixed set of real AWS-hosted
external (upstream) connections (public:npmjs, public:pypi, public:maven-central,
etc.).

Package publish/fetch endpoints per format (npm, PyPI, Maven, NuGet, generic)
are intentionally out of scope here: this closes the terraform apply gap, not
real package serving.

ListTagsForResource (POST /v1/tags?resourceArn=) is CodeArtifact's one tag
operation that addresses the resource with a query parameter on the bare path
rather than a path segment, unlike every other V1TagsController/SharedTagsController
handler. That method lives on V1TagsController itself rather than the shared
AbstractTagsController base: SharedTagsController (mounted at /tags) already
declares its own bare POST (tagResourceByBody, for TagResource), so a bare POST
on the shared base collides with it and Quarkus refuses to start. CodeArtifact's
handler is @V1Tags-qualified and only ever registered against V1TagsController,
so the method belongs there. core/common stays service-free: CodeArtifactTagHandler
registers itself as a bean the same way MskTagHandler does, and TagHandler gained
a default for the lowercase key/value entry names CodeArtifact uses instead of
AWS's usual capitalized Key/Value.

Known, documented limitations (see docs/services/codeartifact.md): no cycle
detection across upstream chains, no referential-integrity check when deleting
a repository other repositories reference as an upstream, and no authorization
check on cross-account domainOwner addressing (consistent with Floci's opt-in
IAM enforcement elsewhere).

Verified against the real botocore codeartifact service-2.json (protocol, exact
querystring vs. body placement per operation, exact ARN format, epoch-seconds
timestamps, real error shapes) and the live AWS API docs for behavioral rules
not in the wire model (DeleteDomain blocked while repositories exist, the real
fixed external-connection name/format list, PutDomainPermissionsPolicy's
all-body field placement vs. the sibling repository operation's querystring
placement).

Live-verified three ways:
- Unit tests including a concurrent-create race test proving the synchronized
  guard actually holds under contention, plus full-stack QuarkusTest/RestAssured
  integration tests.
- A real terraform init/apply/plan/destroy cycle against a running Floci
  instance, independently confirming destroy actually tore the domain down via
  a follow-up describe-domain call.
- A live AWS SDK v2 Java test exercising the real CodeartifactClient against a
  live instance.
2026-09-16 22:01:34 -04:00
Marcus Bergo e2aefa654b feat(sagemaker): add SageMaker emulation with Docker-backed training (#1949)
Implement the SageMaker control plane over the AWS JSON 1.1 protocol
(X-Amz-Target: SageMaker.*) plus the runtime invocation path:

- Models, endpoint configs, endpoints, training jobs, and tags with
  AWS-shaped validation errors (ValidationException / ResourceInUse)
- CreateTrainingJob runs the training image as a real Docker container
  using the /opt/ml contract: hyperparameters, resourceconfig and
  inputdataconfig under /opt/ml/input/config, S3 channel data under
  /opt/ml/input/data/<channel>, and /opt/ml/model uploaded back to S3
  as model.tar.gz under the configured S3OutputPath
- CreateEndpoint hosts the model image as a long-lived container with
  the serve command, /ping health checks, and ModelDataUrl artifacts
  extracted into /opt/ml/model
- POST /endpoints/{name}/invocations proxies to the container and maps
  model 5xx responses to ModelError (HTTP 424) like SageMaker Runtime
- Training container logs stream to CloudWatch Logs under
  /aws/sagemaker/TrainingJobs
- Storage wired through StorageFactory with memory/persistent modes,
  config in EmulatorConfig and both application.yml files
- Unit, integration, and Docker-gated integration tests plus a boto3
  compatibility test; service and docs registered in the catalog
2026-09-15 22:31:05 -05:00
Hector Ventura 265344e304 feat(docs): add a service inventory reconciler and fix what it found (#3656)
* feat(docs): add a service inventory reconciler and fix what it found

"How many AWS services does Floci support?" had no answer anyone could defend.
Every source in the repo gave a different number, and two of them were written
down and contradicted each other: docker/localstack-parity.sh said Floci starts
"all 41 services" while migrate-from-localstack.md said "all 58". Neither is
close: the catalog registers 124 descriptors today.

tools/docs/service_inventory.py reconciles the five keyspaces that each answer a
slightly different question, and explains every delta rather than picking a
number: catalog descriptors, the config plane (EmulatorConfig accessors against
application.yml keys), Java packages under services/, the docs pages, and the
service matrix. It reports 119 documented services, 127 distinct API surfaces and
124 signing endpoints, and says which to quote for which question. 27 tests cover
the normalisation and the delta arithmetic.

It also enforces the rule that made this necessary: never write a count into
README.md or docs/, link to the Service Matrix instead. So the two stale counts
are removed rather than corrected, and the parity script and migration guide now
say "every service".

Three services the README's category table omitted are added: Lambda MicroVMs,
Cognito Identity and Bedrock AgentCore Control, each backed by a descriptor or a
docs page.

Two service-matrix corrections the reconciler surfaced:

- The sso alias pointed at iam, so the matrix resolved Identity Center's admin
  API to the IAM page's facet. ResolvedServiceCatalog registers
  descriptor("sso", "ssoadmin", ...) and docs/services/ssoadmin.md is its own
  page, so the alias now points there.
- Both bedrock-agentcore deferrals are retired. bedrock-agentcore.md exists now,
  so that entry has served its purpose; bedrock-agentcore-control has no page and
  never needed one, because the control plane owns the shared page, so it becomes
  an alias instead of a deferral that would expire and need renewing. The
  deferred list is now empty.

check_service_matrix.py --strict passes before and after, so the matrix changes
are tidy-up rather than a fix for a failing gate.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* docs: add the STS README row the inventory tool still reported

The tool's own output at the previous head listed STS as the one service
with a Service Matrix row but no README category-table entry, the same
gap this branch closed for Lambda MicroVMs, Cognito Identity and Bedrock
AgentCore Control. Add it next to IAM, so section 5 of the report now
shows zero missing rows.

Also drop the unused pathlib import from the inventory test.

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-09-15 20:36:53 -05:00
Matheus André 2ee3aa67c0 feat(apigateway): support Gateway Responses on REST APIs (#3326) (#3585)
Add the PutGatewayResponse / GetGatewayResponse / GetGatewayResponses /
UpdateGatewayResponse / DeleteGatewayResponse family, keyed per REST API by
responseType across the 21 AWS types. Uncustomised types are reported with
defaultResponse=true, their AWS default statusCode and the default
{"message":$context.error.messageString} template; UpdateGatewayResponse
patches /statusCode, /responseParameters/<name> and
/responseTemplates/<content-type>, and DeleteGatewayResponse restores the
default.

ImportRestApi and PutRestApi read the x-amazon-apigateway-gateway-responses
extension, and AWS::ApiGateway::GatewayResponse is provisioned by a new
CloudFormation provisioner whose Ref / Fn::GetAtt Id is
<restApiId>-<responseType>.

On the execute plane every gateway-generated answer (unmatched path or
method, AWS_IAM and Lambda authorizer rejections, missing API key, request
validation, unsupported media type, integration configuration errors and
Lambda proxy failures) resolves the customisation for its type, then
DEFAULT_4XX / DEFAULT_5XX, and applies the configured statusCode, the
gatewayresponse.header.* parameters (static, method.request.*, context.*,
stageVariables.*) and the response templates, with $context.error.* exposed
to VTL. An expired SigV4 signature selects EXPIRED_TOKEN and a malformed or
mismatching one INVALID_SIGNATURE, as AWS keeps those two contracts apart.
This is what puts Access-Control-Allow-Origin on a browser-visible
401/403/400 so the frontend can read the real status instead of a CORS
failure. Without a customisation every answer is unchanged.

Closes #3326
2026-09-15 07:44:45 -04:00
Priamo Germosen 315dfe69f0 fix(rds): support tagging DB snapshots (#3649)
TagResource/UntagResource/ListTagsForResource rejected a snapshot ARN
outright ("not yet implemented by Floci"), and CreateDBSnapshot
silently dropped its Tags parameter even though DbSnapshot already had
a tags field. Both are now wired up: CreateDBSnapshot stores Tags, the
generic tag-resource dispatch resolves a "snapshot" ARN type against
the snapshot store, and DescribeDBSnapshots echoes DBSnapshotArn and
TagList like the other tagged resource types already do.

Snapshots are now region-scoped the same way DB instances and clusters
already are: CreateDBSnapshot/DescribeDBSnapshots/DescribeDBSnapshot-
Attributes/ModifyDBSnapshotAttribute/RestoreDBInstanceFromDBSnapshot
all thread the request's signed region through to snapshot storage and
lookup (via the same dbResourceKey/hasRdsResourceIdentity scoping the
instance/cluster stores use), so DBSnapshotArn reflects the request's
actual region and a snapshot created in one region is not visible to
Describe/Tag calls signed for another.

Verifying this live against a real floci instance via Terraform
surfaced two more gaps blocking any use of aws_db_snapshot at all,
regardless of tagging: DescribeDBSnapshotAttributes (called on every
read of the resource) and ModifyDBSnapshotAttribute were both
completely unimplemented. Added minimal support for both (the
"restore" attribute, i.e. cross-account copy/restore authorization,
modeled as plain in-memory state, no real cross-account sharing).

DeleteDBSnapshot is also unimplemented and was not added here — a
snapshot can be created and tagged but not destroyed via Terraform.
Noted in docs/services/rds.md as a follow-up, along with the other
resource types the original gap report mentioned (Aurora cluster
snapshots, reserved instances) that aren't modeled in Floci at all, so
tagging doesn't apply to them either.

Added a Terraform compatibility scenario (aws_db_snapshot with tags,
verifying create, tag read-back, a clean second plan, and an in-place
tag update) and ran it against a live floci instance before
committing, including a re-run after the region-scoping fix.
2026-09-15 07:34:42 -04:00
Vũ Thế Huy 7981e23dcd refactor(tagging): deduplicate tag-dispatch logic across tag controllers (#3594) (#3619)
* refactor(tagging): deduplicate tag-dispatch logic across tag controllers (#3594)

* fix(docs): support superclass REST method extraction in regen_action_docs

- Read inherited JAX-RS methods from superclass when a REST controller extends a base class
- Add test_extract_rest_inherits_methods_from_superclass test
2026-09-14 12:52:37 -04:00
Vũ Thế Huy e5bd8be405 feat(redshift): provision AWS::Redshift::Cluster through CloudFormation (#3427)
* feat(cloudformation): provision AWS::Redshift::Cluster (create path)

* feat(cloudformation): AWS::Redshift::Cluster update and replacement

* feat(cloudformation): force replacement on Redshift cluster createOnly property change

* feat(cloudformation): force replacement on Redshift cluster DBName change

* feat(cloudformation): provision Redshift parameter, subnet and security groups

* chore(cloudformation): register Redshift provisioner in inventory and docs

* test(cloudformation): end-to-end AWS::Redshift::Cluster stack

* docs(redshift): document CloudFormation cluster provisioning

* test(cloudformation): assert ClusterSubnetGroupNotFound error code on subnet group deletion

* fix(cloudformation): correct attribute handling for Redshift security group provisioning

* fix(cloudformation): apply Redshift parameter group Parameters and fix docs

ClusterParameterGroup silently dropped Properties.Parameters on both
create and update instead of calling ModifyClusterParameterGroup, and
did not replace the entity when Description or ParameterGroupFamily
changed, even though AWS marks both as replacement properties.

Also remove the Id GetAtt claim from the Cluster docs: neither the
provisioner nor AWS's own schema expose it for AWS::Redshift::Cluster.
2026-09-13 18:45:40 -05:00
Anders Wasen 55ada9b8a3 feat(cloudformation): provision the AppSync resource types (#3424)
Adds AppSyncCfnProvisioner, serving AWS::AppSync::GraphQLApi, GraphQLSchema, DataSource,
FunctionConfiguration, Resolver and ApiKey. Without it a template's AppSync resources fall
to the dispatcher's stub arm, which reports CREATE_COMPLETE while creating nothing and
resolves Fn::GetAtt to the literal "LogicalId.Attr".

Two things are not simple property mapping. The AppSync control plane is REST-JSON with
camelCase members, so every property is lower-camelised on the way in, with DynamoDBConfig
as the one member that does not follow the rule (it is dynamodbConfig). And schema creation
is asynchronous: while it is PROCESSING every other call for that API is refused with a 409,
so the GraphQLSchema resource waits for a terminal status before completing, as CloudFormation
does.

Also carries the service-layer changes the provisioner needs: a PIPELINE resolver reaches its
data through pipelineConfig and names no data source, which createResolver refused outright;
CreateFunction and UpdateFunction now keep the runtime a JS resolver declares; and
UpdateFunction applies a new name, which a CloudFormation rename goes through.
2026-09-13 18:45:32 -05:00
Franklin G. Mendoza a985773611 feat(bcm-pricing-calculator): emulate workload estimates (#3441)
* feat(bcm-pricing-calculator): emulate workload estimates

* fix(bcm-pricing-calculator): serialize timestamps as epoch seconds

* fix(bcm-pricing-calculator): align idempotency and errors
2026-09-12 11:31:20 -04:00
lex00andlex00 128d3ef181 feat(datasync): add the DataSync management plane (#3377)
* feat(datasync): add the DataSync management plane

Emulates the AWS DataSync management API over JSON (X-Amz-Target
FmrsService.<Action>, signing name datasync): agents, the eleven
CreateLocation/DescribeLocation/UpdateLocation trios plus the shared
ListLocations and DeleteLocation, tasks, and resource tagging.

Each DescribeLocation* projects the create request that produced the
location, so the configuration that went in is the configuration that comes
back, and LocationUri is derived from that request per the scheme AWS
documents for the type. DescribeAgent reports ONLINE and DescribeTask reports
AVAILABLE from the first read, which is what the Terraform provider's
aws_datasync_task waits on. Credential members (Password, SecretKey,
SasConfiguration, the Kerberos files and the nested Protocol.SMB.Password)
are dropped before the configuration is stored, as AWS never reads them back
either. Errors use InvalidRequestException, the only client error the
DataSync model declares.

The task-execution data plane (StartTaskExecution, DescribeTaskExecution,
ListTaskExecutions, CancelTaskExecution, UpdateTaskExecution) transfers real
bytes between real storage systems and keeps raising UnknownOperationException
rather than a stub success.

* fix(datasync): default VerifyMode from the task mode

The DataSync model documents two VerifyMode defaults, not one:
POINT_IN_TIME_CONSISTENT for a BASIC task and ONLY_FILES_TRANSFERRED for an
ENHANCED one, which also cannot use POINT_IN_TIME_CONSISTENT at all. CreateTask
applied the BASIC default to every task, so an ENHANCED task created without an
explicit VerifyMode read back wrong.

The default now follows TaskMode, and a VerifyMode the mode does not support is
rejected with InvalidRequestException, the only client error this API declares.
UpdateTaskRequest carries no TaskMode, so a task keeps the mode it was created
with and UpdateTask applies the same rule against the stored mode. An
unrecognized TaskMode is rejected rather than silently treated as BASIC.

* test(datasync): add the SDK compatibility test

Drives an agent, an S3 and an NFS location, both task modes and the tag round
trip through the AWS SDK v2 DataSync client, which is the one piece of real-SDK
verification the RestAssured tests do not cover. It asserts the VerifyMode
default for a BASIC and an ENHANCED task, and that an ENHANCED task rejects
POINT_IN_TIME_CONSISTENT on create and on update.

---------

Co-authored-by: lex00 <artigues.dev@gmail.com>
2026-09-11 22:30:02 -04:00
lex00 cae8f9a013 feat(bedrock): add guardrail lifecycle and versions (#3380)
* feat(bedrock): add guardrail lifecycle and versions

Amazon Bedrock control plane over REST JSON: CreateGuardrail through
DeleteGuardrail, CreateGuardrailVersion, ListGuardrails with pagination, and
resource tagging on /tagResource, /untagResource and /listTagsForResource.
Guardrails report READY on the first read, so the Terraform provider's status
poll for aws_bedrock_guardrail completes without a transition.

The control plane and bedrock-runtime both sign as "bedrock". The runtime
descriptor keeps that credential scope, and the new descriptor routes through
its resource class, which ServiceEnabledFilter checks first.

Policy blocks are stored under the read-shape member names, so a *Config
submitted on create or update reads back unsuffixed. ListGuardrails honours
maxResults and nextToken, and DeleteGuardrail rejects a guardrailVersion that
is not a GuardrailNumericalVersion.

* fix(bedrock): enforce guardrail length caps and resolve kmsKeyId to a key ARN

The AWS model caps description at 200 characters and both blockedInputMessaging
and blockedOutputsMessaging at 500, each with a minimum of 1. None of those were
checked, so an over-long value was stored and read back. name was already bounded
by its [0-9a-zA-Z-_]{1,50} pattern.

kmsKeyId on CreateGuardrail and UpdateGuardrail is a KmsKeyId: a key id, a key
ARN, an alias name or an alias ARN. kmsKeyArn on the read shapes is a KmsKeyArn,
which is only ever the full key ARN. The request value was echoed back verbatim,
so a bare key id or an alias produced a response that does not match the shape
GetGuardrail declares. It now resolves through KmsService.describeKey, the same
way RDS, DocDB and ElastiCache already resolve their KmsKeyId, and a key that is
missing, disabled or pending deletion is rejected with ValidationException.

* test(bedrock): drive the guardrail lifecycle from the AWS SDK v2 client

Adds the bedrock SDK module to the compatibility project, a BedrockClient
factory on TestFixtures, and a BedrockGuardrailTest covering create, read,
update, versioning, listing, tagging and delete. The test also submits kmsKeyId
as a bare key id and as an alias and asserts both read back as the same full KMS
key ARN.

* fix(bedrock): enforce the guardrail tag caps from the AWS model

The AWS model gives TagList a max of 200 items, and that shape backs the tags
member of both CreateGuardrail and TagResource. TooManyTagsException, declared
on both operations, documents a separate limit of 50 tags per resource counted
over the tags already on the resource together with the ones in the request.

parseTagList now rejects an array over 200 items with ValidationException, and
it moved to BedrockService so both entry points share it. CreateGuardrail and
TagResource raise TooManyTagsException once the total the guardrail would be
left holding passes 50, carrying resourceName as the model declares.
2026-09-11 20:36:45 -04:00