Commit Graph
1487 Commits
Author SHA1 Message Date
Alessandro Lattao 95bf6df474 feat(dsql): add Aurora DSQL's control plane and AWS::DSQL::Cluster (#6048)
* feat(dsql): add Aurora DSQL's control plane and AWS::DSQL::Cluster

The first half of #6014. Aurora DSQL's REST JSON control plane, with
the answers measured on AWS (eu-west-1): CreateCluster, GetCluster,
ListClusters, UpdateCluster, DeleteCluster, GetVpcEndpointServiceName,
the cluster policy calls and tagging on cluster ARNs. Identifiers are 26
characters of lowercase base32 as DSQL's are, and malformed or unknown
ones are refused with DSQL's messages; a cluster created without
deletionProtectionEnabled is protected, and deleting a protected one is
refused. CreateCluster answers CREATING and the cluster is ACTIVE right
after.

AWS::DSQL::Cluster waits for ACTIVE, returns the identifier from Ref
and Identifier, ResourceArn, Status, CreationTime, Endpoint, VpcEndpoint
and VpcEndpointServiceName through Fn::GetAtt, and a protected cluster
makes the stack's deletion fail, as on AWS.

A cluster has no database behind it here: its endpoint is named as on
AWS, <id>.dsql.<region>.localhost.floci.io, but not served. Serving it
is the second half of #6014, its own pull request.

* fix(dsql): answer the control plane's edge cases as DSQL does

Review of #6048, each answer measured on DSQL (eu-west-1) first:
- ListClusters carries on from a page token whose cluster was deleted
  in between, as AWS does: the token now holds the sort position of the
  next page's first cluster rather than its identifier.
- deletionProtectionEnabled is read as DSQL reads it: text is false
  when it spells false in any case and true otherwise; empty text, a
  number, an object and a list fail with SerializationException.
- The tag calls refuse another account's cluster ARN with 403
  AccessDeniedException instead of reading it in the caller's account.
- A client token reused with other parameters answers 409
  ConflictException; with the same ones, the earlier cluster.
- AWS_OWNED_KMS_KEY names AWS's own key on create and update.

AWS::DSQL::Cluster reads DeletionProtectionEnabled and PolicyDocument
with AWS::NoValue as left out, and an update that drops the
multi-Region properties clears them, as it already reset the key and
deletion protection. ListTagsForResource copies the tags under the
cluster's lock, and a cluster's lock goes with the cluster.

* fix(dsql): answer errors, policies, updates and multi-Region clusters as DSQL does

A review asked for the attribute coverage, the reason ValidationException
carries, a real untag assertion and tests of the stack-update path.
Measuring them on DSQL (eu-west-1, 2026-10-20) found more that did not
match, fixed here too.

- Attributes are written with resource.getAttributes().put, which the
  schema coverage test reads; EncryptionDetails, an object an output
  refuses on AWS, is recorded as a gap.
- DSQL leaves reason out of its model-validation errors. Only the page
  token's refusal carries it, with fieldList naming next-token and its
  own text. maxResults no longer quotes the value.
- Tag calls answer what DSQL answers: 403 for an ARN that is not a
  cluster ARN, 400 BadRequestException for another Region's, 404
  NotFoundException for no cluster. The 403s name the caller.
- Policy versions are epoch milliseconds, DeleteClusterPolicy answers
  the deleted version, and the missing-policy and stale-version errors
  carry DSQL's texts and resourceType.
- Policies are checked and kept as DSQL does: its three refusal texts,
  a service principal, a principal that names no one, a public grant,
  and the lockout check when both policy actions are denied to the
  caller, unless bypassPolicyLockoutSafetyCheck. The kept form is
  Jackson's pretty printer in DSQL's element order, with condition
  operators and keys in HashMap order, as measured.
- The public check shares its condition keys with Lambda web functions
  through PublicAccessConditions, and S3 now takes its fixed-value and
  SourceIp range tests from there. Sharing the whole rule was tried and
  dropped: DSQL was measured to treat some operators otherwise than
  LambdaWeb's and S3's rules do (ForAnyValue:, ArnLike "*",
  StringEquals "*"), so the operator rules stay per service. The
  lockout check is IamPolicyEvaluator's.
- A multi-Region cluster is PENDING_SETUP and lists itself until it and
  each peer name one another, then ACTIVE; its deletion answers
  PENDING_DELETE.
- AWS::DSQL::Cluster reads its properties through CfnPropertyTypes, so
  a PolicyDocument object or DeletionProtectionEnabled "yes" fails as
  on AWS, where Boolean.valueOf made "yes" false. An update leaves a
  property the template no longer sets as it was, deletion protection,
  KMS key and multi-Region alike, and removes only the tags and the
  policy; an earlier change put them back to their defaults, which was
  not measured and is not what CloudFormation does. A policy the
  template does not change keeps its version, and create settles on
  PENDING_SETUP too.

DsqlServiceTest, DsqlClusterPoliciesTest and DsqlCfnProvisionerTest
cover these in isolation, the integration tests over the wire.

* fix(dsql): keep the public access rule to DSQL and forget a deleted policy's version

A review asked to leave S3 and Lambda web functions out of this change,
and pointed at DSQL's own block public access page. The shared helper
is dropped and S3 and Lambda web functions are as on main; folding
their copies into one helper belongs to a separate change.

DSQL now has its own keys: the trusted ones its page lists, and
aws:SourceIp, aws:SourceVpcArn and the three aws:Vpce* keys, which the
page leaves out but DSQL accepts (measured, eu-west-1, 2026-10-20). As
the page says, a policy variable never restricts: StringEquals with
${aws:PrincipalArn}, ${aws:SourceVpc} or a role/${aws:username} ARN is
public on DSQL. ArnEquals reads like ArnLike, as IAM matches both the
same way, so a value that is no ARN, ${aws:SourceArn} among them,
matches nothing and restricts, as measured.

