* fix(rds): run MySQL and MariaDB with their parameter group values
A DB cluster parameter group or DB parameter group was stored but never
reached the engine: the container started with only the authentication
option, so the database kept MySQL's built-in defaults.
Every container start (create, reboot, stop and start, emulator restart)
now passes the group's overrides as --loose-<name>=<value> server options:
the cluster parameter group for a cluster, the DB parameter group for a
standalone instance. The loose prefix makes the server skip an Aurora-only
parameter with a warning. Formula values and the parameters that decide
where the server listens and keeps its data are left out, and Floci's
authentication options come last so the proxy keeps working.
DescribeDBClusters now reports DBClusterParameterGroup.
Fixes#5946
* fix(rds): layer the Aurora writer's parameter group and switch groups on modify
Review follow-up:
- require_secure_transport and skip_grant_tables are no longer passed to
the server, like port and socket: Floci's proxy talks to MySQL without
TLS, and skip_grant_tables turns networking off, so either would lock
every client out.
- An Aurora cluster's engine now runs with its DB cluster parameter group
and the writer instance's DB parameter group on top, so an
instance-level value such as max_connections reaches the database.
Creating the writer restarts the cluster's container when its group
changes the engine's options; every later start reads the writer's
group too.
- ModifyDBCluster takes DBClusterParameterGroupName and ModifyDBInstance
takes DBParameterGroupName. The group is checked against the engine
before anything else in the request is applied, recorded at once, and
used from the database's next start (a reboot), as on AWS.
* fix(rds): apply Aurora groups on a writer reboot and report incompatible-parameters
Review follow-up:
- RebootDBInstance on an Aurora cluster's writer restarts the database the
cluster's members share, which is how AWS applies a changed DB cluster
parameter group or writer DB parameter group. A reader's reboot still
only restarts its endpoint.
- time_zone reaches the server as --default-time-zone, since MySQL has no
time_zone option, and Aurora's binlog_format=OFF, which turns binary
logging off and which MySQL refuses as a value, as --skip-log-bin.
- A server that stops while starting with its parameter group's options
leaves no container, and its instance, or every member of its cluster,
reports incompatible-parameters until a reboot starts it with values the
server accepts. Floci logs the server's error lines.
- DescribeDBClusters names a default DB cluster parameter group only when
DescribeDBClusterParameterGroups lists it.
- The integration test reboots the writer rather than the cluster, checks
that binary logging is off, covers a refused value, and skips through
RdsRequests.assumeDocker.
---------
Co-authored-by: Priamo <pgermosen@gmail.com>
* feat(lambdaweb): serve the Lambda metadata endpoint
AWS gives each environment AWS_LAMBDA_METADATA_API, AWS_LAMBDA_METADATA_TOKEN
and AWS_LAMBDA_RUNTIME_API, all at one server. It answers the zone id to a
Bearer token with any method, "Client.Unauthorized" with 401 to anything
else, Go's 404 to another path before the token, and a 307 to the clean
path.
* fix(lambdaweb): take the metadata port outside the Runtime API range
The width of that range is the Lambda concurrency, and its ports are only
reached over the Docker network, as any other port is. A listen that fails
now closes its server.
* fix(lambdaweb): start the metadata server before a start mints a session
A metadata server that could not start left the role session and the token
of an environment that never ran.
Use one private helper from create and createAndStart while preserving ordinary cleanup, ephemeral volume removal and suppressed cleanup failures.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Reclaim disposable anonymous volumes while preserving adopted containers during failed recovery. Retain pre-reboot dumps and failed cleanup ownership across partial teardown. Preserve the original database when only proxy shutdown fails. Share startup orchestration while retaining the opt-in cleanup policy.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Normalize subnet IPv6 responses and expose regional availability-zone network borders. Keep the read-only regional test at a unique execution order.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Every SES v2 operation reads its body through readOptionBody, now also
CreateEmailIdentity, CreateEmailTemplate, UpdateEmailTemplate,
CreateCustomVerificationEmailTemplate,
UpdateCustomVerificationEmailTemplate and TagResource, which read a body
that is not a JSON object as one without members. Only an empty body is
read as one without members; a whitespace-only body, malformed JSON and
anything but whitespace after the object are a SerializationException
without a message, as AWS answers them. The hand-rolled copies in the
tenant, contact, account, identity, import job, send, dedicated IP,
suppression and template controllers, which answered malformed JSON
with a BadRequestException carrying Jackson's message, are gone, and so
is the import job controller's own strict reader. The operations that
answer an empty body with "Request body is required." no longer give
that answer for a whitespace-only one.
* fix(cloudwatch): return empty CompositeAlarms and LogAlarms from DescribeAlarms
AWS sends every alarm collection even when it is empty. Floci only sent
MetricAlarms, so the AWS CLI's text output printed a leading None line
for each missing paginator result key.
Closes#6362
* test(cloudwatch): check empty alarm collections in sdk-test-python instead of bats
Drop the new AWS CLI bats file and assert the empty CompositeAlarms and
LogAlarms lists in the existing describe_alarms test, as boto3 leaves an
absent list out of the response.
Share plain, stored-name checked and explicit-account lookups while retaining validation order and owner selection.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Honor group preferences and inherited targets in the shared launch path. Preserve failed launch state, limit fallback to capacity shortages, and validate all supplied numeric Query target members. Reuse existing SDK coverage.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Normalize Route53 record identity without mutating records before batch commit. Reuse the shared ASCII record-name normalization for alias comparison, as requested in maintainer review.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Continue terminal statement eviction when receipt cleanup fails, preserving active and fresh statements across accounts.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Exercise idle expiration and heartbeat renewal with a controlled monotonic clock and scripted future waits. Keep production defaults on System.nanoTime and CompletableFuture.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Require reserved capacity for direct, template, Fleet and Auto Scaling launches. Preserve the targeted shortage message shared with restart. Keep CloudFormation timeout fixtures in their separate contribution.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(ec2): revoke security group rules by SecurityGroupRuleId
Both revoke operations read SecurityGroupRuleId.N and delete each named
rule, which also drops it from the group's IpPermissions. A rule id that
names no rule of the group in that direction fails the call with
InvalidSecurityGroupRuleId.NotFound and leaves every rule in place.
* fix(ec2): revoke prefix list and unresolved group rules by id
Removing a rule's peer matches its prefix list id, and a group reference
recorded without an id matches the pair that also has none. A permission
is dropped only once every source, prefix lists included, is gone. Revoke
by id checks and removes its rules under the group lock, and the tests
share one CIDR authorize helper.
* test(ec2): build every rule source through one authorize helper
The helper takes the action, prefix lists, CIDR and description, and declares its request as RequestSpecification.
Check the scoped log group before parsing a FilterLogEvents pattern. Reuse the missing-group error and cover missing, deleted, empty and populated groups through service and SDK tests.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat: support Redshift Data API client token idempotency
* test: verify Redshift Data API retry compatibility
* fix: address Redshift Data admission and cleanup races
* refactor(redshift-data): remove implicit in-memory receipt constructor
Match the IoT Data Long response contract instead of emitting floating-point seconds. Cover both retained read responses with fixed values, missing-timestamp controls, and SDK wire round trips.
Fold only ASCII DNS letters and accept an optional trailing dot while keeping distinct target values and rejected batches intact. Exercise compatibility cases using the suite endpoint.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(lambdaweb): check the execution role as AWS does
AWS refuses a revision whose execution role is in another account with
403 AccessDeniedException. It refuses a role that does not exist or does
not trust lambda.amazonaws.com with 400 ValidationException, and that
check gives no aws:SourceAccount or aws:SourceArn. An environment
assumes the role with the function as its source, and a request gets
502 Platform.CannotAssumeRole when Lambda can no longer assume it.
* fix(iam): match a wildcard principal and the service keys in service trust
{"AWS": "*"} lets Lambda assume a role, and a Deny on it refuses the role.
Lambda sets aws:PrincipalIsAWSService to true and aws:PrincipalServiceName
to its principal when it checks the role and when an environment assumes it.
* fix(lambdaweb): answer CannotAssumeRole when the role goes during a start
A role deleted after the trust check gave the container the account's
placeholder credentials. AWS answers 502 Platform.CannotAssumeRole for a
deleted role.
* fix(organizations): return OU and account paths
* fix(organizations): stabilize list path rendering
Render selected resources from request-local parent IDs without leaf rereads. Preserve scoped ancestry errors and tolerate concurrent removal or movement. Reduce account collection scans for a full 20-row page from 21 to 1.
* refactor(organizations): share ancestry walk and path format
Keep live, CloudFormation, and cached list paths on one traversal with caller-supplied parent lookups. Preserve scoped fallback and stale-row handling, and cover root-to-leaf path parity at three depths.
Retarget provisioned alias allocations while retaining quota and cleanup ownership. Isolate failed replacement writes or unsupported targets to their allocation so unrelated configurations continue reconciling. Retry the retained allocation when its target or storage recovers.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
ResourceNotFoundException for a missing log group, log stream or
subscription filter now carries AWS's fixed text, ending with a period
and without the resource name. PutLogEvents looks up the log group
before the stream, so a put to a missing group reports the group, as
AWS does, instead of the stream.
Closes#6338Closes#6339
Return ReservationCapacityExceeded when a matching targeted reservation lacks capacity at precheck or admission, including restart. Preserve mismatch errors and existing resource cleanup.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
SidecarConcurrency's SIDECAR_PERMITS map (added in #6262) never dropped its
entry when repositoryContainerId's container was released, so deleting a
CodeArtifact pypi repository leaked one Semaphore for the life of the
process. Reposilite's shared container key is unaffected since it never
tears down.
* fix(eventbridge): enforce tag resource ownership
* fix(eventbridge): resolve tag ARN partition from request region
* fix(eventbridge): report missing tag resources
* feat(redshift): support default IAM roles for COPY and UNLOAD
* fix(redshift): distinguish default role keyword from literals
* fix(redshift): accept blank default IAM roles
Delegated access has two ceilings and only one of them belongs to the request.
The twelve hours sessionDurationType declares are held at the filing, where
SessionDuration arrives. The other is the approver's, and the user guide's own
note states it: "The maximum duration for delegated access is 12 hours.
However, root users can only approve delegation requests with a duration of 4
hours or less. If a request specifies more than 4 hours, you must use a
non-root identity to approve the request." Nothing read it, so the account root
could approve a twelve-hour delegation and the credentials it bought ran that
long.
It is read at the approval rather than at the filing, because that is where the
approver is known: a request longer than four hours is refused for root and the
same request is approvable by an IAM user or role of that account, which is the
remedy the note itself names. Root is the caller whose ARN ends in :root, what
this family already names an approver by, and what a key naming no IAM user
resolves to, so approving a long request locally means signing as a user rather
than with a bare account id.
AcceptDelegationRequest models NoSuchEntity, ServiceFailure and
ConcurrentModification and nothing for this, and no source gives the code AWS
answers, so AccessDenied is chosen and recorded in docs/services/iam.md: the
guide states the rule as which identity may approve, which is what the
release's own OnlySendByOwner rule already answers that way.
Five tests. Three on the service: the refusal at five hours with the privileged
user then approving the same request, the cap itself approved at four hours
exactly, and twelve hours approved by a user to show the cap is the approver's.
Two over the wire: the same refusal where the account id is the signing key,
and the release's id check answered for an id that breaks its pattern rather
than one that is absent, which the absent half's test left uncovered.
* feat(msk): add SCRAM secret association metadata APIs
Add association, listing and disassociation endpoints with persisted metadata and secret validation. Broker user management and reconciliation follow separately.
* test(msk): enhance cleanup logic in MskTest for SCRAM secrets and KMS keys
* fix(msk): accept resolved secret ARNs with generated suffixes
* fix(msk): reject KMS alias ARNs for SCRAM secrets
Closes#6229
* fix(msk): reject partial secret ARNs with operation-specific errors
* fix(msk): clean up SCRAM associations for deleted clusters
Add scheduled, account-aware cleanup of association left after cluster delete
* fix(msk): allow disassociation of deleted SCRAM secrets
* feat(firehose): store and echo CloudWatchLoggingOptions on S3 destinations
CreateDeliveryStream and UpdateDestination silently dropped CloudWatchLoggingOptions because the S3 destination model had no such member. The block is now stored and echoed on both ExtendedS3DestinationDescription and S3DestinationDescription, defaulting to {"Enabled": false} when omitted, as real AWS does. UpdateDestination merges it member-wise, so an update naming only Enabled keeps the stored log group and stream.
* fix(cloudformation): forward Firehose processing and logging configuration
FirehoseCfnProvisioner now reads RoleARN, ErrorOutputPrefix, CloudWatchLoggingOptions and, for the extended S3 destination only, ProcessingConfiguration, resolving intrinsics before handing them to the service. A Lambda transform declared in a template therefore runs on delivery and is echoed by DescribeDeliveryStream, as on AWS. An omitted member stays null so an UpdateStack keeps the stored value, and an unreadable block fails the resource with ValidationError.
* test(cloudformation): cover a stack Firehose stream's Lambda transform end to end
A stack-created extended S3 stream now reads back its role, error prefix, logging options and
Lambda processor, runs that processor on delivery, and picks up a new function on UpdateStack.
* docs(firehose): describe logging options and the CloudFormation members applied
Document how CloudWatchLoggingOptions is stored, defaulted and merged on the S3 destinations, and note which DeliveryStream properties the CloudFormation provisioner applies.
* fix(cloudformation): validate a Firehose stream's forwarded destination like CreateDeliveryStream
The provisioner now runs the same wire-shape validation CreateDeliveryStream applies, so a bad processor or CompressionFormat fails the resource instead of being stored. A structured destination member present as anything but an object also fails rather than being silently dropped.
* docs(cloudformation): name every Firehose property the provisioner applies
* fix(firehose): validate CloudWatchLoggingOptions names against AWS constraints
LogGroupName and LogStreamName are now checked against AWS's 512-character bound and their modeled patterns, reporting both rules when both fail, as probed against real AWS.
* chore: retrigger CI after a transient npm publish race
native arm64 / sdk-test-node ran npm install between the publication of @aws-sdk/lib-storage 3.1156.0 and @aws-sdk/client-s3 3.1156.0, and failed with ERESOLVE.
* test(firehose): share the delivery and Lambda transform helpers in FirehoseRequests
Moves encode, putRecordBatch, firstKey and the record-id driven Lambda transform answer out of CloudFormationFirehoseIntegrationTest and FirehoseLambdaTransformIntegrationTest into one testing fixture both now use.
* fix(firehose): require both log names when CloudWatch logging is enabled
With Enabled true, a missing or empty LogGroupName or LogStreamName is now refused with AWS's InvalidArgumentException, group before stream, on the merged result for UpdateDestination and ahead of the other semantic checks, as probed against real AWS.
* fix(firehose): fill the defaults on a Redshift destination's S3 backup
Create and describe now apply the S3 defaults, including CloudWatchLoggingOptions Enabled false, to a Redshift destination's backup configuration as well as its intermediate one, so persisted streams heal on read.
* feat(sqs): publish AWS/SQS queue metrics to CloudWatch
Every active queue now reports the AWS/SQS metrics once a minute on the
QueueName dimension: the depth gauges, ApproximateAgeOfOldestMessage, the
send, receive, delete and empty-receive counters, SentMessageSize, and for
FIFO queues the in-flight groups and deduplicated sends. The samples follow
what SQS sends on AWS, so alarms, GetMetricData and GetMetricStatistics see
queue metrics without PutMetricData.
The CloudWatch metric store is now journaled under persistent mode, as the
CloudWatch Logs event store is, since it takes a write per metric per active
queue every minute.
Closes#6275
* fix(sqs): stamp queue metrics with the minute that ended
The publisher now ticks just after each minute boundary and stamps its
samples with the minute that ended, so a call counts in the minute it was
made instead of the minute of a startup-relative tick. A queue whose write
fails no longer stops the others, and the log names it. A queue deleted and
created again between the snapshot and the lookup is skipped instead of
reporting the old queue's depth under the new one.
* fix(sqs): bound AWS/SQS metric history and finish the tick on shutdown
The publisher now drops AWS/SQS datapoints older than the 15 days AWS keeps
one-minute data, once an hour, so the history it generates for an active
queue stays bounded. On shutdown it stops before the storage flush and waits
for a running tick, so the last minute is not written after the store closed.
* test(sqs): keep the scheduled metrics tick out of the test run
The acceptance test publishes its own ticks, but the scheduled one could
still stamp the test queue's depth into a complete period newer than them,
since a tick stamps the minute that just ended. floci.services.sqs.
cloudwatch-metrics-enabled now turns the tick off, and the test
configuration does, as it does for the S3 lifecycle sweep. It also lets a
user opt out of the AWS/SQS metric volume.
* test(sqs): build the metrics test's queue service with SqsServiceFactory
EksService restores persisted clusters in @PostConstruct, but CDI creates
the bean on first use. After a restart no cluster's k3s container came
back until something called the EKS API, so workloads on it stayed down.
EmulatorLifecycle now calls EksService.restorePersistedRuntime from
onHttpStart, after the start and ready hooks. It waits for the IMDS server
to start, because a recreated cluster's Pod Identity and IMDS relays probe
Floci's HTTP port and IMDS before they route pod traffic there. It runs
after the hooks so they and the ready line don't wait minutes for k3s.
If the restore throws, it is logged and the emulator stays up; EKS
requests retry creating the service, as before.
EksBootRestoreIntegrationTest boots a fresh application with EKS out of
mock mode and checks EksService was created without an EKS request, as
EcsBootReconcilerIntegrationTest does for ECS. Its profile pins the HTTP
port, since onHttpStart acts only on quarkus.http.port.
Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
* fix(dsql): enforce IAM and the cluster's policy on the control plane
A cluster's resource-based policy governs DSQL's control plane as well as
its connections (measured, eu-west-1): a Deny of dsql:GetCluster,
UpdateCluster, TagResource or GetVpcEndpointServiceName refuses that call,
and a call it does not name still answers. With IAM enforcement on, Floci
left every DSQL control plane route unchecked: no rule in
IamActionRegistry mapped one, so the policies, identity or resource, were
never read there.
IamActionRegistry maps every operation of DSQL's model to its action, the
stream operations Floci does not serve included, and
IamRestRouteCoverageTest now checks all of them against botocore's routes,
vendored for DSQL by regen_rest_routes.py. ResourceArnBuilder names the
resource each call is checked against, as the Service Authorization
Reference gives it: the cluster, the stream, or the ARN a tagging route
names, minted in the request's partition. CreateCluster and ListClusters
are checked against cluster/*, as DSQL checks them (measured; the
reference lists ListClusters with no resource). The enforcement filter
then reads the cluster's policy through DsqlResourcePolicyProvider, as it
reads a topic's or a function's.
* fix(dsql): check tagging at /tags too, where the ARN is in the query or body
Asked in review: Floci serves DSQL's tagging at /tags as well as at
/tags/{arn}, naming the ARN in the resourceArn query parameter or body field,
and the rules matched only the path form, so a bare /tags call reached DSQL's
tag handler unchecked. The rules now match both, as Scheduler's do, and the
control plane test tags, lists and untags through each form.
* fix(ses): answer SES v2 wire-type errors with AWS's messages
A scalar for a map member is "Expected map or null", a string, boolean,
object or list for an integer member gets the Integer conversion message,
and a number is narrowed to an int the way AWS reads it (1.5 is accepted,
a value above the int range saturates before the range check). A body that
is not a JSON object is a SerializationException instead of a BadRequest.
* test(ses): give the new SES v2 tests their own order and share the non-object bodies
A client cancels a running query by opening a second connection and
sending a CancelRequest: the backend's process id and secret key from
the BackendKeyData it received at login. The RDS proxy only knew
SSLRequest and StartupMessage, so it logged "Unexpected PostgreSQL
startup protocol version: 80877102" and closed the connection. The
cancel never reached PostgreSQL and the query kept running.
The client already holds the backend's own key, because the proxy
relays BackendKeyData unchanged. So the proxy now passes the 16 bytes
to the backend on a connection of its own and closes, as the server
does. A cancel of any other length is dropped with its own warning.
Redshift clusters share this handler, so they forward cancels too.
A DB proxy endpoint drops a cancel, because RDS Proxy does not support
one.
The RDS integration tests now share their Docker check and their
CreateDBInstance and DeleteDBInstance calls in RdsRequests. The Docker
check uses DockerAvailability, so only a missing daemon skips a test.
Limits: a cancel still takes one of the proxy's connection permits, so
a proxy at its connection limit refuses it, where PostgreSQL itself
would not. And on an auto-paused Aurora backend, a cancel resumes it,
as any other connection does.
Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
* fix(lambdaweb): let heap flags in NODE_OPTIONS replace the defaults as AWS does
AWS drops both of its heap flags when NODE_OPTIONS names
--max-old-space-size or --max-semi-space-size, and puts those on the
command line in their place. Floci kept its own flags, so a larger heap
set in NODE_OPTIONS lost to --max-old-space-size=1024.
* test(lambdaweb): copy a quoted heap value from NODE_OPTIONS as AWS does
AWS puts --max-old-space-size="1536" on the node command line with its
quotes. Node refuses that value, so the start fails with
Runtime.ExitError.
* docs(lambdaweb): put the NODE_OPTIONS sentences after the require.main one
* test(lambdaweb): share the default heap flags in the NODE_OPTIONS tests
Initialize and route qualifier-owned provisioned environments without invoking handlers during initialization. Keep configuration outcomes committed while failed removal remains owned for retry, and bound cleanup after late invocation release. Preserve on-demand spillover and the separate alias-retargeting stage.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
DSQL evaluates a cluster's resource-based policy when a client connects
(measured, eu-west-1): an explicit Deny that applies to the caller refuses
the connection with the hint "User: <caller> is not authorized to perform:
dsql:<action> on resource: <cluster ARN> with an explicit deny in a
resource-based policy", under the statement's conditions, aws:PrincipalArn
and aws:SourceIp among them, and a statement that does not apply leaves the
caller's own policies to decide. With IAM enforcement on, the endpoint
checked only the caller's identity policies.
DsqlResourcePolicyProvider supplies a cluster's policy through
ResourcePolicyProviders, as the SNS and Lambda providers do, and the
endpoint evaluates it with the caller's policies and SCPs as
LambdaTaskAuthorizer and LambdaWebIamAuth evaluate a function's policy:
evaluateResourcePolicyFor, then evaluateResolvedResourcePolicy, with the
client's address as aws:SourceIp. With enforcement off nothing is
evaluated, as for every other policy in Floci.
DsqlService already built the cluster policy's context for the lockout
check and the "is not authorized" sentence for the tag refusals; both now
come from DsqlPrincipals (policyContext, notAuthorized), which the endpoint
uses too, instead of a third copy.
The policy also governs control plane calls on DSQL (measured), but Floci's
IAM enforcement names DSQL's control plane resources as *, so that is left
as it is.
A bucket with Object Lock is versioned for good. PutBucketVersioning
with Suspended on such a bucket now answers 409 InvalidBucketState and
leaves it Enabled, and PutObjectLockConfiguration on a bucket whose
versioning is unset or suspended answers 409 InvalidBucketState and
enables nothing, matching the AWS-recorded messages. CloudFormation goes
through the same PutBucketVersioning path, so an update that suspends a
locked bucket rolls back.
Both checks run with the write under the bucket monitor, and CreateBucket
with Object Lock now enables versioning and the lock in one step, so no
concurrent request can leave a locked bucket suspended.
Buckets stored in either state by an earlier release load as they were;
the null-version protection for them is unchanged, and its tests now set
that state on the stored bucket.