Commit Graph
42 Commits
Author SHA1 Message Date
lex00 40e8aad55a feat(lambdamicrovms): AWS Lambda MicroVMs service module and its CloudFormation types (#2079)
* feat(lambdamicrovms): AWS Lambda MicroVMs service module

Adds the Lambda MicroVMs control plane, a service AWS took GA on 2026-06-22:
MicroVM images with a version and build lifecycle, the managed base-image
catalog, MicroVM CRUD, and VPC egress network connectors.

Two service models rather than one. Lambda Microvms (apiVersion 2025-09-09)
carries images and MicroVMs under /2025-09-09; Lambda Core (2026-04-30)
carries network connectors under /2026-04-04. Both sign as lambda, so their
requests arrive under the existing lambda claim in ResolvedServiceCatalog and
route by path. Neither prefix collides with anything LambdaController serves,
and both are enabled by the lambda service rather than adding a toggle.
Tagging rides the classic /2017-03-31/tags/ routes, so LambdaTagController
learns the MicroVM ARN forms.

Resources are stored per account and region. Floci resolves a per-request
account in AccountContextFilter and these ARNs carry it, so region-only
storage would let two accounts sharing a region read and mutate each other's
images, MicroVMs and connectors.

Wire shapes come from the vendored service models and, where the models are
silent or disagree with the service, from responses recorded against live
AWS. Several members the models mark optional are enforced in practice — a
connector needs ClientToken, OperatorRole, NetworkProtocol and
AssociatedComputeResourceTypes despite all four being optional in Smithy — and
several resources are returned in a different projection per operation: an
image in four shapes, a connector in four, with only the list summaries
carrying Type.

Builds converge instantly rather than on a timer, the usual emulator trade.
Where that would otherwise produce an inconsistent body it is handled
explicitly: a create or update reports the transitional state and does not
name the version it is minting as active, because a client reading otherwise
would launch a MicroVM off a version that does not exist yet.

Auth tokens, the per-VM endpoint, and the idle and suspend timers are
deliberately out of scope here; they belong to a full-fidelity MicroVMs
emulator rather than to CloudFormation provisioning.

Verified against a suite of responses recorded from live AWS
(https://github.com/INTENTIUS/m80): 26 checks over the image, MicroVM and
connector lifecycles, 0 failures.

* feat(cloudformation): provision AWS::Lambda::MicrovmImage and AWS::Lambda::NetworkConnector

Registers a CfnResourceProvisioner for the two MicroVM CloudFormation types
against the LambdaMicrovmsService added alongside, so a template declaring
either provisions and deletes rather than being skipped.

Uses the CloudFormationResourceRegistry interface rather than the switch in
CloudFormationResourceProvisioner, following SqsCfnProvisioner.

* test(lambdamicrovms): AWS CLI compatibility coverage for images, MicroVMs and connectors

* fix(lambdamicrovms): wire service state through StorageFactory

Images, MicroVMs and connectors were held in plain in-memory maps, so in
persistent mode a restarted Floci lost them while the CloudFormation stacks that
created them survived. Those stacks then referenced resources that no longer
existed and DeleteStack failed on the 404.

The three stores are now StorageBackedMap over StorageFactory backends, keyed
region/id. MicroVMs are delivered as part of the lambda service, so they share
its storage key and therefore its configured mode and flush interval rather than
declaring their own. The account half of the key is dropped from the service and
left to the backend, which prefixes and strips the same account the
RegionResolver returns, so region and account isolation are unchanged.

StorageBackedMap only marks the backend dirty on put and remove, so every path
that mutated a stored object in place now writes it back: image update, version
status, version delete, rebuild, MicroVM settle and terminate, connector settle
and update, and both tag paths.

* style(core): import the lambda microvms controllers in the service catalog

* fix(lambdamicrovms): register the persisted types for reflection

Moving images, microvms and connectors into StorageBackedMap made their model
classes persisted types, and PersistedModelReflectionTest fails on any that lack
@RegisterForReflection because native-image persistence cannot rebuild them on
restart.
2026-08-10 23:10:48 -05:00
Priamo Germosen d78520d5cb feat(kinesisanalytics): add Managed Service for Apache Flink (Kinesis Analytics V2) (#1914)
* feat(kinesisanalytics): add Managed Service for Apache Flink (Kinesis Analytics V2)

Adds the kinesisanalyticsv2 service (X-Amz-Target KinesisAnalytics_20180523.*):
a control-plane state machine plus a real Apache Flink JobManager container spun up
as a sidecar on StartApplication, modeled on the AmazonMQ->RabbitMQ pattern.

- CreateApplication -> READY, StartApplication -> STARTING -> RUNNING via a readiness
  poller, StopApplication -> READY, DeleteApplication -> removed
- Container image chosen from the requested RuntimeEnvironment (FLINK-1_15..1_20 ->
  apache/flink:1.x) via KinesisAnalyticsRuntimes, with an optional operator override;
  unsupported runtimes (SQL / Zeppelin) rejected with InvalidArgumentException
- Container naming via ContainerStorageHelper.resourceName (floci-kinesisanalytics-<name>)
- Registered in ResolvedServiceCatalog, dispatched by AwsJson11Controller; container
  teardown wired into EmulatorLifecycle.onStop
- Tests: service + handler unit tests, @QuarkusTest integration, Java SDK compatibility test
- Docs: service page, services index, README, environment-variable reference

* fix(kinesisanalytics): enforce delete/update state and version/timestamp guards

Addresses review feedback (self-review + Greptile) on the Managed Flink service:

- DeleteApplication rejects a non-READY (RUNNING/STARTING) application with
  ResourceInUseException; the caller must StopApplication first (Greptile P1)
- DeleteApplication validates the required CreateTimestamp against the stored value
- UpdateApplication validates CurrentApplicationVersionId (ConcurrentModificationException
  on mismatch, InvalidArgumentException when absent)
- StopApplication error message reads 'RUNNING or STARTING' to match the guard
- Readiness poller @PreDestroy awaits termination (bounded) before returning so a
  mid-flight write cannot race the shutdown storage flush
- Drop the unused Tags field from FlinkApplication (full tag support tracked as a follow-up)
- Compat test @AfterAll logs tolerated teardown failures (AGENTS.md) and stops before delete

Tests updated accordingly and verified live against the packaged jar.

* feat(kinesisanalytics): deploy and run the application JAR on the Flink cluster

Implements real job submission for Managed Service for Apache Flink, so the AWS
'deploy a JAR' flow actually runs the job (previously only a bare JobManager reached RUNNING):

- CreateApplication parses and stores ApplicationConfiguration (ApplicationCodeConfiguration
  S3ContentLocation + ParallelismConfiguration); DescribeApplication echoes it back as
  ApplicationConfigurationDescription
- StartApplication reads the JAR from Floci's local S3 (via S3Service), starts a JobManager plus a
  TaskManager (sharing the JobManager network namespace for localhost RPC), then uploads and runs the
  JAR via the Flink REST API (new FlinkRestClient); the app reaches RUNNING when the Flink job is RUNNING
- StopApplication cancels the job and tears down both containers
- Applications created without code still come up as a bare cluster
- Docs + README updated; unit tests for config round-trip; verified live end-to-end against the
  packaged jar (S3 JAR -> RUNNING Flink job -> stop/delete cleanup)

Not yet emulated: EnvironmentProperties injection, snapshots/savepoints, in-place code updates.

* fix(kinesisanalytics): align Flink runtimes with AWS and add the 2.x line

The runtime map now mirrors the runtimes AWS Managed Service for Apache Flink actually offers:

- Add FLINK-2_0 / 2_1 / 2_2 / 2_3 -> apache/flink:2.0/2.1/2.2/2.3 (the Flink 2.x line; FLINK-2_2 is in
  the AWS SDK RuntimeEnvironment enum and the whole 2.x line has published apache/flink images)
- Remove FLINK-1_16 / FLINK-1_17 -> AWS does not offer these runtimes, so Floci should reject them too
  rather than accept versions real AWS refuses

Supported set: FLINK-1_15, 1_18, 1_19, 1_20, 2_0, 2_1, 2_2, 2_3. Tests + docs + README updated.

* test(kinesisanalytics): cover both Flink 1.18 and 2.3 in the SDK compat test

Refactor the single-runtime compat test into an abstract ordered lifecycle run against two
runtimes, so the suite guards both the Flink 1.x and 2.x lines (Flink 2.0 changed the config
system and boots slower):

- AbstractKinesisAnalyticsV2LifecycleTest: PER_CLASS instance state + the create->start->RUNNING->
  list->stop->unsupported->delete lifecycle, parameterized on an abstract runtime()
- KinesisAnalyticsV2Flink118Test (FLINK-1_18) and KinesisAnalyticsV2Flink23Test (FLINK-2_3)
- FLINK-2_3 is passed as a string (newer than the pinned SDK 2.44.14 enum) and asserted via
  runtimeEnvironmentAsString(); RUNNING wait bumped to 300s for Flink 2.x's slower boot

Verified live: both subclasses boot real apache/flink:1.18 and :2.3 clusters and reach RUNNING
(0 skipped). CI now exercises two clusters; both skip gracefully when Docker is unavailable.

* fix(kinesisanalytics): preserve AwsException from a bad application-code S3 location

StartApplication's catch(RuntimeException) wrapped every failure from startCluster into
InternalFailureException (HTTP 500) — including the AwsException that readJar throws when the
application-code S3 object is missing/empty/unreadable. A client's bad S3 code location therefore
surfaced as a 500 server error instead of the intended InvalidArgumentException (400).

Now AwsException propagates as-is (preserving its error code and message); only unexpected
RuntimeExceptions (e.g. Docker unavailable) become InternalFailureException. Addresses Greptile P1.

* feat(kinesisanalytics): add resource tagging (TagResource/UntagResource/ListTagsForResource)

Adds Tags support to CreateApplication plus TagResource, UntagResource, and
ListTagsForResource, dispatched as regular JSON1.1 actions under the same
KinesisAnalytics_20180523 target prefix as every other action — verified
against the real botocore kinesisanalyticsv2 model that this API has no
separate REST tagging endpoint (protocol is pure "json"/1.1 with all
operations on POST /), unlike REST-JSON services (EKS, MWAA) that use the
shared /tags/{arn} controller.

Tags is a list of {Key, Value} objects on the wire (not a map), same shape
MemoryDB's handler already uses for its own tagging actions; mirrored that
parse/build pattern rather than the map-shaped TagHandler interface. Tags
are stored on FlinkApplication but, matching the real API, never echoed in
ApplicationDetail (CreateApplication/DescribeApplication) — only
ListTagsForResource returns them. TagResource enforces AWS's 50
user-defined-tag ceiling (TooManyTagsException) on both CreateApplication
and TagResource.

docs/services/kinesisanalytics.md's action table is auto-generated from the
handler source (tools/docs/regen_action_docs.py) — regenerated it and filled
in the three new rows' hand-written descriptions.

* feat(kinesisanalytics): inject EnvironmentProperties into the Flink cluster

CreateApplication now accepts ApplicationConfiguration.EnvironmentProperties
.PropertyGroups and writes them to /etc/flink/application_properties.json in
both the JobManager and TaskManager containers before the job runs — the
same well-known path and JSON shape (a list of {PropertyGroupId, PropertyMap}
objects, matching the AWS API's own PropertyGroups shape) real Managed
Service for Apache Flink uses, so a JAR written against
KinesisAnalyticsRuntime.getApplicationProperties() picks them up unmodified
against Floci. DescribeApplication echoes them back under
ApplicationConfigurationDescription.EnvironmentPropertyDescriptions
.PropertyGroupDescriptions.

/etc/flink does not exist in the stock apache/flink image, and the
container's non-root "flink" user (uid 9999) can't create it directly under
/etc (confirmed live: mkdir -p /etc/flink fails with permission denied as
that user). The fix, also verified live: name the tar entry
"flink/application_properties.json" and extract into the existing /etc
rather than targeting /etc/flink directly — the daemon-level copy API can
create the missing subdirectory as part of unpacking the archive even
though the in-container user couldn't, landing as root:root 775 (so it's
still world-readable by the flink user). A real apache/flink:1.18 container
was used to verify both the failure mode and the fix before writing the
Java implementation.

* feat(kinesisanalytics): add application snapshot (savepoint) support

Adds CreateApplicationSnapshot/DescribeApplicationSnapshot/ListApplicationSnapshots/
DeleteApplicationSnapshot. Triggers a real Flink savepoint of the running job and
polls it to completion the same way StartApplication polls job readiness. Snapshot
files land on a persistent named Docker volume mounted at /opt/flink/savepoints in
the JobManager container, so they survive a Stop/Start cycle; the volume is only
removed on DeleteApplication.

* feat(kinesisanalytics): support in-place application code updates

UpdateApplication with a new ApplicationCodeConfigurationUpdate (or
ParallelismConfigurationUpdate) now redeploys onto an already-running application
without tearing down its JobManager/TaskManager containers: the current job is
cancelled and the new JAR is uploaded and run on the same cluster, transitioning
RUNNING -> STARTING -> RUNNING the same way StartApplication submits a fresh job.
Updating a READY application just stores the new code location for the next
StartApplication. Attaching code to a running bare cluster for the first time is
not yet supported and is rejected with InvalidRequestException.

* fix(kinesisanalytics): use AWS's documented generic InternalFailure code

startApplication and updateApplication's redeploy-code path threw an invented
"InternalFailureException" for unexpected Docker provisioning failures — not a
shape kinesisanalyticsv2's model declares (no operation in this API declares any
5xx shape at all). AWS documents "InternalFailure" (no "Exception" suffix, HTTP
500) as the generic error common to every service's API; it's also already the
default used elsewhere in this codebase (JsonErrorResponseUtils, KMS, Pricing,
SES, CloudControl, EventBridge, and others).

* feat(kinesisanalytics): add CreateApplicationPresignedUrl and SnapshotsEnabled

CreateApplicationPresignedUrl returns a URL to the running application's Flink
Dashboard (UrlType: FLINK_DASHBOARD_URL only; Zeppelin/Studio isn't supported).
Floci has no real session/proxy layer for this, so it returns the JobManager
container's own REST/dashboard URL directly, while still validating UrlType and
SessionExpirationDurationInSeconds against AWS's documented constraints.

ApplicationSnapshotConfiguration.SnapshotsEnabled (default true, matching real
AWS) is now honored on CreateApplication and toggleable via UpdateApplication's
ApplicationSnapshotConfigurationUpdate; CreateApplicationSnapshot rejects the
request with InvalidRequestException while disabled.

* fix(kinesisanalytics): persist flinkJobId as soon as the job is submitted

The readiness poller only called putApplication when advanceToRunning reported
RUNNING, not when it merely assigned flinkJobId after submitting the job (which
returns false until the job state catches up). pendingJars — a separate,
in-process-only cache — is already cleared by that point, so an emulator
restart between job submission and reaching RUNNING would leave the
application stuck: no persisted flinkJobId to resume polling, and no cached
JAR left to resubmit.
2026-08-09 15:01:30 -04:00
Priamo Germosen 7e4e3e8c50 feat(mwaa): add Amazon MWAA emulation backed by real Airflow (LocalExecutor) (#2086)
* feat(mwaa): add Amazon MWAA emulation backed by real Airflow (LocalExecutor)

Adds a new services/mwaa package following the EKS lifecycle pattern
(Controller/Service/EnvironmentManager, one Docker container-set per
resource, readiness polling) and the Neptune/ElastiCache proxy pattern
(MwaaWebProxy/MwaaProxyManager: Floci owns the host-facing port, the
backing container stays internal-only).

Each environment is backed by two real containers — postgres:16-alpine
for the metadata DB and apache/airflow:<version>-python3.12 running
LocalExecutor — with AirflowVersion genuinely selecting the image tag
(validated against a configured allow-list), unlike EKS's cosmetic-only
version field. MwaaWebProxy fronts the real Airflow webserver and
intercepts POST /aws_mwaa/cli, bridging it to a docker-exec'd `airflow`
CLI call and returning the documented {stdout, stderr} shape.

DAGs and requirements.txt sync from S3 on a poller, reusing the existing
S3Service in-process rather than a new AWS-facing surface. The Airflow
container is pointed back at Floci via LaunchedContainerAwsEnv (the same
mechanism Lambda/ECS containers already use), so a DAG's own boto3 calls
resolve against Floci instead of real AWS.

StartupScriptS3Path is supported end-to-end: fetched from S3 at create
time, injected before the container starts (create -> inject -> start,
mirroring EksClusterManager's config-injection sequencing), sourced
before migrate/scheduler/webserver so exported vars propagate. The
airflow user gets a passwordless sudo grant (verified against the real
image — sudo ships but isn't passwordless by default, and AWS's own
startup-script examples assume sudo just works), and a fixed set of
Floci-critical env vars (Fernet key, DB DSN, executor, AWS-SDK-redirection
vars) are snapshotted before and restored after the script runs, mirroring
real MWAA's reserved-environment-variable protection.

Verified end-to-end against real Docker (not just the mock=true unit
suite): environment reaches AVAILABLE, proxy pass-through and the CLI
bridge both work with real output, a DAG uploaded to S3 syncs and parses,
a second environment on a different AirflowVersion pulls a genuinely
distinct image, and delete tears down both containers/volumes and the
proxy cleanly.

45 new tests (unit + RestAssured integration, all against mock=true in
the default suite so Docker is never required for `mvnw test`); full
suite otherwise unchanged.

* fix(mwaa): hard-fail startup-script injection failures, release proxy ports on delete

Two issues from review:

copyFileIntoContainer swallowed every failure identically, including the
one case where that's wrong: a configured StartupScriptS3Path that fails
to copy into the container. The entrypoint's "if [ -f /startup.sh ]"
guard would silently skip it and the environment would reach AVAILABLE
having never applied the requested setup, contradicting the documented
intent of gating environment creation on startup-script failure (matching
real MWAA). copyFileIntoContainer now reports success/failure; the
startup-script call site checks it and throws, while DAG sync and the
best-effort sudoers grant keep their existing soft-fail behavior.

deleteEnvironment allocated a proxy port via PortAllocator on create but
never released it on delete, unlike every other service that uses
PortAllocator (Lambda, MSK, EC2, ECR) — repeated create/delete cycles
would eventually exhaust the configured proxy port range even with zero
MWAA proxies actually running.

* fix(mwaa): roll back allocated proxy port and containers on create failure

If startEnvironment() succeeded (containers running) but PortAllocator.allocate
or MwaaProxyManager.startProxy failed afterward, createEnvironment's catch
block set CREATE_FAILED without releasing the reserved port or stopping the
containers that had already started — leaking both on every such failure.

Mirrors NeptuneService.createDbCluster/rollbackDbCluster's already-proven
shape for this exact class of problem (container + proxy + port, partial
failure must roll back everything): a provisioned flag set only after every
step succeeds, and a try/finally that runs rollbackFailedCreate whenever it
doesn't — stopping the proxy (a no-op if it never started), stopping any
containers that did start (MwaaEnvironmentManager.stopEnvironment already
null-checks each container id, so it's safe for partial startup too), and
always releasing the port.

* fix(mwaa): correct CreateEnvironment error shape, namespace container names, add docs

Two items from maintainer review:

- Duplicate CreateEnvironment threw ResourceAlreadyExistsException, a shape the
  operation doesn't declare (verified against the real botocore mwaa/2020-07-01
  model: CreateEnvironment's only errors are ServiceUnavailableException,
  ValidationException, InternalServerException) — SDK clients couldn't map it.
  Now throws ValidationException.

- dbContainerName/airflowContainerName built names via raw string concatenation
  instead of routing through ContainerStorageHelper.dockerName like every other
  Docker-backed service (EKS, RDS, ...), so MWAA alone didn't participate in the
  FLOCI_DOCKER_RESOURCE_NAMESPACE convention that keeps multiple Floci instances
  sharing one Docker daemon from colliding. Both static methods now take the
  EmulatorConfig and route through the shared helper; volume names inherit the
  fix automatically since they're built by extending the container name.

Also adds docs/services/mwaa.md (mkdocs nav updated) following eks.md's
structure — operations table, mock/real mode, the web/CLI proxy, startup-script
behavior (sudo grant, reserved-variable protection), config reference, ARN
format, CLI/SDK examples, and an honest "Not Implemented" section covering the
known gaps already discussed on the PR (PluginsS3Path, cross-account container
naming, restart restoration).
2026-08-04 22:16:14 -05:00
Alex Bannaandabanna aadc93e306 feat(rum): add CloudWatch RUM app-monitor service (#1797)
* feat(rum): add CloudWatch RUM app-monitor service

Adds a minimal CloudWatch RUM service (restJson1) covering the app-monitor
lifecycle — CreateAppMonitor, GetAppMonitor, UpdateAppMonitor, DeleteAppMonitor,
ListAppMonitors — backed by an in-memory store.

Previously restJson1 RUM requests (e.g. POST /appmonitor) fell through to the S3
path-style catch-all (@Path("/{bucket}")) and returned an XML error that
restJson1 SDKs (and the CDK AwsCustomResource used for RUM AppMonitor custom
resources) cannot parse. Literal /appmonitor and /appmonitors paths take JAX-RS
precedence over S3's /{bucket} template (the same mechanism eks/mq use), so the
routes win with no extra routing wiring.

Verified with aws-cli 2.33.18 against a dev-mode emulator: CreateAppMonitor
returns an Id, GetAppMonitor/ListAppMonitors round-trip, DeleteAppMonitor then
GetAppMonitor returns ResourceNotFoundException.

* fix(rum): make monitor updates atomic

* fix(rum): align app monitor lifecycle with AWS

* chore: retry flaky Node compatibility check

* fix(rum): address app-monitor review feedback

---------

Co-authored-by: abanna <abanna@users.noreply.github.com>
2026-08-01 15:28:54 -05:00
Guilherme Lima 024d74e5c4 feat(cloudtrail): in-process CloudTrail with S3 data event emission (#1460)
* feat(cloudtrail): in-process CloudTrail with S3 data event emission

New service supporting CreateTrail / DescribeTrails / DeleteTrail /
UpdateTrail / PutEventSelectors / GetEventSelectors / StartLogging /
StopLogging / GetTrailStatus.

S3 ops (PutObject / GetObject / HeadObject / DeleteObject / ListObjects
/ GetObjectAcl) emit CloudTrail data events through a per-trail buffer.
The CloudTrailLogWriter scheduler flushes pending records as gzipped
JSON envelopes into the destination bucket at AWS-shaped key paths
(AWSLogs/<account>/CloudTrail/<region>/yyyy/MM/dd/<file>.json.gz) on
a configurable cadence (default 60s).

IAM-enforcement denials emit matching AccessDenied records by hooking
IamEnforcementFilter. IamActionRegistry now distinguishes
s3:GetObjectAcl / PutObjectAcl / {Get|Put|Delete}ObjectTagging from
their base ops via ?acl / ?tagging query parameters so the right
event names land in the trail.

Seeded AWSCloudTrail_FullAccess / _ReadOnlyAccess managed policies.

* fix(cloudtrail): return LatestDeliveryTime in GetTrailStatus after StartLogging

The sdk-test-java compatibility test asserts latestDeliveryTime() is
non-null immediately after startLogging. Seed it with the startLoggingTime
so the field is always present once logging has been started.

* fix(cloudtrail): emit SnsTopicARN alongside SnsTopicName in CreateTrail/UpdateTrail responses

Accept both SnsTopicARN and SnsTopicName on input (SnsTopicARN takes
precedence). Emit both fields on output so clients reading the current
field name (SnsTopicARN) get a non-null value.

* fix(cloudtrail): wildcard S3 ARN matching, trail name validation, LookupEvents

- matchesS3DataResourceArn: handle bare "arn:aws:s3", "arn:aws:s3:::*", and
  "arn:aws:s3:::*/*" wildcard forms so trails configured via the AWS Console
  "capture everything" selector actually record events (previously fell through
  silently). Unit tests added to CloudTrailSelectorMatchingTest.

- createTrail: enforce AWS trail name rules (3–128 chars, start/end with letter
  or digit, only letters/numbers/./_/-). Integration tests in new
  CloudTrailNameValidationTest.

- CloudTrailJsonHandler: add LookupEvents stub returning an empty Events array,
  matching upstream's addition in #1603.

* fix(cloudtrail): log empty catches, key selectors/logging by trail home region

- CloudTrailLogWriter.stop(): log at WARN instead of silently swallowing the
  final-flush exception (AGENTS.md: never leave a catch block empty).

- CloudTrailService.putEventSelectors / getEventSelectors / startLogging /
  stopLogging / getTrailStatus: use trail.homeRegion() as the storage key
  instead of the request region. Previously a cross-region call (e.g. accessing
  a trail by ARN from a different-region endpoint) stored selectors and logging
  state in the wrong region's map, so trailsMatching() found an empty selector
  list and logging never fired.

- S3Controller.emitCloudTrailEvent / IamEnforcementFilter.emitS3DenialIfApplicable:
  replace empty inner catch blocks with LOG.tracev() so unexpected failures
  during request-context extraction surface at trace level.

* fix(iam): distinguish bucket-level vs object-level ?acl / ?tagging IAM actions

resolveS3SubResourceAction was always mapping ?acl and ?tagging to object-level
actions (s3:PutObjectAcl, s3:GetObjectAcl, etc.) regardless of path depth.
A PUT /{bucket}?acl request requires s3:PutBucketAcl, not s3:PutObjectAcl —
callers with the correct bucket-level permission were incorrectly denied.

Fix: inspect the URL path after stripping the leading slash. When there is no
slash (or the path ends with one), the target is a bucket; otherwise it is an
object. Applies to all six variants: GetBucketAcl, PutBucketAcl,
GetBucketTagging, PutBucketTagging, DeleteBucketTagging (and their object
counterparts).

* fix(cloudtrail): re-queue records on flush failure instead of dropping them

drainPendingRecords atomically dequeues all records before the S3 write.
If serializeAndGzip or s3Service.putObject threw, those records were gone —
permanently lost before the re-throw reached flushAll.

Fix: wrap the serialize+write block in a try-catch that calls requeueRecords
before rethrowing. Records are added back to the tail of the queue and will be
retried on the next flush cycle. The new CloudTrailService.requeueRecords helper
also makes the re-queue path unit-testable independently of flushTrail.

* fix(s3): emit GetObjectAcl error record under correct event name

getObjectAcl was called inside the outer GET-object try block. On any
AwsException (NoSuchKey, AccessDenied, etc.) the catch at the bottom fired
and emitted a GetObject error record. CloudTrail consumers auditing ACL
errors would see the wrong event name.

Wrap the acl branch in its own try-catch that emits GetObjectAcl on both
success and failure paths, mirroring the pattern used by the other hooked ops.

* ci: retrigger

* fix(test): pass CloudTrailService and CurrentVertxRequest to IamEnforcementFilter constructor

* fix(cloudtrail): persist trail state via StorageFactory instead of volatile in-memory maps

* fix(cloudtrail): address review feedback on region, name lookup, and ACL detection

- S3Controller: use request region (from credential scope) instead of
  getDefaultRegion() for CloudTrail event emission, matching the IAM
  denial hook behaviour so allowed and denied calls land in the same trail.

- CloudTrailService.findTrail: name lookup now uses regionKey(region, name)
  directly; ARNs still do a cross-region scan. Prevents two same-name
  single-region trails from resolving ambiguously by map iteration order.

- TrailKey: add eventRegion field so multi-region trail events are written
  to the correct S3 delivery path (CloudTrail/<eventRegion>/) rather than
  always the trail home region. drainPendingRecords/requeueRecords now take
  a TrailKey to carry all three dimensions.

- IamActionRegistry: fix isBucketLevel — trailing slash is a valid S3 key
  character, so /bucket/folder/?acl is an object ACL request. Replaced the
  endsWith("/") check with an index-based test. Add IamActionRegistryTest
  cases for the folder/ regression.

* docs(cloudtrail): sync action table order with make docs-sync
2026-07-21 12:10:19 -04:00
kotov228 97b64a1d3b feat: add AWS Lightsail emulation (#1583)
* feat(lightsail): add AWS Lightsail emulation

* fix(lightsail): align error responses with AWS

* fix(lightsail): address review edge cases

* fix(lightsail): reject attached disk reattach

* fix(lightsail): reject static ip reattach

* fix: register lightsail docs handler
2026-07-10 20:43:42 -05:00
nblomquistandnathan 326b495496 feat(iot) Feature/issue 1038 iot core (#1359)
* feat: add IoT endpoint and thing registry

* feat: add IoT thing tagging

* feat: add IoT certificates and shadows

* feat: add IoT MQTT broker

* feat: upgrade IoT MQTT broker to Moquette 0.18

* feat: restore IoT reserved MQTT topics

* feat: add IoT topic rules engine

* feat: improve IoT thing registry compatibility

* feat: complete IoT MVP 1 compatibility

* feat: complete IoT MVP 2 compatibility

* feat: finish IoT MVP 2 coverage

* fix: disable IoT MQTT broker persistence

* fix(docker): include vendored Maven artifacts in source builds

* fix(iot): stabilize MQTT integration test sockets

* fix(iot): verify MQTT test connections

* fix(iot): use Paho for MQTT integration tests

* fix(iot): use Vert.x MQTT broker

---------

Co-authored-by: nathan <nathan@debian-dev-small.localdomain>
2026-06-25 22:58:44 -05:00
kotov228 efacb37130 feat: Adds initial Elastic Beanstalk Query API support to Floci. (#1362)
* feat: add Elastic Beanstalk query API support

feat: add Elastic Beanstalk query API support

* fix(elasticbeanstalk): configure native-image runtime initialization

* fix(elasticbeanstalk): align missing parameter errors and add application ARN

* test(elasticbeanstalk): add Java SDK compatibility coverage
2026-06-25 19:16:51 -05:00
kotov228 3f314dcb4e feat(codepipeline): add AWS CodePipeline emulation (#1469)
* feat(codepipeline): add AWS CodePipeline emulation

* fix(codepipeline): align webhook and rollback response shapes
2026-06-21 09:01:44 -05:00
Ahmed khaled fd904bc409 feat(memorydb): add MemoryDB service with mock mode (#1420)
* feat(memorydb): add MemoryDB service with mock mode

Adds Amazon MemoryDB for Redis as a Docker-backed service, modelled on
the existing ElastiCache and DocumentDB services.

Control plane is AWS JSON 1.1 (X-Amz-Target: AmazonMemoryDB.*) dispatched
from AwsJson11Controller, supporting CreateCluster, DescribeClusters,
UpdateCluster, DeleteCluster, ListTags, TagResource and UntagResource.

The data plane reuses ElastiCache's RESP proxy and SigV4 validator, since
MemoryDB is Redis wire-compatible: each cluster starts a real Valkey/Redis
container and an auth proxy forwards client connections to it.

A mock mode (FLOCI_SERVICES_MEMORYDB_MOCK, default false) tracks clusters
as control-plane-only resources without starting a container, so IaC tools
like Terraform and OpenTofu can run where no Docker socket is available.
This mirrors the existing DocumentDB mock flag.

Includes service unit tests and documentation.

* fix(memorydb): return UnknownOperationException for unsupported actions

Unrecognised JSON 1.1 actions returned InvalidParameterValueException,
which mis-signals the error category and can break SDK/CLI probing.
Use UnknownOperationException to match CloudMap and the shared
JsonErrorResponseUtils.createUnknownOperationErrorResponse helper.

* docs(memorydb): drop service-count bump from this PR

The 55->56 edit was built on a stale baseline (main's count does not
reflect already-merged services) and conflicts with a separate docs
branch. Keep the MemoryDB matrix row; leave the headline count to a
dedicated docs PR. No functional change.

* fix(memorydb): use InternalFailure for unexpected errors

Align the generic exception path with Floci's JSON 1.1 convention and the
shared JsonErrorResponseUtils.createErrorResponse helper, which emit
InternalFailure for unexpected server errors. SDKs commonly key on this.

* fix(memorydb): copy AuthToken onto cluster spec on CreateCluster

CreateCluster resolved AuthMode.PASSWORD from the presence of AuthToken
but never copied the token onto the spec, so the service stored a null
token and password auth always failed. Copy AuthToken onto the spec and
add MemoryDbHandlerTest covering token propagation and the NO_AUTH default.

* fix(memorydb): validate cluster name to avoid NPE on null key

getCluster passed the name straight to the ConcurrentHashMap-backed
storage, so a null/blank name (reachable via UpdateCluster/DeleteCluster
without ClusterName) threw a NullPointerException surfaced as a 500.
Guard with an AWS-style InvalidParameterValueException (400), matching
CreateCluster, and add a regression test.

* fix(memorydb): roll back proxy port and container on failed provisioning

If container or proxy startup failed after allocating a proxy port, the
port stayed reserved (and any started container orphaned), eventually
exhausting the range with InsufficientClusterCapacity. Extract backend
startup into startBackend with best-effort rollback that stops the proxy
and container and always releases the port. Add a regression test proving
the port is reclaimed after a failed create.

* fix(memorydb): stop proxies and containers on emulator shutdown

MemoryDbProxyManager.stopAll and MemoryDbContainerManager.stopAll were
never invoked from EmulatorLifecycle.onStop, so MemoryDB clusters left
bound TCP proxy ports and running containers after shutdown. Wire both
managers into onStop alongside the existing ElastiCache and RDS cleanup.

No test: shutdown DI wiring is not meaningfully testable in isolation.

* test(memorydb): update EmulatorLifecycleTest for new constructor params

The shutdown-wiring change added MemoryDb container/proxy managers to the
EmulatorLifecycle constructor; update the direct constructor call in the
unit test to pass the two new mocks.

* test(memorydb): add Docker-backed integration test

End-to-end coverage mirroring ElastiCacheIntegrationTest: JSON 1.1 control
plane (CreateCluster/DescribeClusters/DeleteCluster) plus the real RESP
data plane through a Valkey container and the auth proxy. Covers no-auth
connectivity (PING/SET/GET), password auth (AUTH token accepted, wrong
token and unauthenticated commands rejected), and proxy-port reuse after
delete. Gated on Docker availability via an assumption.

* docs(memorydb): clarify mock endpoint uses configured hostname

Mock mode reports <hostname>:6379 (from floci.hostname / FLOCI_HOSTNAME,
defaulting to localhost), not always localhost. Update the Mock Mode note
so users with a custom hostname aren't surprised.

* fix(memorydb): use correct InsufficientClusterCapacityFault error code
2026-06-20 11:45:37 -05:00
Ahmed khaledandHector Ventura d77f11abbb docs(docdb): document DocumentDB service (#1386)
* docs(docdb): document DocumentDB service

* docs(docdb): clarify data endpoint port is from DescribeDBClusters

* docs: align AWS service count to 56 across docs and README

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-06-17 00:01:23 -05:00
Hector Ventura 717769857b docs: correct service count to 58 and add EMR, WAF v2, CloudTrail pages (#1398)
Reconcile inconsistent service counts (55/54/41) to 58 distinct services across the README, docs index, services overview, and the LocalStack migration guide. Add the missing per-service pages and Service Matrix rows for EMR, WAF v2, and CloudTrail, and wire them into the mkdocs nav and README service tables.
2026-06-16 18:57:37 -05:00
devansh-jain-18 022436eaae feat(batch): add AWS Batch service support (#1332) 2026-06-14 19:45:15 -05:00
devansh-jain-18 e063ac18ee feat(rds-data): add RDS Data API support (#1262)
* feat(rds-data): add RDS Data API support

* fix(rds-data): harden Data API validation

* fix(rds-data): harden review findings
2026-06-12 23:39:05 -05:00
Hector Ventura 446697ec71 docs: add AWS Cloud Map service docs, fix service count, add analytics (#1221)
Document AWS Cloud Map (servicediscovery), which was implemented but never
documented, and reconcile related documentation drift:

- Add docs/services/cloudmap.md covering all 22 operations, config, examples
- Bump headline service count from 52 to 53 across README and docs
- Add Cloud Map to the canonical service matrix, README tables, and docs index
- Backfill mkdocs nav with Cloud Map and 7 existing-but-unlisted service docs
- Backfill condensed tables with services missing from them (Transcribe,
  Resource Groups Tagging, Neptune, EventBridge Pipes, CloudFront)
- Add Umami analytics tracking via a Material theme override (overrides/main.html)
2026-06-07 10:44:37 -05:00
AgustinBertagna c8b0048bac docs(appsync): add AppSync service documentation (#1149)
Add documentation for AWS AppSync Management API (Phase 1) covering
33 operations across GraphQL API, Schema, DataSources, Resolvers,
Functions, Types, API Keys, Tags, and Environment Variables.

Includes pagination, cascade delete behavior, CLI examples,
and service matrix entry.
2026-06-03 17:36:32 -05:00
Hector Ventura 59befa3077 docs: add light/dark logo branding, mkdocs theming, and README badges (#1150)
Replicate the floci-gcp light/dark logo treatment with AWS orange dots,
add mkdocs branding/theming with header and logo assets, and add
shields.io badges to the README (release, build, docker, license, stars).
2026-06-02 23:06:36 -05:00
Hector Ventura a0a30a26f8 docs: add Neptune service page and fix missing index entries (#950, #951) (#1056)
- Create docs/services/neptune.md: 8 supported actions, configuration
  table (proxy ports, Docker image, network), Docker Compose snippet,
  AWS CLI + gremlin-python + boto3 examples, and Out of Scope section
- Add Neptune to mkdocs.yml nav (after Glue)
- Add Neptune row to docs/services/index.md service matrix
- Add missing EventBridge Pipes row to docs/services/index.md
2026-05-26 18:08:06 -05:00
Sid be01ee0747 docs(pipes): add documentation and navigation for EventBridge Pipes (#1001) 2026-05-23 09:29:17 -05:00
tatakaisun fa31be9cf9 docs: add resource groups tagging service docs (#976) 2026-05-21 18:20:50 -05:00
Hector Ventura b200280a83 feat(cloudfront): implement CloudFront service emulation (#969)
* feat(cloudfront): implement CloudFront service emulation

Adds full CloudFront emulation covering both core and extended operations using the REST XML protocol (2020-05-31 API).

Core resources:
- Distributions (CRUDL, copy, enable/disable, ETag concurrency)
- Cache Behaviors (default + ordered)
- Invalidations (create, get, list)
- Origin Access Controls and Origin Access Identities
- CloudFront Functions (create, update, publish, test, describe)

Extended resources:
- Continuous Deployment Policies
- Public Keys and Key Groups
- Realtime Log Configs (non-standard POST-based get/delete)
- Streaming Distributions (legacy RTMP, enforces disabled before delete)
- Field-Level Encryption Configs and Profiles
- Monitoring Subscriptions

Infrastructure:
- Registers CloudFrontController in ResolvedServiceCatalog as REST_XML
- Adds CloudFrontServiceConfig and CloudFrontStorageConfig to EmulatorConfig
- Adds CLOUDFRONT namespace constant to AwsNamespaces
- Registers CloudFrontService for GraalVM runtime initialization to avoid SecureRandom heap-baking in native builds
- Wires storage through StorageFactory with per-resource JSON files
- Adds cloudfront.md documentation page

* docs: revert docker-compose.yml
2026-05-20 23:12:03 -05:00
Hector Ventura 9e35046647 Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml
* docs: sync with main and new features
* docs: reverting docker-compose.yml
2026-05-10 11:53:31 -05:00
5befe8b619 feat: optional TLS/HTTPS support with self-signed certificate generation (#754)
* feat: optional TLS/HTTPS support with self-signed certificate generation

- Add TlsConfigSource (MicroProfile ConfigSource SPI) that injects Quarkus
  TLS properties before the HTTP server starts
- Auto-generate self-signed certificates with correct SANs including custom
  hostnames from FLOCI_HOSTNAME and FLOCI_BASE_URL
- Persist certificate metadata for change detection across restarts
- Fix CertificateGenerator to encode IP addresses as iPAddress SANs (RFC 5280)
- Serve HTTP + HTTPS simultaneously (LocalStack parity)
- Support user-provided certificates via FLOCI_TLS_CERT_PATH/KEY_PATH
- Add TLS configuration documentation
- Add Node.js SDK compatibility test for HTTPS connectivity
- Add comprehensive unit and integration tests (79 test cases)

Closes #711

* feat(tls): add TLS proxy server and WebSocket-over-TLS tests

- Add TlsProxyServer: TCP proxy on port 4566 that detects TLS ClientHello
  and routes to HTTPS (4511) or HTTP (4510) backend accordingly
- Add apigatewayv2-websocket-tls.test.ts: WSS compatibility tests covering
  connect/disconnect, route selection, broadcast, authorization,
  @connections API, binary frames, and payload size limits
- Update CI workflow to enable FLOCI_TLS_ENABLED=true for compat tests
- Update sdk-test-node Dockerfile with NODE_TLS_REJECT_UNAUTHORIZED=0
- Update tls.test.ts for HTTPS SDK client tests
- Update README with WebSocket-over-TLS test documentation

* fix(tls): address review comments — LocalStack parity and floci.io SANs

- Add USE_SSL and CUSTOM_SSL_CERT_PATH mappings to localstack-parity.sh
- Add localhost.floci.io and *.localhost.floci.io to default certificate SANs
- Update affected tests and documentation

---------

Co-authored-by: Dixit R Jain <dixitrjain@Mac-379.lan>
Co-authored-by: Dixit R Jain <dixitrjain@Mac.lan>
2026-05-10 10:21:03 -05:00
Hector Ventura c444da222c Release 1.5.13 2026-05-07 01:40:21 -05:00
Hector Ventura 023880b7d9 feat(parity): LocalStack drop-in compatibility (#696)
- Translate LocalStack env vars (LOCALSTACK_HOST, PERSISTENCE, LAMBDA_DOCKER_NETWORK, etc.)
  to Floci equivalents automatically at startup; opt out with LOCALSTACK_PARITY=false
- Serve /_localstack/init and /_localstack/health alongside /_floci/* equivalents
- Report executed scripts with path, state, and return_code in /_floci/init response
- Add /_aws/sqs/messages GET (non-destructive peek) and DELETE (purge) inspection endpoint
- Add /_aws/execute-api/{apiId}/{stageName} LocalStack-compat path for REST API invocation
- Add four-phase init hook lifecycle (boot/start/ready/stop) with dual-path discovery
  (/etc/floci/init/ and /etc/localstack/init/ compat paths)
- Install Python 3, AWS CLI, boto3 in standard image; wrap aws binary to pre-configure
  --endpoint-url=http://localhost:4566 so init scripts need no extra flags
- Wire entrypoint.sh + gosu privilege drop into all Dockerfile variants
- Add migration guide and update README, docker-compose, docker-images, SQS, and
  initialization-hooks docs
2026-05-04 01:15:59 -05:00
Hector Ventura 3c98efe615 chore: new docker image tag and compatibility (#691)
* chore: new docker image tag and compatibility
* chore: change nightly workflow schedule time
2026-05-02 22:46:25 -05:00
Hector Ventura 5b0ebb89a4 docs: adding testcontainers documentation (#680) 2026-05-02 00:52:01 -05:00
Hector Ventura 16fc5c9691 docs: updating documentation logo 2026-04-20 00:04:15 -05:00
Hector Ventura 63ed81c59d feat(eks): implement EKS service with real k3s data plane support (#493)
* feat(eks): implement EKS service with real k3s data plane support
* fix: adjusting eks volume issues
2026-04-18 01:35:25 -05:00
TiM c565398beb feat(bedrock-runtime): stub Converse and InvokeModel for #87 (#486)
Adds a bedrock-runtime service stub so AWS SDK and CLI clients can target
Floci for local development of Bedrock Runtime callers. Dummy responses
only: no real model inference.

- Register bedrock-runtime in ResolvedServiceCatalog under both "bedrock"
  and "bedrock-runtime" credential scopes (boto3 signs with signingName
  "bedrock" while some clients use the endpoint id)
- POST /model/{modelId}/converse returns a fixed assistant message plus
  synthetic usage and latency metrics matching the AWS Converse contract
- POST /model/{modelId}/invoke returns an Anthropic-shaped body for
  anthropic.* and *.anthropic.* model ids, generic {"outputs": [...]}
  otherwise. Request body is passed through as opaque bytes
- {modelId:.+} path regex accepts full ARNs (inference profiles,
  provisioned throughput) in addition to plain ids
- converse-stream and invoke-with-response-stream return 501 so SDKs
  get a clear error instead of 404
- Response building uses JsonNode rather than typed POJOs, avoiding
  native-image reflection registration

13 new integration tests (Converse + InvokeModel happy paths, validation,
inference-profile ids and ARNs, 501 streaming responses). Full suite
remains green: 2263 tests, 0 failures.
2026-04-16 17:13:17 -05:00
Hector Ventura ea597c67d6 feat: implement local Data Lake stack (Athena, Glue, and Firehose) (#429)
* feat: implement local Data Lake stack (Athena, Glue, and Firehose)
* fix: adding athena, firehose and glue documentation
* fix: updating dataLateTest
2026-04-15 01:22:10 -05:00
Hector Ventura 91071aaae7 feat: implement Amazon MSK service with Redpanda orchestration (#419)
* feat: implement Amazon MSK service with Redpanda orchestration
* fix: adding missing msk service on the test
2026-04-13 20:22:37 -05:00
Hector Ventura 788ccc8404 fix(ecr,s3): fix CDK compatibility and resolve macOS ECR port conflict (#354)
* fix(ecr,s3): fix CDK compatibility and resolve macOS ECR port conflict
* fix: remove go.mod
2026-04-11 15:32:06 -05:00
TiM a32b7f1f3b docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.

- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
  Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
  actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
  (they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
  where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
  following the 1.5.2 upstream release
2026-04-10 10:52:34 -05:00
Hector Ventura 2859d257b5 feat(ec2): add EC2 service with 61 operations, integration tests, and docs (#213)
* feat(ec2): adding ec2 service
* feat(ec2): add EC2 service with 61 operations, integration tests, and docs
2026-04-06 00:22:53 -05:00
Fred Peña 766d031b76 docs: migrate docs GitHub references to floci-io (#214)
* docs: migrate docs GitHub references to floci-io
* docs: update MkDocs site and repo metadata to floci-io
* docs: update MkDocs site_url and repository references to floci-io
2026-04-05 15:59:55 -05:00
Hector Ventura 07a7a97b47 feat(ecs): adding ecs service (#209)
* feat(ecs): adding ecs service
* feat(ecs): adding ecs service
2026-04-05 10:25:41 -05:00
Cyril Schumacher fe2480e596 docs: add SES documentation (#181)
* docs: introduce SES (Simple Email Service) documentation
* docs: integrate SES into service lists and navigation
2026-04-02 18:01:17 -05:00
Cyril Schumacher 1e2950a3aa docs: improve initialization hooks documentation (#144)
* docs: add initialization hooks to navigation

* docs: improve link label for initialization hooks

* docs: expand initialization hooks documentation with examples
2026-03-31 17:12:01 -05:00
Hector Ventura 68b8ed883a feat: add opensearch service emulation (#85) (#132) 2026-03-31 00:48:41 -04:00
Hector Ventura 286bef9dd7 fix: update git pages config for the docs 2026-03-15 21:36:06 -05:00
Hector Ventura 61433f59ab firt commit 2026-03-15 17:43:56 -05:00