DeleteClusterPolicy left the deleted version on the cluster, so a put
naming it went through; it is now cleared, and a put that names a
version on a cluster with no policy is refused as not found.
2026-10-20 15:34:39 -04:00
Jimmy Liu Jia 67e4bfec1c fix(emr): terminate transient clusters after steps (#6085)
* fix(emr): terminate transient clusters after steps

* fix(emr): I preserve terminal state on later requests
2026-10-20 13:21:02 -04:00
TATSUNO “Taz” Yasuhiro 5aaa37284c feat(lambdaweb): refuse a long request head as AWS does (#6083)
A head past 128 KiB gets the AWS edge page 431 Platform.HeaderTooLarge before every other check. A URI of 65,535 bytes or more gets an empty 414.

The HTTP server now reads heads up to 256 KiB so the data plane can answer them. Every other host keeps the Quarkus defaults of 4096 bytes for the request line and 20 KiB for the headers.
2026-10-20 13:12:33 -04:00
Jackson Price a434e52892 fix(elbv2): refuse CreateLoadBalancer with neither Subnets nor SubnetMappings (#6087)
* test(elbv2): give the tests' subnetless load balancers subnets

CreateLoadBalancer takes Subnets or SubnetMappings for every load
balancer type, and AWS refuses a request with neither. Tests that
created a balancer with neither, to exercise listeners, the data plane,
CodeDeploy, API Gateway or CloudFormation, now give it two default
subnets: the src/test classes through Ec2Service.defaultSubnetId, the
Java compatibility suite through a new TestFixtures.defaultVpcSubnets.

setSubnetsAfterSubnetlessCreateCanAdoptCustomVpc becomes
setSubnetsInAnotherVpcIsRefused, since a balancer created with subnets
keeps its VPC. The adoption it covered still applies to a balancer an
earlier version saved without subnets, and ElbV2ServiceTest now covers
that.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(elbv2): refuse CreateLoadBalancer with neither Subnets nor SubnetMappings

A CreateLoadBalancer that named neither Subnets nor SubnetMappings made
a load balancer with no Availability Zone and no VPC, where the API
reference says every type takes one or the other. It now answers
ValidationError and creates nothing, with the message AWS gives for the
type: "At least two subnets in two different Availability Zones must be
specified" for an Application Load Balancer, "At least one subnet must
be specified" for a Network or Gateway Load Balancer. A CloudFormation
load balancer with neither fails its stack the same way.

The check runs after the duplicate-name check, because a stack update
finds the balancer it keeps through DuplicateLoadBalancerName whatever
subnets its template names. A balancer an earlier version saved without
subnets still works, and its first SetSubnets still gives it a VPC.

Follow-up to the review of #5881.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(elbv2): take a request's Subnets or SubnetMappings from ElbV2Service

The rule that Subnets and SubnetMappings are alternatives, and its
ValidationError, was written out three times: in the Query handler's
CreateLoadBalancer and SetSubnets, and in the CloudFormation
provisioner. ElbV2Service.requestedSubnets now holds it, and all three
take the request's subnets from there. Valid requests resolve the same
subnets as before, and both together are still refused with the same
error.

A new test pins the SetSubnets path, which had none.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(elbv2): say when CloudFormation refuses a load balancer without subnets

The behaviour note said a CloudFormation load balancer with neither
Subnets nor SubnetMappings fails its stack the same way as the API
does. That holds when the stack creates or replaces the balancer. An
update that keeps the balancer finds it by its taken name before the
subnet check, so it leaves the balancer on its subnets, as before.
The note now says so.

The requireSubnets Javadoc no longer presents the Gateway Load
Balancer message as AWS's own. No public record of it was found; it
is the Network Load Balancer one, since a Gateway Load Balancer takes
subnets the same way.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): give the remaining subnetless test requests subnets

Review follow-ups:
- The two duplicate-name tests, ElbV2IntegrationTest and the
  compatibility suite's ElbV2Test, sent a create with no subnets, so
  they passed only because the name is checked first. They now name
  subnets. The compatibility one also changes the scheme, because AWS
  answers a create that repeats a balancer's settings with success.
- ElbV2CfnProvisionerTest's successful creates and replacements now
  provision templates with two subnets and match them, rather than a
  subnetless create the real service refuses. The kept-balancer
  updates keep their subnetless templates.
- The CloudFormation case that leaves both properties out checks that
  its template really has no SubnetMappings, so a reformatted template
  cannot quietly turn it into the empty-list case.
- TestFixtures.defaultVpcSubnets() fails with a message when the
  region has no default VPC or fewer than two default subnets.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): say which subnet messages are AWS's in the test docs

Second-round review follow-ups, wording only:
- The ELBv2 unit and Query-protocol tests of a create with neither
  Subnets nor SubnetMappings now say the messages are the ones AWS
  gives an Application or a Network Load Balancer, and that a Gateway
  Load Balancer gets the Network one, as the service's Javadoc does.
- The provisioner test's onTwoSubnets builds its list from TWO_SUBNETS,
  the list its stubs match, and its Javadoc no longer reads as two
  subnets for every type.
- TestFixtures.defaultVpcSubnets() says an Application Load Balancer
  needs two zones, not every load balancer.
- The ELBv2 docs say a CloudFormation update moves a balancer when it
  names other subnets, since one that names none leaves it in place.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 13:08:31 -04:00
Vũ Thế Huy 484255871e feat(firehose): accept a Redshift destination on create, update and describe (#6004)
* feat(firehose): accept a Redshift destination on create, update and describe

Adds RedshiftDestinationConfiguration to CreateDeliveryStream and RedshiftDestinationUpdate to UpdateDestination, validated against the Firehose API model. DescribeDeliveryStream returns RedshiftDestinationDescription without Password. A batch is staged in the intermediate S3 location like an S3 destination; the COPY delivery follows in a separate change.

* fix(firehose): close review gaps in the Redshift destination API

Require BucketARN and RoleARN on the intermediate and backup S3 configurations, validate the Secrets Manager RoleARN, apply the paired buffering-hints rule to the backup location, recognise dollar-quote tags with digits or non-ASCII letters in CopyOptions, and take the update lock in DeleteDeliveryStream so a concurrent update cannot revive a deleted stream. Rejected requests are now asserted to leave the stream unchanged.

* fix(firehose): refuse any dollar sign outside a quoted CopyOptions literal

A dollar-quote tag can hold any non-ASCII character, including code points outside the basic plane that a Java character-class range does not cover, so a tag pattern could hide a second statement. CopyOptions never need dollar quoting, so the separator check now refuses a dollar sign outside a quoted literal instead of parsing the tag.

* docs(firehose): list every refused CopyOptions token in the docs and validation message
2026-10-20 13:05:31 -04:00
Mohith 645c97c803 fix(cognito): return USER_ID_FOR_SRP in the SOFTWARE_TOKEN_MFA challenge (#6086)
* fix(cognito): return USER_ID_FOR_SRP in the SOFTWARE_TOKEN_MFA challenge

The SOFTWARE_TOKEN_MFA challenge carried the canonical username under
USERNAME. AWS returns it as USER_ID_FOR_SRP, the key clients read to
build USERNAME and SECRET_HASH for the challenge response, so they could
not answer the challenge.

The challenge now carries USER_ID_FOR_SRP (the sub in a pool with
UsernameAttributes) and FRIENDLY_DEVICE_NAME when one was set, matching
the InitiateAuth API reference example. VerifySoftwareToken keeps the
FriendlyDeviceName on the user and replaces it with each newly verified
authenticator. Every flow that ends in SOFTWARE_TOKEN_MFA shares the
same builder, so password, admin password, SRP, USER_AUTH,
NEW_PASSWORD_REQUIRED and SELECT_MFA_TYPE all get the new parameters.
MFA_SETUP is unchanged.

Fixes #6074

* fix(cognito): reject an over-long FriendlyDeviceName in VerifySoftwareToken

VerifySoftwareToken stored a FriendlyDeviceName of any length and later
returned it in the SOFTWARE_TOKEN_MFA challenge. The service model caps
the member at 131072 characters, and AWS rejects a longer value during
request validation, before the code is checked.

A longer name now fails with InvalidParameterException and the Smithy
length-constraint message, before any session, token or code is looked
at, so the user's authenticator, pending association and remaining
attempts are left as they were. The length counts Unicode code points,
as Smithy's length trait does, so a name of supplementary characters
such as emoji is measured in characters rather than UTF-16 units. An
absent or empty name is unchanged.
2026-10-20 13:02:17 -04:00
Aniket Shukla 17f32c9d04 fix(ecs): retry FireLens configuration uploads (#6075)
* fix(ecs): retry FireLens configuration archive uploads

* test(ecs): cover FireLens upload failure boundaries

* perf(ecs): avoid streaming pipes for prebuilt FireLens archives

Reuse byte-backed archive retries without the 16 MiB pipe and writer thread per attempt. Preserve exact archive bytes and the shared retry policy. Warmed launch measurements dropped from 17.3 MB to 0.5-0.6 MB on the caller thread, with zero new writer threads. Add regression coverage for allocation path, consumed streams and failure boundaries.

* test(ecs): make FireLens retry regressions sleep-free

Add a package-private task-launch overload for the FireLens upload delay. The public entry point retains six attempts and the shared 500 ms initial backoff. Preserve real replay and cleanup assertions, and verify default, zero and nonzero delay selection. The expanded 32-case class runs in 0.54-0.68 seconds instead of 22.19 seconds.
2026-10-20 12:12:47 -04:00
Jackson Price d09b3215d5 fix(cloudformation): carry EC2 MetadataOptions from templates and instances (#6050)
* fix(cloudformation): carry EC2 MetadataOptions from templates and instances

AWS::EC2::LaunchTemplate dropped LaunchTemplateData.MetadataOptions,
and AWS::EC2::Instance read only the image, type and key from its
launch template and ignored its own MetadataOptions. A CDK instance with
requireImdsv2 therefore launched with HttpTokens=optional, and
DescribeInstances reported that whatever the template declared.

The template now stores the block, the instance launches with its own
options over its template's, and an update that changes them applies
them in place with ModifyInstanceMetadataOptions, as the property's
"No interruption" update behavior allows. A hop limit that is not an
integer fails the resource.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): check MetadataOptions first and reset dropped ones

An update that keeps an AWS::EC2::Instance applied its MetadataOptions
last, after resizing it and rewriting its security groups, user data
and profile, so a bad value failed the update with the instance half
changed while the stack reported a rollback. The options are now
checked with EC2's own rules before anything changes, which needs
Ec2Service.validateMetadataOptions to be public.

An update that stopped declaring an option, its own or through its
launch template (CDK's requireImdsv2 turned off), left the instance
with it. The provisioner now records what it declared and returns an
option it no longer declares to the launch default, as it already does
for an instance profile it stops declaring.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): replace an instance whose launch template changes

LaunchTemplate is a replacement property of AWS::EC2::Instance, and
Floci's change-set preview already says so, but an update kept the
instance whatever happened to it: removing the template (CDK's
requireImdsv2 turned off) reset the instance's options in place where
AWS launches a new instance. The provisioner now records which template
it declared and replaces the instance when the update names another
one, adds one or drops it. A new version of the same template is still
applied in place, because Floci's AWS::EC2::LaunchTemplate publishes a
version on every stack update.

The record of declared MetadataOptions now keeps only the member names,
which is all the reset needs, instead of a serialized model object.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): track template versions and roll records back

The previous commit left a new version of the same launch template in
place, on the grounds that the template's provisioner publishes a
version on every stack update. It publishes one only when the template
itself changes, so an instance naming Fn::GetAtt LatestVersionNumber
sees its LaunchTemplate change exactly when AWS replaces it. The
recorded spec now includes the version, and the change-set preview and
the update agree: another template or version, or none, replaces the
instance; one added to an instance launched without one keeps it, and
an instance launched without one now carries no record at all.

When a later resource failed a replacing update, the rollback restored
the prior instance but kept the attempt's __FlociDeclared records, so a
retry compared against the wrong declaration (a retried template drop
kept the instance requiring tokens). The records as they stood before
the replacement are saved and put back by rollbackUpdate, and cleared
when the update completes.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): keep an instance whose launch template changes

Replacing an instance on another launch template, version or none could
not be made to agree with the change-set preview: a Version given by
Fn::GetAtt LatestVersionNumber previews no replacement, and the template
publishes a new, identical version for a Metadata-only change. Keep the
instance in place, as upstream does, and reconcile what the template
declares; the docs state this as a deviation from AWS.

A rollback whose delete of the replacement throws has already named the
prior instance again, and a rollback that then skips the resource never
calls back, so put the prior instance's declared records back before
rethrowing. A saved copy that cannot be read now fails the rollback.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): keep a rollback's delete failure over a bad record

When the replacement's delete fails and the saved declarations cannot
be read, report the delete failure with the read failure suppressed,
rather than replacing it.

The docs and the provisioner comment said every launch template change
keeps the instance; an ImageId or KeyName the template supplies still
replaces it, and a change set still previews a literal LaunchTemplate
change as a replacement. Tests pin the replacement and a retried
rollback.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* chore(cloudformation): vendor EC2 instance and launch template property types

AWS::EC2::Instance and AWS::EC2::LaunchTemplate are to read their
MetadataOptions through CfnPropertyTypes, so the generator lists them
and checks the MetadataOptions members they rely on. Only their entries
are added to the vendored file: a fresh generation also carries new
AWS::ECS::TaskDefinition members AWS has published since, which belong
to their own sync.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): refuse EC2 MetadataOptions of the wrong type

AWS::EC2::Instance and AWS::EC2::LaunchTemplate read a MetadataOptions
member given as a list or an object, such as HttpTokens: [required], as
absent, so the instance launched with HttpTokens=optional; a block that
was not an object was dropped the same way. Read the block through
CfnPropertyTypes against the shape each resource schema declares, as
AWS::AutoScaling::LaunchConfiguration is: a block or member of the
wrong type now fails the resource with CloudFormation's template
validation error, and a hop limit that is not a whole number says what
it is ("found: Float") rather than a message Floci made up.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): let AWS::NoValue omit launch template metadata options

The launch template read its MetadataOptions from LaunchTemplateData
after resolving it, which turns AWS::NoValue into an empty string, so
since the previous commit a block or hop limit left out with Fn::If and
AWS::NoValue failed the template as the wrong type. Read the block as
the template writes it, with AWS::NoValue already left out, as the
instance does.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): drop the launch template's unreachable options fallback

When LaunchTemplateData is absent or an intrinsic call, its resolved
form has no MetadataOptions member either, so the fallback to it always
gave null. Say so and use null. A test row also covers a launch template
whose MetadataOptions is a string.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): put back metadata options a stack rollback undoes

An update that kept the instance and changed its MetadataOptions left
them changed when a later resource failed and the stack rolled back:
rollbackUpdate undid replacements only, so the instance kept options
the stack no longer declared, and the stack reported that the update
could not be rolled back.

The update now saves the options it replaces, with their region and the
instance's __FlociDeclared records, and changes them last, after the
tags, so nothing else in the step can fail after them. rollbackUpdate
puts both back. The rollback counts as done only when the update changed
nothing else on the instance; the instance type, groups, user data,
profile and tags still have no rollback, so the stack keeps saying so
for them, with the options put back all the same. Ec2Tags.reconcile now
reports whether it changed anything, so a tag change counts. A committed
or cleared update drops the saved copy.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): describe CloudFormation MetadataOptions and launch template updates

The EC2 notes now say that AWS::EC2::LaunchTemplate stores
MetadataOptions and AWS::EC2::Instance launches with its own over its
template's, what a wrong type and AWS::NoValue do, that an update
applies and resets options in place and a rollback puts them back, and
that a changed or dropped LaunchTemplate keeps the instance where AWS
replaces it, unless the ImageId or KeyName it supplies changed.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the tag change and order in an options rollback

A tag change in the same in-place update makes a rollback put the
MetadataOptions back but report the update undone, and a tag failure
leaves the options unchanged, since they are the update's last change.
The validation comment now lists tags among what runs before them.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): roll back declaration-only updates and refuse blank options

An update that kept the instance saved a rollback record only when it
changed the instance's MetadataOptions. One that changed only what was
declared, such as declaring a default the instance already had, left
rollbackUpdate nothing to restore, so a later resource's failure ended
the stack with "Rollback is not implemented". Every update that keeps
the instance now saves its __FlociDeclared records, with the prior
options only when it changes them, and a rollback restores what was
saved and counts as done when nothing else on the instance changed.

A MetadataOptions member given as an empty or padded string read as
absent, so HttpTokens: "" launched with the default. The text is now
kept as written and EC2's checks refuse it, as EC2 does; AWS::NoValue
still leaves a member out.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* chore(cloudformation): sync the vendored property types with AWS

The vendored file lacked the AWS::ECS::TaskDefinition SharingStrategy
and NvidiaMpsAllocation members AWS has published since it was last
generated, so the drift check, which runs when a change touches the
file, failed. This is make cfn-property-types-sync, and the file now
matches AWS's schemas.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): cover tag-only and declaration-only rollbacks

A rolled-back update that changed only tags puts the declarations back
and reports that it could not undo the update, without touching the
options. A stack whose update only declares the default HttpTokens the
instance already has ends UPDATE_ROLLBACK_COMPLETE when a later
resource fails, and a string member left out with Fn::If and
AWS::NoValue keeps its default. The ec2 notes say that a blank member
is refused and that an update that changed no EC2 setting rolls back in
full, which covers any property Floci does not apply, not only
MetadataOptions. A stale test name and comment are corrected.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* revert(cloudformation): leave AWS's ECS schema change to its own sync

The drift check fails on main as well: AWS has added SharingStrategy and
NvidiaMpsAllocation to AWS::ECS::TaskDefinition since main vendored the
file, and a fresh generation from main's own tree shows the same three
ECS shapes. The AWS::EC2::Instance and AWS::EC2::LaunchTemplate entries
this PR vendors already match AWS. The resync is an unrelated change, so
the vendored file goes back to this PR's EC2-only addition; the check
stays red until main syncs.

This reverts commit 092eb432f.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say a launch template stores a blank metadata option unchecked

The ec2 notes said a blank MetadataOptions member is refused, in a
sentence about both resources, but AWS::EC2::LaunchTemplate stores it
unchecked, as CreateLaunchTemplate does, and only the instances launched
from it fail. The declaration-only rollback test also says that its
stack status, not the options, is what it checks.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* chore(cloudformation): sync the vendored ECS task definition types with AWS

The vendored property types check has to pass before this change can
merge, and AWS::ECS::TaskDefinition's SharingStrategy and
NvidiaMpsAllocation members are the only drift left: the
AWS::EC2::Instance and AWS::EC2::LaunchTemplate types this change adds
already match AWS. This brings back the sync from 092eb432f, which
51dca7d0f had left out of this change.

This reverts commit 51dca7d0f.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 11:55:39 -04:00
Jimmy Liu Jia e14e5433ab fix(emr-serverless): isolate applications by request region (#6078) 2026-10-20 11:50:02 -04:00
jwoa95 d1a2708634 fix(cognito): keep the sign-in's auth_time across managed login sessions and refresh (#5157)
The tokens an authorization code redeems for were stamped with the time of
the redemption, so an authorize that a managed login session let skip the
form reported a fresh sign-in, and so did every refresh of those tokens.

The managed login session now records when the user signed in, the
authorization code carries that time (or the identity provider callback's
for federated sign-in), and the token endpoint mints with it. Refresh tokens
carry it too, so REFRESH_TOKEN_AUTH, GetTokensFromRefreshToken and the token
endpoint's refresh_token grant keep the original auth_time, as AWS
documents: "Refreshing a token doesn't reset the auth_time claim."

The sign-in time is a tagged auth_time= field after the family id, ahead of
the scope field. Refresh tokens minted before keep working and fall back to
the time they were issued.

A pre token generation trigger can no longer suppress or override auth_time,
which AWS lists among the claims a trigger cannot add, modify or suppress.
2026-10-20 11:48:02 -04:00
Allen Sanborn 0ebcf84653 fix(config): store PutConfigRule tags and drop them on DeleteConfigRule (#6080)
* fix(config): store PutConfigRule tags and drop them on DeleteConfigRule

PutConfigRule accepted a top-level Tags list but never stored it, so
ListTagsForResource on the new rule's ARN returned an empty list and a
tagged aws_config_config_rule drifted on every plan. DeleteConfigRule
also left any tags behind under the removed rule's ARN.

Tags are now applied when PutConfigRule creates the rule, and ignored
when it updates an existing one, as the PutConfigRule model documents
("Tags are added at creation and cannot be updated with this
operation"). The get-then-put now runs under the lock DeleteConfigRule
takes, and DeleteConfigRule removes the rule's tags inside that lock,
matching conformance packs and aggregation authorizations.

* fix(config): validate creation tags and write them before the rule

PutConfigRule and PutAggregationAuthorization now check their TagsList
against the config/2014-11-12 model (at most 50 tags, Key 1-128
characters, optional Value of at most 256) and reject with the modelled
InvalidParameterValueException before anything is stored. A tag with no
Value stays accepted, as the model makes Value optional.

PutConfigRule writes the creation tags before the rule. Tags are applied
only when the Put creates the rule, so a rule stored ahead of a failed
tag write could never get its tags back from a retry; now the failed
write leaves no rule and the retry creates both.
2026-10-20 11:43:26 -04:00
Andre Kurait a899318862 feat(stepfunctions): invoke regional API Gateway tasks with IAM (#6043)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 10:17:47 -04:00
David 1f96bf42f1 feat(ecr): registry policy, replication and scanning configuration (#5817)
* feat(ecr): registry policy, replication and scanning configuration

PutRegistryPolicy, GetRegistryPolicy, DeleteRegistryPolicy, PutReplicationConfiguration,
DescribeRegistry, PutRegistryScanningConfiguration and GetRegistryScanningConfiguration store
the registry's own settings per account and Region and return them as written. Floci does not
replicate or scan images or evaluate the policy, as with repository policies.

- The policy must be a JSON object; a missing one is RegistryPolicyNotFoundException.
- Replication destinations, filters and rule counts are checked against the service model, and
  an empty rules list clears the configuration.
- Scanning defaults to BASIC with no rules, and CONTINUOUS_SCAN is refused with BASIC.

Closes #5803

* fix(ecr): put the registry setting writes under one lock

PutRegistryPolicy, DeleteRegistryPolicy, PutReplicationConfiguration and
PutRegistryScanningConfiguration read the registry's one settings record, change a
field and write it back. Terraform applies the three resources in parallel, so two
writers could start from the same record and the later write dropped the other's
setting. The read, change and write now happen under a lock per account and Region.

* refactor(ecr): check registry setting requests against the vendored model

The Resource Groups request walker moves to core.common as RequestConstraintCheck, so
a service can check a JSON request against botocore's constraints: member types,
required members, lengths and counts, number ranges, patterns and enums, each
answered in the service's own words. Resource Groups keeps its BadRequestException
messages.

- tools/aws/request_shapes.py gains build_constraints, which
  regen_resource_groups_shapes.py now calls; its vendored file is unchanged.
- tools/aws/regen_ecr_shapes.py vendors ecr-request-shapes.json for the seven
  registry setting actions, and aws-data-sync and aws-data-check run it.
- EcrJsonHandler checks those requests first, answering InvalidParameterException in
  ECR's form. The hand-written checks the model states are gone; a policy that is
  not a JSON object and CONTINUOUS_SCAN with BASIC stay, as the model cannot say
  them.
2026-10-20 10:03:30 -04:00
David Phillips c4a2c0a4f6 docs(ec2): clarify opt-in vCPU quota checks (#6076) 2026-10-20 09:59:40 -04:00
Jackson Price 9f9c16a181 fix(ec2): honor IncludePublicKey when describing key pairs (#6055)
* fix(ec2): honor IncludePublicKey when describing key pairs

DescribeKeyPairs ignored IncludePublicKey. With IncludePublicKey=true each
key pair now carries its OpenSSH public key, with the key-pair name as the
comment in place of any comment an imported key had; omitted or false
leaves it out. Imported material that is not a whole OpenSSH key, such as
PEM or RFC 4716 text, a blob missing a field its type needs, a line that
names another type than its blob, or a key type other than RSA, ED25519,
ECDSA and their security-key forms, is kept as given and described without
a public key. SshPublicKeys.carriesAKey checks the fields each type needs.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): describe a key pair's key only when it is exactly one key

DescribeKeyPairs with IncludePublicKey=true still described a blob with
bytes after its key, which OpenSSH and Go's ssh package refuse, and the
first of several key lines, although an instance launched with the key
pair trusts every line. Both are now described without a public key. A
key pair stored before KeyName was required gets no comment instead of
"null". carriesAKey reads the RSA fields once through the reader.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): leave a key-pair name that cannot be a comment off the key

ImportKeyPair accepts a key-pair name with a line break, and as the comment
of the described key such a name split it into lines that authorized_keys
reads as further keys. A name holding a control character is now left
off. carriesAKey names each ECDSA curve's coordinate size and reads a
security key's application field directly, and its docs say it checks
the format only.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): name the key types and formats a described key pair needs

The Key Pairs section now names DER beside PEM and RFC 4716, and the two
security-key types OpenSSH has, instead of a security-key form for every
type. The SshPublicKeys class comment covers the whole-key check, and a
test comment no longer says a tab would split the described key.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): list the described key types by their wire names

The Key Pairs section lists the key types a key pair is described with by
their OpenSSH names, which reads one way only, and the SshPublicKeys
comments name the two security-key types instead of implying a
security-key form for every key type.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 09:54:54 -04:00
David Phillips 689201122f fix(ec2): add opt-in Standard On-Demand vCPU admission (#6058)
* feat(ec2): enforce Standard On-Demand vCPU limits

Keep EC2 launches and restarts within regional account limits.

* fix(ec2): preserve quota lifecycle and launch semantics

Keep Spot launches independent and pending restarts recoverable.
Report incomplete CloudFormation restoration accurately.

* fix(ec2): make vCPU admission opt-in and running-only
2026-10-20 08:38:21 -04:00
TATSUNO “Taz” Yasuhiro 8bff1ba0f3 feat(cloudfront): sign requests to a Lambda Web Function origin under OAC (#6037)
* feat(cloudfront): sign requests to a Lambda Web Function origin under OAC

CreateOriginAccessControl now takes always-amz-auth for the lambda origin
type and sigv4a for s3 and lambda, with the AWS validation messages.
Distributions check the origin access control of a Lambda origin as AWS
does, and refuse a Lambda@Edge origin trigger in front of an origin signed
with always-amz-auth or sigv4a.

Under always-amz-auth, CloudFront signs its requests to a Web Function
endpoint of this Floci for the distribution. An IamAuth endpoint lets them
through, or under IAM enforcement evaluates the function policy for
cloudfront.amazonaws.com with aws:SourceArn and aws:SourceAccount.

* fix(cloudfront): refuse unknown and in-use OAC changes as AWS does

A distribution naming an origin access control that does not exist is
InvalidOriginAccessControl. A control an origin uses can no longer change
its origin type, its signing protocol, or whether it is always-amz-auth,
which AWS answers with IllegalUpdate.

* fix(cloudfront): match a Lambda origin by the end of its hostname

CloudFront takes a Lambda origin only from a hostname under on.aws, and it matches the fixed labels case sensitively. Floci also takes one under its own host.

The CloudFront check and the caller check now share the endpoint condition keys. The docs say when CloudFront forwards the viewer Authorization.

* fix(cloudfront): read the Floci host for Lambda origins from the authority

URI.getHost is null for a host with an underscore, such as a Compose service name, which broke CloudFront at startup. The Web Function endpoints are named from the authority, so the match reads it the same way.
2026-10-20 08:26:11 -04:00
Aniket Shukla 1a598b7f0c fix(rds): retry grant and snapshot archive uploads (#6069)
* fix(rds): retry master grant archive uploads

* fix(rds): retry snapshot restore archive uploads
2026-10-20 08:25:52 -04:00
David Phillips 08d5a9c742 fix(rds): retain requested storage types (#6057)
* fix(rds): retain requested storage types

Keep database storage settings across updates, copies and restarts.

* fix(rds): retain Provisioned IOPS storage types
2026-10-20 08:22:19 -04:00
Jimmy Liu Jia ae53c4b352 fix(emr): preserve request-level step execution role (#6061)
* fix(emr): preserve request-level step execution role

* test(emr): keep integration test order unique

* fix(emr): align step roles with AWS response shapes
2026-10-20 08:15:09 -04:00
David c6551a47bc feat(ecr): PutImage and the layer API (#5784)
* feat(ecr): PutImage and the layer API

PutImage, BatchCheckLayerAvailability, GetDownloadUrlForLayer, InitiateLayerUpload,
UploadLayerPart and CompleteLayerUpload now go through the registry:2 container that
docker push already writes to, so an image written through the API is the image
docker pull and BatchGetImage return.

- PutImage writes the manifest under its tag, or under its digest. It answers
  ImageDigestDoesNotMatchException, ImageAlreadyExistsException,
  ImageTagAlreadyExistsException and LayersNotFoundException as the model lists them.
- Layer uploads map onto registry upload sessions, held in memory. Parts must follow
  each other, be at most 20 MiB, and all but the last at least 5 MiB.
- GetDownloadUrlForLayer returns the blob's address on Floci's registry endpoint.
- The immutable-tag guard moves into EcrService, so a docker push and a PutImage of
  one tag cannot both succeed.

Closes #5735

* fix(ecr): refuse mixed layer digests, keep push time on retag, expire idle uploads

CompleteLayerUpload refuses a second, different layer digest instead of
ignoring it. PutImage keeps an image's first push time when it retags it.
A layer upload idle for a day is refused even when no other upload opens,
and dropping one cancels its registry upload session.

* fix(ecr): check PutImage tags, require a manifest media type, share registry error handling

- PutImage checks imageTag against the OCI tag grammar and answers
  InvalidParameterException otherwise. The tag goes into the registry's manifest URL,
  so v1?x wrote v1 and a slash wrote into another repository.
- A manifest with no mediaType needs imageManifestMediaType, as on AWS, instead of
  Floci guessing one from the manifest's shape.
- PutImage and the layer API reach the registry through one helper, callRegistry,
  in place of five copies of the same failure handling.

* fix(ecr): answer ECR's own message for a tag outside its rule

PutImage refuses a tag outside ECR's rule, [a-zA-Z0-9-_.]+ up to 300 characters,
with ECR's message. A tag ECR takes but the backing registry cannot hold, one
starting with '.' or '-' or longer than 128 characters, is refused with a message
naming that limit, which docs/services/ecr.md now notes.
2026-10-20 07:29:43 -04:00
Aymen JAMAAOUI d0dac9814f fix(redshift): check the extra IAM actions GetClusterCredentials needs (#6067) 2026-10-20 07:29:25 -04:00
Aniket Shukla fa4bacd0d1 fix(timestream-influxdb): retry restore archive uploads (#6064)
Reopen each backup tar for transient Docker upload retries without wrapping or buffering it. Keep restore commands outside the retry boundary and preserve cleanup on failure.

Refs #5096.
2026-10-20 07:27:05 -04:00
TATSUNO “Taz” Yasuhiro 9b59b8997e feat(dynamodb): add on-demand backups (#6052)
* feat(dynamodb): add on-demand backups

Add CreateBackup, DescribeBackup, ListBackups, DeleteBackup and
RestoreTableFromBackup. A backup keeps a copy of the table settings and
items from the time of the call, and it outlives the table.

The restored table keeps the keys, indexes, billing mode, throughput and
encryption. It drops the stream, TTL, point-in-time recovery, tags,
deletion protection and table class, as on AWS. A GSI or LSI override
must match a source index by key schema and projection, and a vector
index override must match one by name. Error wording and check order
follow AWS.

A restore finishes before the response is sent. The response still says
CREATING with RestoreInProgress true, as on AWS.

Part of #4521.

* feat(dynamodb): check the throughput members of a restore override

* test(dynamodb): tolerate only missing resources in the backup test cleanup

* feat(dynamodb): follow the AWS rules for on-demand restore overrides
2026-10-20 07:18:23 -04:00
Aniket Shukla 35ddd5c59d fix(redshift): retry snapshot and catalog uploads (#6065)
Rebuild host-resource uploads and catalog tar streams for transient Docker I/O retries. Keep SQL outside the retry boundary and preserve snapshot failure and optional bootstrap behavior.

Refs #5096.
2026-10-20 07:14:28 -04:00
Jackson Price 9f99c7c2c2 fix(ec2): report image creation provenance and its three filters (#6059)
* fix(ec2): report image creation provenance and its three filters

DescribeImages never returned SourceImageId, SourceImageRegion or
SourceInstanceId, and the source-image-id, source-image-region and
source-instance-id filters matched every image.

- A CreateImage AMI reports the instance it captured, and the AMI that
  instance was launched from with its region.
- A CopyImage AMI reports the AMI it copied and its SourceRegion, and no
  instance.
- Both name the source by its AMI id, also when the request used a
  catalog alias, and keep naming it after the source is deregistered.
- Registered and catalog AMIs report none. The filters match only
  images that carry the field, so the image DescribeImages makes up for
  a CDK lookup or an unknown launchable id no longer passes them.

The fields are stored apart from the flattened ancestor Floci launches
from, so a copy of a copy names its immediate source and still boots
the right base image. Images saved before this change load without
provenance.

Split out of #5663 at review.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): accept a catalog alias in the source-image-id filter

An instance launched by a catalog alias such as ami-amazonlinux2 keeps
the alias as its ImageId, while the AMI captured from it records the
AMI id the alias names. Filtering on the instance's ImageId therefore
found nothing, where on AWS the two are always the same id.
source-image-id now matches the recorded id or any alias of it, as
image-id already does for catalog images.

Review follow-ups in the same area:
- a test pins the catalog branch of source-image-region, and the
  restart test names the flattened ancestor it expects;
- the detached-storage test double copies the provenance fields;
- the provenance test cleans up each resource independently, and the
  compatibility test deletes the copy's snapshot;
- the AMI docs list CopyImage and DeregisterImage and say the filter
  takes an alias.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): pin wildcard alias matching in source-image-id

The provenance test now checks that a wildcard on a catalog alias finds
a capture, as it does for image-id, and reads the source-image-region
result once. The DeregisterImage row in the AMI docs says a snapshot
another AMI still uses is kept even with DeleteAssociatedSnapshots.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 07:12:21 -04:00
Alessandro Lattaoandoutof-place 47f570a821 feat(cognito): hand email codes to the CustomEmailSender trigger (#6031)
* feat(cognito): hand email codes to the CustomEmailSender trigger

* test(cognito): decrypt CustomEmailSender codes with the AWS Encryption SDK

* docs(cognito): document the CustomEmailSender trigger

* fix(cognito): fail a CustomEmailSender delivery as Cognito does

Measured on Cognito (eu-west-1, 2026-10-16), with the events a real sender
received:
- CreateUserPool and UpdateUserPool refuse a custom sender trigger without
  a KMSKeyID ("KMSKeyId parameter is required when Custom SMS/Email Lambda
  trigger is used."), and CreateUserPool a key that does not exist
  ("Encountered error when CreateGrant was attempted on the input KMS key -
  Key '<id>' does not exist"), both InvalidParameterException.
- A disabled key fails the request with CodeDeliveryFailureException
  "Caller needs to enable the configured KMS Key", a key pending deletion
  with "Unable to encrypt CustomEmailSender/CustomSMSSender code using the
  configured KMS Key". The sign-up is kept, unlike a failed SES delivery,
  and InitiateAuth answers the same error rather than InternalErrorException.
- A function that is gone, or that Cognito may not invoke, answers
  UnexpectedLambdaException "CustomEmailSender invocation failed due to
  error AccessDeniedException."
- request.clientMetadata is null for every source, InitiateAuth's
  ClientMetadata included, so the parameter that carried it is gone.

The branch also follows main since it was written: CognitoService takes
enforceTokenValidityLimits, and signUp ValidationData and ClientMetadata.

* fix(cognito): withdraw a code the CustomEmailSender could not take

Review of #6031: when the handover failed, the code issued for it stayed
live in SignUp, ForgotPassword and both attribute flows, so asking for a
code again within 30 seconds answered LimitExceededException. Measured
on Cognito (eu-west-1): it hands out a code again at once, on a healthy
pool and once a key that could not encrypt is enabled again, for
ResendConfirmationCode and ForgotPassword alike.

sendThroughCustomEmailSender now withdraws the code before it fails, for
every flow, and the two catches that withdrew it by hand (resend and the
sign-in OTP) leave that to it.

* fix(cognito): hand the CustomEmailSender the request's ClientMetadata

Review of #6031: the developer guide lists ClientMetadata for the
sign-up, forgot-password and sign-in sources, and the branch passed null
for every one on the strength of InitiateAuth alone. Measured on Cognito
(eu-west-1): SignUp, ResendConfirmationCode, ForgotPassword,
GetUserAttributeVerificationCode and UpdateUserAttributes each hand the
function the request's ClientMetadata; only the sign-in code's event has
none, even when InitiateAuth sends one. A request without ClientMetadata
gives null, as measured before.

ResendConfirmationCode, ForgotPassword and the two attribute calls now
take the request's ClientMetadata through the service, with overloads
that keep their previous signatures. resolveTriggerArn's custom sender
branch gets its braces.

---------

Co-authored-by: outof-place <contact@outofplace.space>
2026-10-20 06:44:20 -04:00
Andre Kurait 0e6db1f2b3 fix(route53): serve stored public TXT and delegation records (#6034)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 00:05:29 -04:00
Andre Kurait be2cb677d0 feat(resourcegroups): support EC2 capacity reservation pools (#6011)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 00:04:50 -04:00
lex00 691499d335 feat(sqs): opt-in AWS QueueUrl form via endpoint strategy (#5517)
* feat(sqs): opt-in AWS QueueUrl form via endpoint strategy

FLOCI_SERVICES_SQS_ENDPOINT_STRATEGY=standard returns queue URLs in the AWS
form, https://sqs.<region>.<dnsSuffix>/<account>/<name>. The default, path,
keeps the current form. Every input form resolves under either setting.

* fix(sqs): endpoint strategy accepts path or standard

* refactor(sqs): queue URL forms are floci and aws, with shared round-trip tests

* test(sqs): strategy names in tests and config comments read floci and aws

* docs(sqs): list endpoint-strategy on the application.yml page

The yml block and the env var table both list the setting, and the base-url comment names the aws strategy.
2026-10-19 23:51:18 -04:00
Allen Sanborn 88b0522168 fix(config): answer ResourceNotFoundException for tags on a missing resource (#6047)
TagResource, UntagResource and ListTagsForResource were plain map
operations keyed by ARN. Tagging a deleted conformance pack's ARN
returned 200 and re-created an orphan tag entry, and listing it
returned an empty list. The Config model lists ResourceNotFoundException
for all three operations.

For the kinds Floci stores (config rules, conformance packs, aggregation
authorizations) the ARN must now match an existing resource in the
caller's account and request Region, so a deleted resource, or an ARN
from another account, Region or partition, is not found. The check and
the write run under the lock the resource's delete takes, so a delete
cannot land between them and leave tags for a resource that is gone.
ARNs of kinds Floci does not model are still accepted unchecked.
2026-10-19 23:42:17 -04:00
David Phillips 0da0c80824 feat(elbv2): terminate HTTPS with ACM and IAM certificates (#5959)
* feat(elbv2): serve HTTPS listeners with ACM and IAM certificates

Route HTTPS traffic with SNI and refresh certificates when they change.

* fix(elbv2): preserve attached ACM certificates

Refuse revocation while a listener uses the certificate and keep
certificate listings responsive when many listeners are configured.
2026-10-19 23:40:17 -04:00
Hector Ventura 73da37b90e fix(ec2): reject tag writes on missing, malformed or absent resources (#5996)
* fix(ec2): reject tag writes on missing, malformed or absent resources

CreateTags and DeleteTags stored tags for any id. Both now answer
MissingParameter when no resource is named and InvalidID for an id that is
not a known EC2 prefix followed by hex digits. CreateTags also checks each
resource exists in the request region and answers with that type's own
NotFound error, as moto does; a well-formed id of a type Floci does not
model is still tagged.

CreateTags enforces the documented limits: at most 50 user tags per
resource (aws: tags do not count) with TagLimitExceeded, and keys up to 128
and values up to 256 Unicode characters with InvalidParameterValue. Every
resource and limit is checked before any tag is written.

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

* fix(ec2): match tag targets in full and resolve them by their prefix

A tag target id is now matched in full with an 8 or 17 hex suffix, and an id Floci seeds without hex digits (a default VPC resource, a catalog AMI alias) passes only when the region holds it. The resource type comes from the matched prefix, so eni-attach-, vpce-svc- and the cidr-assoc ids reach the unmodelled arm, and an AMI is checked against the catalog and the region's registered images instead of DescribeImages, which answers an unknown id with a launchable fallback.

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

* fix(ec2): accept fleet and IPAM tag targets and check the tag limit under the write's locks

EC2 Fleet and Spot Fleet request ids are UUIDs and an IPAM pool allocation id has 33 hex digits, so a tag target id now takes 8 or more hex digits or a UUID, and the ipam, ipam-scope, ipam-pool and ipam-pool-alloc prefixes are known. The 50-tag check ran before the write took its resource locks, so concurrent CreateTags requests at 49 tags could all pass it; the check and the write now run holding every named resource's lock, taken in stripe order after the topology lock.

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-19 23:39:29 -04:00
Jackson Price 7504d71e76 fix(ec2): require IMDSv2 tokens when HttpTokens is required (#5966)
* fix(ec2): probe IMDS proxy readiness with an IMDSv2 token

The proxy start script checked readiness with a tokenless read of the
instance ID. Once IMDS enforces HttpTokens=required, that read gets 401
and the proxy reports a failed start after twelve attempts. The probe
now fetches a 60-second token and reads with it; a refused or empty
token fails the attempt rather than falling back to a tokenless read.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse tokenless metadata reads when HttpTokens is required

IMDS answered every request without a token through IMDSv1, whatever
the instance's HttpTokens said. On AWS, when token usage is required,
requests without a valid token get 401 Unauthorized. Floci now does the
same for every metadata endpoint, before it looks up the data, using
the options the instance was launched with or last modified to.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): clear application library paths in IMDS helper shells

docker exec gives the proxy's install and start shells the image's
environment. An application image that sets LD_LIBRARY_PATH, PYTHONPATH
or PYTHONHOME can then make the package manager, socat and curl load
its libraries or Python instead of the system's. Both shells now unset
those three first; only the helper shell changes, so the container's
configuration and the application's processes keep them.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse metadata option changes on EKS cluster nodes

IMDS serves a cluster node from the instance its EKS cluster registered,
while EC2 hands out a copy of it. ModifyInstanceMetadataOptions changed
and stored that copy, so DescribeInstances reported HttpTokens=required
while the node's IMDS kept answering tokenless reads, and the stored
copy no longer counted as a cluster node. The action now answers
OperationNotPermitted for cluster nodes, as their stop, start, reboot
and terminate actions do.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): publish metadata option changes to the IMDS event loop

IMDS now reads an instance's metadata options on its Vert.x event loop,
while ModifyInstanceMetadataOptions replaces them from a request thread.
Without a happens-before edge the event loop could keep serving the old
options, or see the new object before its fields. The field is now
volatile, as the instance's state already is.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep the IMDS readiness probe off HTTP proxies

The probe's curl calls honored an image's http_proxy or ALL_PROXY, so a
proxy configured for the application received the link-local requests,
every attempt failed and the start reported a failure although socat
was running. Both calls now pass --noproxy '*'.

The helper-shell test support moves to a shared HelperShellFixture, and
a new test runs the real token probe inside the generated start script,
whose set -eu loop must retry after a refused token.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): clear application library paths in the sshd install probe

The sshd install probe runs dnf, yum or apt-get through docker exec with
the image's environment, the failure the IMDS helper shells now avoid:
with an application's PYTHONHOME or LD_LIBRARY_PATH, dnf could not
start, so sshd was never installed. The probe now unsets the same three
variables first, through the IMDS proxy's shared constant.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep refusing cluster nodes once EC2 has stored a copy

The cluster-node check counted an instance as a node only while EC2's
own store had no record of it, but ModifyInstanceAttribute, monitoring
and other actions store EC2's copy of a node. After one of them,
ModifyInstanceMetadataOptions was accepted without reaching the node's
IMDS, and TerminateInstances and StopInstances were no longer refused.
A node is now recognized by its cluster's provider alone.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep the pod identity relay probe off HTTP proxies

The EKS pod identity relay's readiness probe shares the IMDS proxy's
start script and environment, but its curl still honored the image's
http_proxy: a proxy that answered passed the probe whether or not socat
relayed, and an unreachable one failed the start. It now passes
--noproxy '*' like the IMDS probe, from a podIdentityProbeCommand the
test runs. The shared unset's Javadoc now names the shells that run it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse tokenless reads of every path when tokens are required

The HttpTokens=required check ran inside the handlers of the paths IMDS
serves, so a tokenless read of any other path, such as the
/latest/meta-data/ listing that IMDSv1 detection probes, answered 404
where AWS answers 401. The check now runs ahead of every GET route;
with a token, or on an instance that allows IMDSv1, such a path is
still 404.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep IMDS answers for methods it does not serve

The required-token check was registered as a GET route for every path,
and Vert.x answers 405 to any other method on a path some route matches,
so POST /latest/meta-data/ began to answer 405 instead of 404, and a
tokenless HEAD on a required-token instance got 405 instead of 401. The
check is now a route for every method that acts on GET and HEAD only.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): check that the pod identity probe reaches its relay

The probe treats any answer but 000 as ready, so the test passed even
when curl was missing and nothing reached the relay. It now counts the
relay's requests, and both stand-in servers start inside its try.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say that IMDS refuses a tokenless HEAD but serves none

The required-token check's Javadoc called HEAD a read, but no IMDS route
serves HEAD, so one with a token still gets the router's 405.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say what IMDS answers a HEAD that has a token

No route serves HEAD, so the router answers 405 on a path a GET route
serves and 404 elsewhere. A test pins both.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): check IMDS refuses tokenless reads on Fleet and Auto Scaling launches

Since #5964, Auto Scaling launches carry a launch template's
MetadataOptions and CreateFleet forwards them. The test of template
options on Fleet and Auto Scaling launches now also checks that IMDS
refuses the launched instance a tokenless read and serves it with a
token.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say where HttpTokens comes from and what IMDS refuses

The IMDS notes said HttpTokens could be set "at launch". They now name
its sources: RunInstances, directly or through a launch template, EC2
Fleet and Auto Scaling launches, and ModifyInstanceMetadataOptions.
They say that a tokenless GET or HEAD is refused on every path, and
that EKS cluster nodes refuse the change, in the notes, the EKS
lifecycle-protection list and the action table. They also say that the
readiness probe bypasses the image's HTTP proxy, that the helper shells
keep an application's library search path and Python installation from
the system tools rather than promising more, and that the sshd install
shell clears them too.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-19 22:50:50 -04:00
Allen Sanborn 2f6f3a8f86 feat(route53resolver): add TagResource, UntagResource and ListTagsForResource (#6035)
* feat(route53resolver): add TagResource, UntagResource and ListTagsForResource

The Terraform provider lists tags after creating any aws_route53_resolver_*
resource, and Route 53 Resolver had no tagging operations, so the apply failed
right after the create succeeded.

Tags are kept per ARN in their own store, because none of the modelled
resource shapes carries a Tags member. Resolver endpoints, resolver rules and
custom firewall domain lists are taggable; tags passed to their Create calls
are stored, and validated before anything is allocated. Lookup resolves the id
in the caller's account and requires the stored ARN to match exactly, so an
ARN naming another account, region or partition is ResourceNotFoundException.
ListTagsForResource pages with MaxResults (1-100, default 100) and NextToken.

* fix(route53resolver): scope tagging lookups to the caller and type-check tag input

TagResource, UntagResource and ListTagsForResource now require the ARN to
name the caller's own partition, region and account before reading any
store, and fetch the resource with getForAccountMigratingLegacy, so an
unprefixed pre-multi-account entry is migrated only into the account its
stored ARN names. Before, a plain get() moved such an entry into whichever
account looked it up first, and that account could then tag it by naming
its original ARN.

Tag Key and Value, and each UntagResource TagKeys entry, must be JSON
strings (TagKey/TagValue are string shapes) instead of being coerced with
asText(). MaxResults must be an integral number before its 1-100 range is
checked, so 1.5 or true is InvalidParameterException rather than 1.

ListTagsForResource copies the stored tag node under the monitor that
TagResource and UntagResource mutate it under, so a concurrent tag change
can no longer break the iteration or show a half-applied page.

* fix(route53resolver): page tags through Pagination and cap tag lists at 200

ListTagsForResource now pages through the shared Pagination.paginate with
an opaque, namespaced cursor on the tag key instead of a raw offset, so a
forged or stale offset token is InvalidNextTokenException. MaxResults stays
type-checked against the JSON value (integer 1-100, InvalidParameterException).

TagResource Tags, UntagResource TagKeys and the Tags on CreateResolverEndpoint,
CreateResolverRule and CreateFirewallDomainList are capped at the modelled 200
entries per request (TagList/TagKeyList max 200). Over the cap is the
operation's parameter error: InvalidParameterException, or ValidationException
on CreateFirewallDomainList. No per-resource total is enforced; the model does
not state one.
2026-10-19 22:45:48 -04:00
Priamo Germosen 37717537a4 fix(iam): record a denied browser PostObject in CloudTrail (#6030)
Under IAM enforcement a denied S3 request is recorded in CloudTrail as
the operation that was refused, but a browser POST upload left no
record. Its credential is only in the form fields, so S3Controller
authorizes it through IamEnforcementFilter.authorizeAdditionalResource,
which threw AccessDenied without going through the denial emitter.

The POST path now calls a new authorizePostObject, which checks
s3:PutObject as before and, when IAM refuses it, records the denial as
PostObject before refusing. AWS's S3 developer guide lists PostObject
among the object-level API actions logged as CloudTrail events; the
current user guide's data events table no longer names it. The
emitter's recording half is split out so both paths share it, and a
record it cannot write is logged as a warning.

The denial is recorded in the Region the form's credential names, as a
presigned URL's is in the one its query credential names, so a trail
that logs only that Region gets it.
2026-10-19 21:32:47 -05:00
Priamo Germosen 24a960a599 fix(iam): check the API Gateway and Lambda routes the action map names, and test them (#6036)
Under IAM enforcement a REST request is checked as the action its route
maps to, and a route no rule maps is let through unchecked. On #5604 the
S3 and API Gateway entries of iam-authorized-actions.json were noted as
never read, since those requests are authorized by route, with a test
comparing them with the route table asked for. This adds that test,
against each operation's real route, and fixes what it found.

- IamRestRouteCoverageTest builds a request on each operation's route,
  as botocore's model gives it, and checks that the registry resolves
  every S3, API Gateway and Lambda entry of iam-authorized-actions.json
  to the action the entry names. The routes are vendored, one operation
  to a line, in src/test/resources/aws/rest-routes.json by the new
  tools/aws/regen_rest_routes.py, which make aws-data-sync and
  aws-data-check now run.
- API Gateway: only /account and /restapis were mapped, so API keys,
  usage plans, client certificates, base path mappings, domain names
  and all of the v2 API went unchecked. The management API is now
  checked as apigateway:<method> on any route, as AWS authorizes it,
  and RejectDomainNameAccessAssociation and PutRoutingRule as their own
  actions. The v2 operations AWS checks only as actions of their own
  names, routing rules and portals, are not served by Floci.
- Lambda: InvokeWithResponseStream went unchecked; it is now checked as
  lambda:InvokeFunction, against the qualified function as an invoke
  is. GetLayerVersionByArn is checked as lambda:GetLayerVersion. It
  shares its path with ListLayers, so a rule can now require a query
  parameter.
- S3: the two bucket metadata configuration entries are not applied.
  Floci serves no metadata configuration, and such a request falls
  through to ListObjects or DeleteBucket, so it stays checked as the
  operation that runs.
2026-10-19 21:32:37 -05:00
Alessandro Lattao e38ec02d44 fix(cloudformation): register an ECS task definition's containers with their LinuxParameters (#6027)
* fix(cloudformation): register an ECS task definition's containers with their LinuxParameters

An AWS::ECS::TaskDefinition dropped its containers' LinuxParameters, so
a container CloudFormation registered ran without the init process,
capabilities, devices, shared memory, swap or tmpfs mounts the template
asked for, and the Fargate rules on them never applied.

They are now read from the task definition as the ECS handler converts
it and kept where RegisterTaskDefinition keeps them, among the
container's unparsed members under linuxParameters, so
DescribeTaskDefinition returns them in the API's shape and the same
validation, normalisation and Fargate checks apply as for a definition
registered through the API. As CloudFormation's handler does
(measured), the devices and tmpfs lists are sent empty when the
template has none.

* test(compat): wait for the LinuxParameters stacks through TestFixtures

Review of #6027: the test's private waitForTerminal and waitForDeleted
repeated TestFixtures.awaitStackTerminal. It now waits through that, and
deletes its two stacks with a plain DeleteStack after the class, as
CloudFormationEcsTaskDefinitionModelTest does.

* test(compat): give the ECS CloudFormation stacks Floci's and AWS's own timeouts

Review of #6027: DEPLOY_TIMEOUT was 30 seconds against both targets.
These stacks finish in milliseconds on Floci, so it is now 10 seconds
there and 10 minutes on real AWS, as CloudFormationEventsRuleTargetTest
splits it. CloudFormationEcsTaskDefinitionModelTest, from #6018, had the
same single 60 seconds and splits the same way.
2026-10-19 22:32:16 -04:00
Andre Kurait 0517a7a936 fix(cloudformation): enforce SAM REST authorization defaults (#6021)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-19 21:32:03 -04:00
Jackson Price e520166170 fix(ec2): protect subnets and VPCs that load balancers use (#5663)
* fix(elbv2): protect subnets and VPCs that load balancers use

DeleteSubnet and DeleteVpc returned success while an Application or
Network Load Balancer still used the subnet, and DescribeLoadBalancers
went on listing a subnet that no longer existed. EC2 now asks each
VpcDependencyProvider, implemented by ELBv2, before deleting a subnet or
VPC, under the lock CreateLoadBalancer and SetSubnets hold while they
record their subnets, and refuses with DependencyViolation. Covered end to
end through CloudFormation, including updates, rollbacks and stack
deletes that move or delete load balancers, subnets and VPCs.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): record the subnets a load balancer is on

A load balancer's attributes named none of its subnets, so once a
template stopped naming it, the stack walks had nothing to order it by
and deleted it after them, which EC2 now refuses. The provisioner keeps
one hidden uses attribute per subnet, refreshed when an update moves the
balancer and when a rollback moves it back.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): delete removed resources dependents first

The update cleanup deleted removed and condition-disabled resources in
reverse map order, before the replacement cleanup. A subnet an earlier
update added sits after the load balancer it moved onto it, so removing
both deleted the subnet first, and a renamed balancer's old entity still
used a subnet the same update dropped. Both now end DELETE_FAILED, since
EC2 refuses to delete a subnet a load balancer uses.

The removed resources are now walked in dependency order, and a failed
delete is tried once more after the replacement cleanup before it is
reported.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): name every ELBv2 load balancer type as a subnet dependency

The DeleteSubnet and DeleteVpc rows named only Application and Network
Load Balancers, while the check counts every ELBv2 type. The SDK
lifecycle test now deletes its subnets and VPC even when an assertion
fails.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the order of the removed-resource deletes

The removal test passed through the retry alone, so it now checks that
the load balancer is deleted before its subnet is tried, and that the
replaced balancer's old entity goes before the dropped subnet. The
provisioner attribute test reads only what Fn::GetAtt can see, with the
balancer on subnets.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-19 21:13:00 -04:00
David Phillips 0f4f59bbbb fix(elbv2): require an HTTPS default certificate (#5989)
* fix(elbv2): require an HTTPS default certificate

Refuse HTTPS listener changes until a default certificate is supplied.

* docs(elbv2): keep certificate checks documented correctly
2026-10-19 21:12:16 -04:00
TATSUNO “Taz” Yasuhiro 7fb649715c fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself (#6022)
* fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself

A custom origin whose domain is an endpoint this Floci minted now goes to
the listener the viewer reached, with the endpoint domain as Host. Before,
the endpoint host did not resolve, and loopback failed the private address
check.

As on AWS, a forwarded viewer Host is a 502, because the endpoint's
certificate does not name it.

* fix(cloudfront): fetch the endpoint origin over plain HTTP for TLS viewers

A viewer over TLS reached the HTTPS port, and Floci sent plain HTTP to it.
The request now goes to the plain HTTP port at the same address.

The endpoint domains are also indexed by the host a CloudFront origin
names, so a base URL host with upper case or a trailing dot still matches.
2026-10-19 21:06:57 -04:00
Andre Kurait 4b3681eb90 fix(apigateway): preserve API ownership across integration invocations (#6001)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-19 19:58:19 -04:00
Jackson Price 456ae15684 fix(ec2): apply the AWS public address rules and displace earlier Elastic IPs (#5963)
* fix(ec2): assign mock public addresses and displace earlier Elastic IPs

In mock mode an instance never received a public IPv4 address, whatever
its subnet's MapPublicIpOnLaunch or its launch's AssociatePublicIpAddress
said, and an associated Elastic IP never reached DescribeInstances.

- A mock instance that asks for a public address gets one when it reaches
  running, whether DescribeInstances, DescribeInstanceStatus or
  StartInstances completes the launch. Stop and termination release it.
  An associated Elastic IP replaces it and survives a stop; disassociating
  it gives a running instance a new automatic address when its launch
  asked for one.
- AssociateAddress disassociates the Elastic IP an instance already has,
  including one a retained interface carried onto it, as the
  AssociateAddress reference describes.
- Launches from a template take AssociatePublicIpAddress from its
  device-index-0 interface (RunInstances, CreateFleet, Auto Scaling), and
  RunInstances and CreateFleet also take that interface's subnet.
- RunInstances refuses an instance-level SubnetId combined with network
  interfaces, on the request or in its launch template, with
  InvalidParameterCombination.

Split out of #5671 at review.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): scope Elastic IP displacement and automatic addresses as AWS does

- AssociateAddress ignored PrivateIpAddress, so an Elastic IP meant for
  a secondary private address displaced the one on the primary. The
  address is now recorded on the private address it names, only an
  address already on that private address is displaced, the interface
  shows it there, and in mock mode only the primary's address becomes
  the instance's public address.
- An instance launched on an existing network interface got an
  automatic public address; AWS assigns one only to an interface the
  launch creates.
- A released automatic address was replaced while a second interface
  was attached; AWS does not replace it then.
- An Elastic IP that a retained interface carried to a new instance
  stayed without an instance. It now names that instance, which shows
  the address and keeps it across a stop.
- A mock launch could complete over a concurrent stop or termination,
  and DescribeAddresses could write back an address disassociated
  meanwhile; both now re-check under the instance's lock.

The tests also cover a request's own network interfaces with an
instance-level SubnetId, and the template interface docs now say which
launches take the subnet.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): settle second-review findings on mock public addresses

- DescribeAddresses re-points associated addresses under the allocation
  lock, and a mock launch, start or stop reads the instance's Elastic IP
  under it, so none of them acts on an association written halfway or
  changed meanwhile.
- An Elastic IP that a retained interface carries is found through that
  interface, also when it is disassociated, instead of being rebound to
  the next instance at launch, which left a dead InstanceId behind when a
  container launch failed.
- StartInstances leaves a running mock instance alone.
- In container mode too, an address on a secondary private address no
  longer becomes the instance's public address.
- The second-interface test associates its address before attaching the
  interface, since AssociateAddress by InstanceId needs exactly one.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep terminated mock instances down and address reads unblocked

- StopInstances leaves a terminated or shutting-down mock instance as it
  is, re-checked under the lock, so terminate, stop and start no longer
  revives it with a public address.
- DescribeAddresses waits for the allocation lock only when an address
  is associated with an instance, and the container re-point no longer
  rewrites an unchanged instance.
- A mock start treats a state without a name as settled instead of
  throwing.

Tests now cover the terminated instance and, with a reachable container
address, an Elastic IP on a secondary private address leaving the
instance's public address alone.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): settle Qodo findings on mock public addresses

- AssociateAddress refuses a PrivateIpAddress that is neither the
  instance's primary private address nor a secondary address of its
  primary interface, with InvalidParameterValue and before any
  association changes, instead of treating it as the primary and
  displacing the Elastic IP already there.
- RunInstances from a launch template whose device-index-0 interface
  names an existing NetworkInterfaceId launches on that interface, in
  its subnet and without an automatic public address, as a request
  naming it would, instead of on a new interface in the default subnet.
- The SubnetId-with-interfaces refusal test now launches against a real
  subnet and checks that the refused request leaves no instance or
  interface behind.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): accept a container instance's launch address in AssociateAddress

In container mode without AWS-faithful private addresses, the container
manager replaces the instance's reported private address with its Docker
bridge address once the container runs, and nothing keeps the subnet
address RunInstances returned. The new PrivateIpAddress check therefore
refused that address with InvalidParameterValue, though callers may still
name it. Only mock mode and the AWS-faithful mode, which keep the launch
address, now refuse a stray PrivateIpAddress; elsewhere any value means
the primary address, as before.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): decide automatic public addresses the same way with containers

The public IPv4 rules were applied to mock instances only. A
container-backed instance kept its address after a stop and a
termination, got one on an existing network interface, kept its
reachable address after its Elastic IP was disassociated even when the
launch never asked for one, and had a released address replaced while
a second interface was attached.

One rule, AutomaticPublicAddress, now decides whether an instance has
an automatic address in both modes: the launch asked for one on an
interface the launch created (recorded when the instance is built), a
stop, a termination or a disassociated Elastic IP releases it, and a
replacement is held back while a second interface is attached. An
Elastic IP on the primary private address still takes precedence. Only
the value differs by mode: the container's reachable address, or an
invented one where there is no container.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): settle review findings on the shared public address rule

- DisassociateAddress decides by the association, not by comparing
  addresses: only an Elastic IP on the instance's primary private address
  gives way to another one left there, or to an automatic address when
  one is due. With a container, every Elastic IP points at the one
  reachable address, so disassociating a secondary one no longer clears
  the instance's public address, and one a restart moved no longer
  survives its disassociation.
- StartInstances on a stopped container instance releases an automatic
  address that a stop outside StopInstances, such as Floci's shutdown,
  left in place, so the start decides afresh.
- With a container, these writes no longer wait on the instance's lock
  while holding the allocation lock, since the port-forward manager holds
  that lock across Docker calls.
- A start test case now keeps an address distinct from the one it
  expects, and two comments describe the flag as it now is.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): release only the primary interface's Elastic IP on disassociation

- DisassociateAddress treats an Elastic IP as the instance's public one
  only when it sits on the primary interface, not on a retained
  interface attached at another device index, so disassociating that one
  no longer clears the instance's automatic address.
- With a container, DescribeAddresses no longer writes a re-pointed
  address back onto a terminated or shutting-down instance.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): show a carried Elastic IP on a container instance's launch

- An instance launched on a retained interface that still carries an
  Elastic IP records that address at RunInstances, and the container
  launch re-points it once the container runs. With containers, such an
  instance had no public address until a stop and start, since the
  shared rule gives an existing interface no automatic address.
- With a container, TerminateInstances clears the public address under
  the allocation lock, so a DescribeAddresses re-point already under way
  cannot write it back onto the terminated instance.
- The secondary-interface disassociation test checks the address was
  still associated before the call and is not after it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): re-point a carried Elastic IP at its new instance

- DescribeAddresses re-points an Elastic IP that a retained interface
  carries at the instance that interface is now the primary interface
  of. With containers, the address otherwise kept the previous
  container's address for good, since termination clears its instance
  id.
- With a container, StopInstances leaves a terminated or shutting-down
  instance alone, as mock mode does, instead of stopping it into a
  startable state and writing its Elastic IP back.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): give mock instances no invented public address by default

Mock instances due an automatic public IPv4 address got a random
54.x.x.x one, a real AWS range, so a tool that connected to it reached
someone else's host. The new floci.services.ec2.mock-public-addresses
setting (FLOCI_SERVICES_EC2_MOCK_PUBLIC_ADDRESSES) chooses the address:
none (the default) gives none, documentation draws distinct addresses
from 203.0.113.0/24 as Lightsail and EMR do, and fixed gives every
instance mock-public-address (default 127.0.0.1), an address the caller
can reach.

Only the value changes. The launch still records whether it asked for
an address, so the shared rule and Elastic IP precedence work as before,
and instances with containers keep reporting their reachable address.
Elastic IP allocation still draws from 54.x.x.x, as on main.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): settle review findings on the mock public address setting

A configured mock-public-address with surrounding spaces was reported
as is; it is now stripped. The docs and the AutomaticPublicAddress
Javadoc no longer describe every mock instance as getting an address,
and the test configurations that launch mock instances name the
setting instead of leaving it null.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): allocate Elastic IPs from the documentation range

AllocateAddress handed out random 54.x.x.x addresses, a real AWS range,
and this branch shows an associated Elastic IP as a mock instance's
public address, so even with mock-public-addresses at none a client
could reach someone else's host through one. Elastic IPs now come from
203.0.113.0/24 in every mode, distinct from the account's other
Elastic IPs and its instances' public addresses; once all 254 are taken
AllocateAddress fails with AddressLimitExceeded rather than repeat one,
since callers name an Elastic IP by its address.

Under mock-public-addresses: fixed, an Elastic IP on a mock instance's
primary private address is re-pointed at the configured address, as one
on a container instance is at the container's reachable address, and
disassociation restores the allocated address.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): settle review findings on documentation-range Elastic IPs

An Elastic IP re-pointed at the fixed address kept it after a restart
under another setting; the next read now shows its allocated address
again. The re-point Javadoc and the Elastic IP docs no longer claim a
54.x.x.x allocation or addresses that never repeat, the docs say that
earlier allocations keep their address until released, and a test now
proves an allocation skips the addresses instances hold.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-19 19:48:20 -04:00
Mario Toffia 34d904fde5 feat(iot): search fleet things by connectivity status (#6025)
* feat(iot): search fleet things by connectivity status

SearchIndex refused every connectivity field and its documents carried
no connectivity, so an application that finds its things by connection
state got InvalidQueryException.

With connectivity indexing on, a thing now reports the MQTT broker
session whose client id is its name, and connectivity.connected,
connectivity.clientId and connectivity.disconnectReason can be
searched. The other connectivity fields are still refused with
InvalidQueryException. A thing whose client id never connected reports
connected false and timestamp 0, as on AWS.

The broker now records the account, region, connect time, keep alive
and clean session of each session, and keeps in memory how the last
one of each client id ended in each account and region, until a state
reset. The reason is the one the session's disconnected lifecycle
event carries, recorded by the same single endSession under the
session lock, so the late end of a displaced session cannot overwrite
its successor's. A plaintext session counts in the default account and
region, a TLS session in its certificate's.

Closes #4912

* fix(iot): serialize connectivity reads and resets with session ends

A connectivity lookup read the live session without the session lock,
so a search racing DeleteConnection could see the session connected
after its disconnect was recorded. A state reset cleared the history
without the lock too. Both now run under the session lock; the lookup
tests the session's ended flag instead of the endpoint, as the lock is
never held across endpoint calls.

Tests cover the reset contract, a lookup and a reset racing a held
DeleteConnection, and a TLS session counting in its certificate's
account and region.
2026-10-19 19:45:53 -04:00
Hector Ventura 1eb402d623 fix(ec2): keep tags in the region of the resource they label (#5973)
* fix(ec2): keep tags in the region of the resource they label

DescribeTags listed every region's tags because the tag store was keyed by
the bare resource id. Tags are now stored per region, so DescribeTags,
DeleteTags, CreateTags and the aws:ResourceTag IAM condition only see the
request region's tags. Each side of a cross-region transit gateway or VPC
peering connection keeps its own tags in its own region.

Tags stored by bare id are moved under their resource's region at startup,
for every account; a tag whose resource no region holds is dropped.

DescribeTags now reports image, volume, snapshot, network-acl,
vpc-peering-connection and spot-instances-request instead of "unknown".
Tags given when a volume or peering connection is created reach the store,
and DescribeVolumes, DescribeSnapshots and DescribeSpotInstanceRequests show
later CreateTags and DeleteTags changes.

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

* fix(ec2): remove tags with their resource and keep node and catalog AMI tags on upgrade

Deleting a volume (directly or as a delete-on-termination volume of a
terminated instance), a snapshot with its image or a VPC peering connection,
and pruning a terminated instance, now removes the resource's tags, both
peering sides included.

The startup migration no longer drops tags it cannot place in a store: a
catalog AMI's tags move to the default region, and an instance's are kept
until its EKS node is found in a region, which then claims them.

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

* fix(ec2): file a cluster node's legacy tags under its own region

A region-less findInstanceById reaches the EKS provider, which answers from any region, so the claim moved the node's legacy tags under a null region where DescribeTags never finds them. The claim now uses the instance's own region, and with no region known it reads the legacy tags in place for a regional lookup to claim.

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

* fix(ec2): pass the region in the query GET resource-tag stub

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-19 19:13:38 -04:00
andrehoong-px 5774e7db8d feat(cloudformation): support S3 Vectors resources (#5853)
* feat(cloudformation): support S3 Vectors resources

* fix(cloudformation): validate S3 Vectors encryption settings

* fix(cloudformation): align S3 Vectors provisioning contracts

* fix(cloudformation): restore S3 Vectors properties on rollback
2026-10-19 18:16:10 -04:00
Priamo Germosen eba0f72255 fix(iam): check iam:PassRole for ECS, Step Functions, EventBridge and CloudFormation (#5971)
Under IAM enforcement, a request that handed one of these services a role
needed no iam:PassRole on it. A user allowed only ecs:RegisterTaskDefinition
and ecs:RunTask could start a task with any role in the account, and with
ECS task-role credentials on, the task got that role's credentials. The
IAM user guide requires the permission for every role passed to a
service. AWS's Service Reference names the service each operation passes
its role to, and the check now covers these operations as it already
covers Lambda and EC2:

- ECS: RegisterTaskDefinition passes its task and execution roles to
  ecs-tasks.amazonaws.com. RunTask and StartTask pass the task
  definition's roles and any role override, and CreateService,
  UpdateService and CreateTaskSet pass the roles of the task definition
  they name. The infrastructure roles go to ecs.amazonaws.com: a managed
  EBS volume's role, the service role, the load balancer, lifecycle hook,
  Service Connect TLS and VPC Lattice roles, and a Managed Instances
  provider's infrastructure role. A role given by name is the role of
  that name in the caller's account.
- Step Functions: CreateStateMachine and UpdateStateMachine pass roleArn
  to states.amazonaws.com, in a JSON or a CBOR body, gzip-encoded or
  not, since the CBOR endpoint decompresses a body before running it.
- EventBridge: PutRule passes RoleArn, and PutTargets each target's
  RoleArn, to events.amazonaws.com.
- CloudFormation: CreateStack, UpdateStack, DeleteStack, CreateChangeSet
  and ContinueUpdateRollback pass RoleARN when the request names one. A
  later operation that names none reuses the stack's role without the
  check, as CloudFormation does. CreateStackSet and UpdateStackSet pass
  AdministrationRoleARN, or the default
  AWSCloudFormationStackSetAdministrationRole for a self-managed
  StackSet, as the CloudFormation user guide says. An update goes by the
  StackSet's own permission model, which Floci keeps whatever
  PermissionModel the request names.

A role override on RunTask is checked as well as the task definition's
roles, not instead of them, because Floci runs a task with the
definition's task role. The task definition and the StackSet's permission
model are looked up through a new PassedRoleLookup interface, which ECS
and the StackSet service implement, so the filter does not depend on
either service.

Three services are left out. Floci authorizes Cloud Control as
cloudcontrolapi:*, where AWS uses cloudformation:*, so its RoleArn waits
until that namespace is fixed. EventBridge Scheduler and Pipes are REST
services that no IAM route rule maps to an action yet, so enforcement
does not check their requests at all, iam:PassRole included.
2026-10-19 17:07:08 -05:00
Aniket Shukla 5787dac5e8 fix(kinesisanalytics): retry Flink configuration uploads (#6020)
Rebuild archive streams for transient daemon failures using the shared tar copier. Preserve required and optional copy handling, and cover consumed streams, retry exhaustion and startup order without sleeping in tests.
2026-10-19 17:48:45 -04:00
Allen Sanborn fb390968d5 feat(guardduty): support publishing destinations (#6016)
* feat(guardduty): support publishing destinations

Add CreatePublishingDestination, DescribePublishingDestination,
UpdatePublishingDestination, DeletePublishingDestination and
ListPublishingDestinations under /detector/{detectorId}/publishingDestination.
Previously these returned UnknownOperationException, which broke
Terraform's aws_guardduty_publishing_destination.

Destinations are stored per detector through StorageFactory, so they follow
the detector's account and region scoping, survive a persistent-storage
reload, and report PUBLISHING on create (the state Terraform's create waiter
targets). A missing destination returns BadRequestException with the message
the Terraform provider matches for not-found. Deleting a detector removes its
destinations.

clientToken makes create idempotent and is capped at the model's 64
characters, measured in code points as the model's length constraint is.
destinationArn stays optional on create: the GuardDuty model marks
DestinationProperties.DestinationArn and KmsKeyArn as not required
(botocore guardduty/2017-11-28 service-2.json).

The service gains a five-store constructor; the existing three- and
four-store (malware protection plan) constructors delegate to it.

Closes #4983

* docs(guardduty): update the service matrix operation count

* test(guardduty): cover the publishing destination lifecycle through the SDK

Create, describe, update, list and delete an S3 publishing destination
with the AWS SDK v2 GuardDuty client, asserting the shapes as the SDK
reads them, including the required publishingFailureStartTimestamp.
2026-10-19 16:45:15 -04:00