Stacks lived only in memory, so after a Floci restart CloudFormation forgot every
stack and cdk deploy/destroy could no longer find them, orphaning the underlying
resources. Back the stacks and exports registries with StorageFactory
(cloudformation-stacks.json / cloudformation-exports.json): the in-memory maps stay
the live working copy with write-through at each lifecycle checkpoint and a load on
startup. Everything is stored under one fixed account namespace (CloudFormation is
account-blind), which stays consistent across request and background executor
threads. Stack/StackResource/ChangeSet/StackEvent are now reflection- and
unknown-field-tolerant for storage. Follows the configured global storage mode.
Tests cover a full stack-graph round-trip across storage instances and an
end-to-end persistent-mode write to disk.
Refs #924
Provision AWS::ECS::Cluster, AWS::ECS::TaskDefinition, and AWS::ECS::Service
through CloudFormation instead of falling through to the synthetic stub branch.
- Ref/GetAtt parity with AWS: Cluster Ref=name + Arn; TaskDefinition Ref=ARN
(immutable, each update registers a new revision); Service Ref=ARN + Name/ServiceArn.
- Delete leaves no orphans (service parsed from its ARN via AwsArnUtils, tasks stopped).
- Fills the service gaps real CDK templates need: TaskDefinition taskRoleArn/
executionRoleArn, and Service NetworkConfiguration (awsvpc subnets/security groups/
assignPublicIp) via new NetworkConfiguration/AwsVpcConfiguration models, surfaced in
DescribeTaskDefinition/DescribeServices.
Tests cover create, update (new task-def revision + desiredCount), and delete-no-orphans.
Refs #924
ImageCacheService.ensureImageExists surfaced docker-java's pull
exceptions straight to its caller on the first failure. When the
underlying registry returned a transient 5xx — most notably ECR
Public's / Docker Hub's "toomanyrequests" rate limit — this caused
the surrounding operation to fail outright even though a retry a
moment later would succeed. In CodeBuild's case it manifested as
build status FAULT (CodeBuildRunner catches the exception and sets
status=FAULT + buildComplete=true), showing up as flakes in the
sdk-test-java CI job on PRs that don't touch CodeBuild at all.
- Add runWithRetry(imageUri, maxAttempts, initialBackoffMs, attempt)
static helper that retries transient pull failures up to
MAX_PULL_ATTEMPTS=3 times with exponential backoff starting at
INITIAL_BACKOFF_MS=500ms (500ms -> 1s -> 2s). The throwable is
passed to LOG.warnv(e, ...) so the cause survives in the log
stream, matching the Floci-wide pattern (SmtpRelay,
CognitoAuthFlowHandler, etc.).
- A failure is treated as transient when either:
(a) the docker daemon throws InternalServerErrorException directly
(HTTP 500, sync path), or
(b) PullImageResultCallback.awaitCompletion rewraps the same
daemon error as DockerClientException whose message starts
with "Could not pull image: " (async-callback path; same root
cause, different exception class). Both forms have been
observed against ECR Public and Docker Hub in CI.
- isTransientPullFailure(e) helper centralizes the classification.
Permanent failures (auth, missing image, malformed request, or
any other DockerClientException not coming from the pull wrapper)
keep surfacing their original docker-java exception subclass on
the first attempt and are not retried.
- Wire ensureImageExists's existing pull invocation through the
retry helper. The synchronized-once and isLocalImagePresent
fast-path semantics are unchanged.
- New ImageCacheServiceTest covers nine cases against the static
helper (no DockerClient mocking needed): first-attempt success,
retry-then-succeed (sync InternalServerErrorException),
max-attempts-exhausted-rethrows, no-retry-on-NotFoundException,
no-retry-on-UnauthorizedException, no-retry-on-generic-
DockerException, retry-then-succeed on the pull-wrapper
DockerClientException, no-retry on an unrelated
DockerClientException (container start failure), and
InterruptedException propagated as-is.
Out of scope: NeptuneContainerManager and other container managers
that call dockerClient.pullImageCmd directly (bypassing
ImageCacheService) still hit the same rate-limit path without
retries. Routing those through ImageCacheService is a separate
refactor.
* feat(appsync): add GraphQL API management service
Implement Phase 1 CRUDL management API for AWS AppSync.
Includes controller, service layer, and model classes for:
- GraphQL API lifecycle (create/get/update/delete/list)
- Schema creation and introspection
- Data Sources, Resolvers, Functions, Types, API Keys
- Tagging and Environment Variables
* chore(appsync): register service in config and catalog
Add AppSync service configuration (EmulatorConfig), service
descriptor (ResolvedServiceCatalog), YAML config entries, and
SDK test client fixture.
* test(appsync): add integration and SDK compatibility tests
AppSyncIntegrationTest: 44 tests covering CRUDL for all resources
GraphQL API, Schema, DataSources, Resolvers, Functions, Types,
API Keys, Tags, Environment Variables, and cascade delete.
AppSyncTest: AWS SDK v2 compatibility tests for management API
operations using the real AppSyncClient.
* feat(appsync): add typed enums for AWS API models
Add Java enums matching AWS AppSync API constants:
- AuthenticationType (API_KEY, AWS_IAM, COGNITO, OIDC, LAMBDA)
- DataSourceType (NONE, LAMBDA, DYNAMODB, HTTP, EVENTBRIDGE, ...)
- ResolverKind (UNIT, PIPELINE)
- ResolverRuntimeName (APPSYNC_JS, VTL)
- TypeFormat (SDL, JSON)
- SchemaCreationStatusType (PROCESSING, ACTIVE, FAILED, ...)
* refactor(appsync): align model types with AWS API reference
- DataSource.type: String → DataSourceType enum
- GraphqlApi.authenticationType: String → AuthenticationType enum
- GraphqlApi.logConfig: String → Map<String, Object> (structured)
- GraphqlApi.additionalAuthenticationProviders: Map → List<Map> (array)
- GraphqlApi.xrayEnabled: String → Boolean
- Resolver.kind: String → ResolverKind enum
- Resolver.ResolverRuntime.name: String → ResolverRuntimeName enum
- AppSyncType.format: String → TypeFormat enum
- SchemaCreationStatus.status: String → SchemaCreationStatusType enum
- ApiKey.expires: String → Long (epoch seconds)
* fix(appsync): correct ARN format, add enum validation, fix field types
- Function ARN: add missing region parameter
- Add parseEnum() helper for type-safe enum deserialization
- Reject invalid enum values with BadRequestException (400)
- Handle String/Boolean/Number coercion for xrayEnabled, expires
- Remove extra 'details' from StartSchemaCreation response
- Pass region to createFunction from controller
* fix(appsync): validate required fields on resource creation
Reject requests missing required fields with BadRequestException (400):
- CreateGraphqlApi: name required
- CreateDataSource: name and type required
- CreateResolver: fieldName and dataSourceName required
- CreateFunction: name required
- CreateType: name required
* test(appsync): add error handling, delete standalone, and cascade tests
Add 22 new integration tests (44 → 66 total):
- Error handling: missing name, blank name, invalid enum, missing required
fields for API/DataSources/Resolvers/Functions/Types (11 tests)
- Non-existent resource 404 tests for API, DataSource, Type (3 tests)
- Delete standalone: verify CRUD delete for Resolver, DataSource,
Function, Type, ApiKey with post-delete 404 confirmation (5 tests)
- Cascade verification: API delete cascades to DataSources and Functions;
Function delete does not affect resolvers (3 tests)
* feat(appsync): add pagination support for list endpoints
Add maxResults and nextToken query params to all list endpoints:
- ListGraphqlApis, ListDataSources, ListResolvers, ListResolversByFunction
- ListFunctions, ListTypes, ListApiKeys
Uses offset-based pagination with Base64-encoded tokens, following
the Pricing service pattern. Returns nextToken when more results
are available, null when all results have been returned.
* test(appsync): add pagination integration tests
Add 9 pagination tests (66 → 75 total):
- ListApis with maxResults returns subset and nextToken
- ListApis with nextToken returns second page
- ListApis without pagination returns all items
- ListDataSources, ListTypes, ListFunctions, ListApiKeys,
ListResolvers with maxResults
- Invalid nextToken returns 400
* fix(appsync): align SDK test with AWS SDK v2 model, extract type name from SDL
- Fix SDK test: use typeAsString() for enum comparison, remove apiKey()
field assertion, use functions() instead of functionConfigurationList()
- Extract type name from SDL definition when name is not provided
(matches real AWS CreateType behavior)
- Update integration test for type creation without explicit name
* fix(appsync): use extracted type name when definition-based extraction succeeds
The type name extracted from SDL definition was stored in a local
variable but not set on the AppSyncType object, causing createType
to return a type without name and making subsequent get/delete fail.
* refactor(appsync): inject RegionResolver instead of passing region as string
Follow the established pattern used by BackupService and PipesService.
Replace manual ARN string concatenation with regionResolver.buildArn()
and remove the hardcoded accountId field.
* fix(appsync): add functionId to Resolver model and fix listResolversByFunction filtering
The listResolversByFunction endpoint was incorrectly comparing
function.getName() with resolver.getDataSourceName(), which is not
the correct AWS AppSync relationship. Resolvers reference functions
via a functionId field, not by data source name matching.
- Add functionId field to Resolver model
- Handle functionId in createResolver and updateResolver
- Fix listResolversByFunction to filter by functionId
- Add listResolversByType method for per-type filtering
* feat(appsync): add global listResolvers endpoint
Add GET /v1/apis/{apiId}/resolvers to list all resolvers across all
types, matching the AWS AppSync API. The per-type endpoint
(GET /v1/apis/{apiId}/types/{typeName}/resolvers) is preserved.
- Add global listResolvers to controller
- Rename per-type endpoint to listResolversByType for clarity
- Add integration test for global listResolvers
- Update listResolversByFunction test to verify functionId-based filtering
* test(appsync): complete SDK compatibility tests for Phase 1
Add missing SDK v2 compatibility tests to match all Phase 1 operations:
- API Keys: updateApiKey, deleteApiKey
- Resolvers: updateResolver
- Types: createType, getType, listTypes, updateType
- Error handling: getNonExistentApi, getNonExistentDataSource,
getNonExistentType throw AppSyncException
Total SDK tests: 24 → 35. All operations in Phase 1 are now covered.
V2 SES already exposes ConfigurationSet event-destination CRUD via
REST JSON; this PR adds the matching V1 Query actions
(CreateConfigurationSetEventDestination /
UpdateConfigurationSetEventDestination /
DeleteConfigurationSetEventDestination) and extends
DescribeConfigurationSet so V1 callers can round-trip their stored
destinations. The service layer (`SesService.createConfigurationSetEventDestination`
etc.) already had the persistence and validation logic, so most of the
work is wire-format: parse V1 Query parameter shapes, render V1 XML
responses, and route the new action names.
- SesQueryHandler: three new Query actions plus
`readEventDestination(params, prefix)` and `writeEventDestination`
helpers. V1 wire field names use uppercase `ARN` / `NS` suffix
variants (`SNSDestination.TopicARN`,
`KinesisFirehoseDestination.IAMRoleARN` / `DeliveryStreamARN`,
`CloudWatchDestination.DimensionConfigurations.member.N`) which are
mapped onto the existing model classes; the `EventDestination.Enabled`
default mirrors the V2 primitive-boolean default of `false` when
omitted.
- V1 event-type wire forms are lowercase camelCase (`send`,
`complaint`, `renderingFailure`) while floci stores the V2 canonical
form (SCREAMING_SNAKE). New `V1_EVENT_TYPE_TO_INTERNAL` /
`INTERNAL_EVENT_TYPE_TO_V1` maps translate in both directions; unknown
values pass through so the existing validate-against-VALID_EVENT_TYPES
check still catches typos.
- `handleDescribeConfigurationSet`: when
`ConfigurationSetAttributeNames.member.N=eventDestinations` is
requested, render the stored event destinations as a V1 XML block.
Treat a null `ConfigurationSet.eventDestinations` list as empty when
rendering, so a corrupted persisted JSON with `"EventDestinations": null`
still produces an empty `<EventDestinations/>` container rather than
NPE-ing. Other ConfigurationSet attribute names (trackingOptions,
deliveryOptions, reputationOptions) remain unsupported and are
silently ignored — they will land with their respective Put*Options
PRs. The container is emitted even when the destination list is
empty so the response depends only on the requested attributes.
- `writeEventDestination`: skip destination blocks when required fields
are blank (defensive belt-and-suspenders for any legacy state) and
filter incomplete CloudWatch dimension members so partial members
don't leak into the XML.
- `SesService.validateEventDestination`: centralize required-field
validation for SNS / Firehose / CloudWatch dimensions, so both V1
and V2 reject partial destinations at create/update time. Members
with missing required fields now fail with a 400
`InvalidParameterValue` carrying the offending member index.
- `AwsQueryController.SES_ACTIONS`: include the three new actions in
the action-name → "email" service routing fallback so SigV4 requests
whose credential scope doesn't pin the service still reach SES.
Tests
- `SesConfigurationSetEventDestinationV1IntegrationTest`: 15 cases
covering create / describe-with-attribute / describe-without-attribute
/ describe-empty-attribute / duplicate / update / update-unknown /
delete / delete-unknown / partial Firehose / partial CloudWatch dim
/ blank SNS TopicARN / action-name routing fallback when the
Authorization header is absent.
- `SesServiceEventDestinationTest`: 8 new unit cases for the
centralized SNS / Firehose / CloudWatch dim validation, exercising
validateEventDestination directly.
- `compatibility-tests/sdk-test-java SesConfigurationSetEventDestinationTest`:
extended to drive both V1 (SesClient) and V2 (SesV2Client) against a
live Floci. Each protocol gets its own config set; nine new V1 tests
mirror the V2 lifecycle plus partial-Firehose rejection.
* feat(ses): publish SES events to SNS configuration set destinations
Add SES V2 event publishing to SnsDestination targets configured on a
ConfigurationSet. When SendEmail / SendRawEmail / SendTemplatedEmail /
SendBulkEmail is invoked with a ConfigurationSetName, Floci builds the
matching AWS-format event payload (a `mail` block plus an event-type-
specific block) and publishes it to each enabled SNS destination whose
MatchingEventTypes includes that event.
Events emitted
- SEND on every successful send.
- DELIVERY / BOUNCE / COMPLAINT / REJECT when a recipient matches the
corresponding AWS mailbox simulator address (success@ / bounce@ /
complaint@ / suppressionlist@simulator.amazonses.com).
- Per-event-type recipient lists (delivery.recipients,
bounce.bouncedRecipients, complaint.complainedRecipients) are
filtered to only the simulator address that triggered the event and
emitted in their canonical trimmed form; mail.destination carries
the full envelope.
Wire-level fidelity
- Event payload mirrors the AWS SES SNS notification format documented
at https://docs.aws.amazon.com/ses/latest/dg/event-publishing-retrieving-sns-examples.html.
- mail.tags includes user-supplied EmailTags / DefaultEmailTags /
ReplacementTags (V2) and Tags.member.N / DefaultTags.member.N /
Destinations.member.N.ReplacementTags (V1 Query). Each tag emits as
{Name: [Value]}.
- mail.headers[] appends user-supplied Content.Simple.Headers and
Content.Template.Headers after the auto-emitted From/To/Cc/Subject;
null/blank Names are rejected with "The header name must be
specified." (BadRequestException 400).
- V2 SendBulkEmail BulkEmailEntries accept ReplacementTags (merged by
Name onto DefaultEmailTags) and ReplacementHeaders (merged
case-insensitively per RFC 5322 onto DefaultContent.Template.Headers).
- mail.sendingAccountId resolves from EmulatorConfig.defaultAccountId().
- ConfigurationSet existence is validated up-front on sendEmail /
sendRawEmail / sendBulkTemplatedEmail — an unknown name fails fast
with ConfigurationSetDoesNotExist (V2 controller remaps to
NotFoundException 404, V1 returns 400) before any message is stored
or relayed.
Validation errors aligned with live AWS
- EmailTags blank Name: BadRequestException 400 "The tag name must be
specified." (V2) / InvalidParameterValue 400 same message (V1).
- ConfigurationSetName not found: same error code, status, and message
as AWS.
Raw email handling
- For V2 SendEmail with Raw content (and V1 SendRawEmail), when the
caller did not provide Destinations, Floci falls back to To/Cc/Bcc
parsed from the raw MIME via SmtpRelay.parseRawHeaders (extracted
from the existing relay logic). MIME parsing is only invoked when
needed (no explicit Destinations or event publishing active).
Internal shape
- New records: model/MessageTag (Name, Value, for EmailTags) and
model/MessageHeader (Name, Value, for Content.Headers) — kept
distinct from the resource-tag Tag (Key, Value).
- SesEventPublisher dispatches to SnsService; non-SNS destination
types log a warning and are skipped (Firehose / EventBridge /
CloudWatch / Pinpoint), and missing SnsDestination.TopicArn likewise
warns instead of silently dropping. Failures preserve the throwable
in the warn log.
Tests
- SesEventPayloadTest covers mail/commonHeaders/headers/tags shape,
per-event filtering, and the headers/tags propagation paths.
- SesServiceMergeEmailTagsTest / SesServiceMergeHeadersTest pin Bulk
Default vs per-entry merge semantics (tags by Name case-sensitive,
headers by Name case-insensitive per RFC 5322).
- SesEventPublishingV2IntegrationTest exercises Send / Delivery /
Bounce / SendOnly / mixed-recipient / disabled-destination /
V1-MIME-fallback / EmailTags / V1-Tags / Simple.Headers paths
end-to-end through SES -> SNS -> SQS.
- compatibility-tests/sdk-test-java/SesEventPublishingTest validates
SendEmail with EmailTags/Headers and SendBulkEmail with per-entry
ReplacementHeaders override using AWS Java SDK V2 clients.
* fix(ses): address Copilot review on upstream PR #1106
- SesService.validateConfigurationSet: clarify the Javadoc — the
helper always throws with httpStatus = 400, and the V2 controller's
remapV1Exception is what turns ConfigurationSetDoesNotExist into
NotFoundException 404. The previous "(404 in V2, 400 in V1)" hint
read as if the helper itself picked the status, which is misleading.
- SesController.parseEmailTagsArray: reject non-object entries with
"<fieldName> entries must be JSON objects.", mirroring the existing
parseHeadersArray check. Previously a string/number element would
hit the blank-Name path and report a less specific message.
- SesService.mergeHeaders / mergeEmailTags: also skip entries whose
name is the empty string, not just null. Both parsers reject blank
names at the boundary, but defending the merge helpers keeps them
safe for direct callers (e.g., future tests) and matches the intent
of the boundary validation.
* fix(ec2): add Volume throughput, DescribeAddressesAttribute, and IAM instance profile parity
Three EC2 read-path gaps broke Terraform/OpenTofu apply cycles:
throughput to the Volume model, parsed it in CreateVolume, and emitted it
in CreateVolume/DescribeVolumes. gp3 defaults to 125 MiB/s (matching AWS);
other volume types leave it null.
the VPC module's aws_eip read cycle. Implemented the operation (returns
allocationId + publicIp per AddressAttribute) and added it to the EC2
action allowlist.
instance was launched with one, and DescribeIamInstanceProfileAssociations
returned UnsupportedOperation — causing perpetual Terraform drift then a
hard failure. instanceXml now emits <iamInstanceProfile> (arn + id), and
DescribeIamInstanceProfileAssociations is implemented with instance-id
filter and AssociationId lookup. Profile and association ids are derived
deterministically from the instance id so repeated describes are stable.
Verified against AWS SDK v2 shapes (Volume.Throughput,
AddressAttribute, IamInstanceProfileAssociation).
* fix: incorrect exception throw
JBoss Logging's *v methods (infov/warnv/errorv/debugv) format arguments
with java.text.MessageFormat, which applies locale grouping to integer
placeholders — so an int port 7001 was logged as "7,001". This produced
misleading startup/proxy logs like "on port 7,001 → 172.18.0.5:5,432".
Wrap every int port argument passed to a *v log call in String.valueOf()
so MessageFormat treats it as a plain string and emits it verbatim.
Covers RDS, ElastiCache, Neptune, Lambda runtime, OpenSearch, EKS, ECR,
ELBv2, EC2, SES, TLS proxy, and the core PortAllocator /
ContainerLifecycleManager. printf-style logf calls and already-string
args were unaffected and left unchanged.
tagResource, untagResource, and listTagsForResource detected the resource
type with resourceArn.contains("event-bus/"). A rule ARN on a custom bus —
rule/my-event-bus/test-rule — also contains "event-bus/", so it matched the
bus branch instead of the rule branch and failed with ResourceNotFoundException.
Parse the ARN with AwsArnUtils.parse(arn).resource() and dispatch on
resource.startsWith(...) against the resource segment only, so a bus name
substring can no longer trigger a false branch match. The duplicated
rule-name/bus-name split logic is extracted into a parseRuleResource helper
returning a RuleRef record.
Closes#963
When multiple ProjectionExpression paths share the same parent map
(e.g. data.title, data.answer, data.sources), copyPath() created a
fresh ObjectNode for each path and overwrote the previous projection.
Only the last sibling path was returned.
Fix: reuse the existing destination node when the parent key has already
been projected, so all sibling paths accumulate into the same node.
Applied to both the {"M": ...} DynamoDB-typed branch and the isObject()
plain-object fallback.
Additional fixes applied during review:
- List index [n] branch: same overwrite guard added (was also
unconditionally overwriting dest[seg] on repeated access)
- Leaf deep-copy: dest.set(seg, child.deepCopy()) prevents placing a
live source reference into the destination, which a subsequent sibling
path could have mutated via the isObject() reuse logic
- Test cleanup: replaced @Order(100) teardown with @AfterAll so the
table is always deleted even when a test fails
- Added direct ProjectionEvaluator unit test for the isObject() branch
Closes#852
* fix(s3): reject response-* overrides on unsigned requests
AWS S3 requires a signed request (Authorization header or presigned URL)
when any of the six response-* query parameters are present. Unsigned
requests with these parameters were silently honoured, diverging from
real S3 behaviour in a way that would only surface in production.
Confirmed against real S3: HTTP 400, Code=InvalidRequest,
"Request specific response headers cannot be used for anonymous GET requests."
Adds hasAny() to ResponseHeaderOverrides and an isSigned() check
(Authorization header or X-Amz-Algorithm query param) applied to both
GetObject and HeadObject before the overrides are applied.
Closes#918
* fix(s3): sign response-* override tests to match AWS requirement
PreSignedUrlIntegrationTest orders 11, 12, 14, and 16 made anonymous
requests with response-* query params and expected 200. These tests now
correctly reflect the AWS requirement that response-* overrides must be
on a signed request — anonymous requests must be rejected (closes#918).
provisionApiGatewayV2Api only forwarded Name and ProtocolType, so a
template with ProtocolType: WEBSOCKET failed with "RouteSelectionExpression
is required for WEBSOCKET protocol" even when the field was present, and
Description, ApiKeySelectionExpression, CorsConfiguration and Tags were
silently dropped.
Forward RouteSelectionExpression, Description and ApiKeySelectionExpression
through resolveOptional, and add parseApiGatewayV2Tags / parseApiGatewayV2Cors
helpers for the JSON-object Tags shape and the PascalCase CorsConfiguration
sub-object that this resource type uses.
Closes#1072
ModifySubnetAttribute only handled MapPublicIpOnLaunch; the other three
AWS-defined attributes — AssignIpv6AddressOnCreation, EnableDns64, and
MapCustomerOwnedIpOnLaunch — were silently ignored. Added them to the
handler loop and to the Subnet model, and included them in the
DescribeSubnets XML response alongside an empty ipv6CidrBlockAssociationSet
element that AWS always returns.
DescribeInstances was missing attachTime on blockDeviceMapping/ebs, causing
SDK response shape validation to fail for callers that inspect that field.
* feat(ses): add SES V2 configuration set event destination operations
Implement CreateConfigurationSetEventDestination, GetConfigurationSetEventDestinations,
UpdateConfigurationSetEventDestination, and DeleteConfigurationSetEventDestination on
the SES V2 REST JSON API. Event destinations are stored on the configuration set;
validation and error messages mirror the real AWS SESv2 responses. Includes REST
integration, service unit, and AWS SDK compatibility tests.
* fix(ses): return defensive copy from event destination getter and preserve order on update
GetConfigurationSetEventDestinations now returns an unmodifiable copy so callers
cannot mutate stored state outside the service. UpdateConfigurationSetEventDestination
replaces the destination in place (by index) instead of remove+add, keeping the
list order stable when a configuration set has multiple event destinations.
* feat: add the getRequiredVpc method
* feat: add the methdis getRequiredSubnet and getRequiredInstance
* feat: add the getRequiredMethod for addr, igw, sg and rt
* fix: fix sintax erros on the new required methods
* fix: fixed the erros on subnet method, from subenete to subnet
* fix: fixed the name of getRequiredVpc method on createSecurtyGroup method
* fix(ecs): reconcile task lifecycle when container exits naturally
ECS tasks stayed in RUNNING indefinitely after the underlying Docker
container exited, causing `aws ecs wait tasks-stopped` to hang forever
and exitCode to remain null. Fixes#889.
The 5-second reconciler now also polls running task handles. When all
containers for a task have exited, it atomically claims the handle
(guarding against a concurrent explicit stopTask), closes log streams,
removes the Docker containers, and transitions the task to STOPPED with
stoppedAt and per-container exitCode populated.
Explicit stopTask is also fixed: it now calls stopTaskAndCollectExitCodes
to capture exit codes before the container record is removed, and
propagates them to the ECS container model. An idempotency guard prevents
double-decrement of runningTasksCount when stopTask is called on a task
already transitioned by the reconciler.
cleanupStoppedTask is used by the reconciler to avoid re-inspecting
containers whose exit codes were already collected in the inspection pass.
* fix(ecs): capture exit code after stop, not before
stopTaskAndCollectExitCodes inspected containers before stopping them,
so getExitCodeIfStopped returned null for still-running containers and
the exit code was lost once stopAndRemove deleted the record.
Split the operation into two phases: stop all containers first, then
inspect exit codes, then remove. Containers already exited skip the
stop call silently.
* fix(s3): clean up versioned file data on permanent version deletion
Summary
- Adds deleteVersionedFile() to remove a version's file data from memoryDataStore (or disk in persistent mode) when it is permanently deleted via DeleteObject with a VersionId. Previously only objectStore (metadata) was cleaned up, leaving stale file data behind indefinitely.
- When the deleted version was the latest and all other versions are also gone, the latest file pointer in memoryDataStore is now also removed (deleteFile).
- When the deleted version was the latest and a prior version is promoted to latest, the promoted version's content is written to the latest file pointer so that GetObject without a VersionId returns the correct data. A regression test confirms this was previously broken (returned the deleted version's content
instead of the promoted one's).
This follows the same pattern as #966, which fixed the analogous gap in objectStore cleanup.
Test plan
- S3VersioningServiceTest#getObjectReturnsPromotedContentAfterLatestVersionDeleted — fails before this change, passes after (confirmed manually)
- S3VersioningIntegrationTest#deleteAllVersionsThenReuploadSameContent_noResurrection — end-to-end via HTTP
- Full test suite: ./mvnw test
* fix(s3): clean up versioned file data on permanent version deletion
* fix(s3): clean up versioned file data on permanent version deletion
\$or was silently ignored — the key was never read from the parsed
pattern, so rules using \$or routed every source/detail-type-matched
event regardless of the OR conditions.
Add \$or handling to both matchesPattern (top-level) and
matchesDetailNode (detail-level):
- iterate each sub-pattern; return false if none match
- skip the \$or key in the regular field-by-field AND loop
Top-level \$or sub-patterns are full event patterns, so each is
evaluated via recursive matchesPattern call. Detail-level sub-patterns
are field-match objects, evaluated via recursive matchesDetailNode on
the same actual node.
* feat: add global CORS filter for browser-based local development
Introduces a JAX-RS filter that adds CORS headers for configured origins,
enabling browser clients to call Floci directly during local development.
Service-level CORS configurations take precedence as the filter only fills
missing headers.
Configurable via EXTRA_CORS_ALLOWED_ORIGINS (or floci.security.extra-cors-allowed-origins)
with optional extra allowed/exposed headers and a disable flag.
* feat: fix hit for cors by each request
---------
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
* fix(apigw-v2): populate pathParameters in Lambda proxy event for HTTP API integrations
buildV2ProxyEvent never called extractV2PathParams, so pathParameters was always
absent from the Lambda event payload. Frameworks that rely on it for routing (e.g.
the tRPC AWS Lambda adapter via ANY /{proxy+}) failed with path routing errors.
Wire extractV2PathParams into buildV2ProxyEvent after the queryStringParameters
block, mirroring how dispatchHttpProxyV2 already uses it. Also relax the method
visibility to package-private to allow the new unit tests to call it directly.
* test(ec2): scope Ec2NetworkInterfacePaginationTest to its own VPC
DescribeNetworkInterfaces was called without a filter, so the tests
counted ENIs created by other concurrently-running sdk-test-java tests
(e.g. sdk-test-instance from Ec2DescribeNetworkInterfacesTest), causing
intermittent failures when test ordering meant those ENIs existed at
assertion time.
Adds a vpc-id filter helper scoped to the VPC created in @BeforeAll so
each test only sees the 6 ENIs it owns.
* test(kms): add grant compatibility contracts
* feat(kms): support empty ListGrants
* feat(kms): add CreateGrant and persisted ListGrants round trip
* test(kms): add create grant round trip coverage
* feat(kms): add grant pagination, filters, and ListRetirableGrants
* test(kms): add pagination, filter, and retirable grant coverage
* feat(kms): add RevokeGrant administrative delete
* test(kms): add RevokeGrant unit and integration coverage
* feat(kms): add RetireGrant with token and key+grant retirement paths
* docs(kms): document grant lifecycle operations and enforcement scope
* fix(kms): include RetiringPrincipal in ListGrants response
The handleListGrants handler was omitting RetiringPrincipal from the
JSON response even when the grant had one set. This meant grants
created with a retiring principal were invisible through ListGrants,
while ListRetirableGrants worked fine. Adds the missing serialization
to match the GrantListEntry AWS spec.
Closes the follow-ups from #1025: domain option blocks now survive
CreateDomain → DescribeDomain, and DescribeInstanceTypeLimits returns
family-appropriate metadata instead of one canned EBS response.
- VPCOptions, AdvancedSecurityOptions, EncryptionAtRestOptions,
NodeToNodeEncryptionOptions, and DomainEndpointOptions now round-trip
through the management API. Real SDK clients (Terraform / CDK / Pulumi)
read these back to detect drift; previously they were silently dropped.
- Master passwords are accepted but never echoed back, matching AWS.
- AdvancedSecurityOptions.Enabled + InternalUserDatabaseEnabled without a
master user is rejected with ValidationException, as is
CustomEndpointEnabled without a CustomEndpoint value.
- New OpenSearchInstanceTypes catalog drives DescribeInstanceTypeDetails
and DescribeInstanceTypeLimits. or1.* now reports s3-backed storage
with the larger 8-36 TiB ceiling AWS documents; i3.* reports
instance-store; everything else stays EBS at 3584 GiB. Unknown types
fall back to a generic EBS spec instead of 404'ing.
- Floci still boots one Docker container per domain regardless of
instance type, but the management metadata now matches AWS so
introspection tools work correctly.
Tests: 60 OpenSearch tests pass. New: 6 OpenSearchInstanceTypesTest unit
tests + 6 OpenSearchDomainOptionsIntegrationTest end-to-end + 2
or1 / EBS instance-type-limit integration tests.
Live Docker validation: VPC + Encryption + N2N + Endpoint round-trip
on a real running domain; or1.2xlarge.search returns s3-backed/36864 GiB
while m6g.large.search returns ebs/3584 GiB; FGAC validation fires
correctly when MasterUserName is omitted.
* feat: support AWS::Serverless-2016-10-31 SAM Transform in CloudFormation
* fix: address review feedback for SAM transform
- Skip IAM role generation when explicit Role ARN is provided
- Add DeleteStack cleanup in @AfterEach to prevent IAM role leakage
- Make SamTransformProcessor a field on CloudFormationService
- Remove redundant DependsOn on Lambda (implicit via Fn::GetAtt)
- Add BillingMode: PAY_PER_REQUEST to SimpleTable expansion
- Reduce verbose inline comments to match project style
- Add assertion that explicit Role skips role resource creation
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Dixit R Jain <dixitrjain@Mac.lan>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
PR #923 routed handleRangeRequest through appendObjectHeaders so 206
partial-content responses would pick up stored headers and response-*
overrides. That also pulled in appendChecksumHeaders, which emits
obj.getChecksum() — the whole-object checksum — onto partial responses.
SDKs that validate the checksum against the received body then fail, e.g.
a `bytes=4-7` GET returns the full-object CRC64NVME and the AWS CLI reports:
Expected checksum CRSFynAYcw4= did not match calculated checksum: LQYlQwQYKmA=
Real S3 does not return whole-object checksum headers on ranged responses.
Add an includeChecksum flag to appendObjectHeaders (defaults true for the
existing GET/HEAD callers) and pass false from handleRangeRequest. The
override + restored-header improvements from #923 are unaffected.
Reported by @dwhjames on #923.
Fixes Terraform provider crash when creating aws_instance against floci.
Changes:
- Add rootVolumeId field to Instance model
- Create root EBS volume (gp3) with VolumeAttachment on instance launch
- Include volumeId in blockDeviceMapping XML response (null-safe)
- Delete root volume on instance termination (deleteOnTermination behavior)
- Use inst.getRootDeviceName() for volume attachment device name
- Add disableApiStop/disableApiTermination model fields and
DescribeInstanceAttribute support (with comment documenting known
limitation that ModifyInstanceAttribute does not yet wire these)
- Add integration tests for blockDeviceMapping volumeId, DescribeVolumes
in-use state, DescribeInstanceAttribute, and volume cleanup on terminate
Ref: floci-io/floci#871
* feat(ec2): add partial DescribeNetworkInterfaces (phases 1-3)
Wire DescribeNetworkInterfaces into the EC2 query handler with ENI
data derived from running instances. Covers:
- Empty response skeleton
- Basic ENI mapping (networkInterfaceId, subnetId, vpcId, groupSet, attachment)
- Full field coverage (privateIpAddressesSet, EIP association, tagSet,
availabilityZone, interfaceType, attachTime, deleteOnTermination)
Remaining: filter support, pagination, error handling, Terraform compat
validation (phases 4-6 for #1031).
* feat(ec2): add filter support for DescribeNetworkInterfaces (phase 4)
Support these filter keys: network-interface-id, subnet-id, vpc-id,
group-id, status, private-ip-address, description, owner-id, mac-address,
private-dns-name, tag:<key>, tag-key. Filters use AND semantics.
No-match filters return HTTP 200 with empty networkInterfaceSet.
* feat(ec2): add pagination and error handling for DescribeNetworkInterfaces (phases 5-6)
- Add NetworkInterfaceListResult record for paginated responses
- Implement offset-based MaxResults/NextToken pagination
- Add Base64 token encode/decode for pagination cursor
- Validate MaxResults range (5-1000) and MaxResults+NetworkInterfaceId conflict
- Conditionally emit nextToken in XML response (only when truncated)
- Add InvalidNetworkInterfaceID.NotFound for non-existent IDs
- Add InvalidNetworkInterfaceID.Malformed for IDs not starting with 'eni-'
- Track found IDs via HashSet for accurate NotFound detection
* test(ec2): add DescribeNetworkInterfaces pagination, error, and multipage tests
- 5 pagination validation tests (MaxResults range, param conflict, invalid token)
- 1 pagination success test (MaxResults > available ENIs, no nextToken emitted)
- 2 error handling tests (InvalidNetworkInterfaceID.NotFound and .Malformed)
- 1 self-contained multipage pagination test (launches 5 extra instances,
verifies MaxResults=5 truncation, NextToken continuation, final page cleanup)
- All 87 Ec2IntegrationTest tests pass
* test(ec2): add SDK and Terraform compat tests for DescribeNetworkInterfaces
- Add Ec2NetworkInterfacePaginationTest with 4 scenarios:
all 6 ENIs without pagination, MaxResults=5 truncation,
NextToken continuation (no overlap between pages),
and token re-use stability
- Add eni_destroy.bats Terraform compat test verifying destroy succeeds
on VPC+subnet+SG now that DescribeNetworkInterfaces is implemented
- Add minimal Terraform config (VPC 10.0.0.0/16, subnet, SG) for ENI test
* fix(ec2): align DescribeNetworkInterfaces MaxResults errors
* test(terraform): make ENI destroy compat test runnable
* fix(elbv2): offload Lambda invocation to a worker thread
ElbV2DataPlane.invokeLambdaTarget called lambdaService.invoke(...)
synchronously inside req.bodyHandler, which runs on a Vert.x
event-loop thread. The invocation blocks for seconds while a cold
Lambda container warms and polls the Runtime API. The Runtime API
itself is a Vert.x HttpServer, so blocking the listener's event loop
starved the runtime — every ALB → Lambda request hung until the
function timed out and returned 502.
Wrap the invocation in vertx.executeBlocking and shape the response
on the resulting Future, mirroring WebSocketHandler.invokeIntegration.
Add ElbV2LambdaTargetDataPlaneIntegrationTest, which deploys a real
Node.js Lambda, sends an HTTP request through the listener port, and
asserts the Lambda's response shape. The existing
ElbV2LambdaTargetIntegrationTest only covered the control plane and
ran with floci.services.elbv2.mock=true, which is why this bug went
undetected. The new test uses @TestProfile to disable the ELBv2
mock so the data plane is exercised end-to-end.
* fix(elbv2): address review feedback on ALB→Lambda fix
- Pass ordered=false to vertx.executeBlocking so independent ALB
requests run in parallel on the worker pool instead of being
serialized per context.
- Use StandardCharsets.UTF_8 when encoding the Node.js handler source
so the generated zip is byte-deterministic across platforms.
- Make cleanup robust to partial failures by null-guarding each
delete and accepting 404 for the Lambda function delete. Cleanup
stays as a final ordered @Test (rather than @AfterAll) because
the Quarkus REST endpoint is torn down before JUnit's @AfterAll
runs; an HTTP-based teardown there would fail with connection
refused. Bumped the order to Integer.MAX_VALUE so the cleanup
step keeps running last regardless of future test additions.
* test(elbv2): align ALB→Lambda dataplane test with the bug repro
Switch the test Lambda from nodejs20.x to python3.11 so it mirrors
the reproduction script in the bug report verbatim. The handler now
returns {"statusCode": 200, "body": "ok"} and the assertion drops
the path-echo and content-type checks — status 200 plus body "ok"
is still a tight enough signal that the entire ALB → Lambda data
plane round-trip succeeded.
* test(elbv2): bump dataplane test runtime to python3.14
Match the latest Python runtime supported by Floci's image map
and keep alignment with the bug repro.
Previously AWS::CloudFormation::Stack was stubbed — it returned a synthetic
stack ID but never fetched or deployed the child template, so all resources
defined in nested stacks were silently skipped.
Intercept AWS::CloudFormation::Stack in CloudFormationService.executeTemplate()
before delegating to the provisioner. Resolve TemplateURL via the template
engine, fetch the child template from the bootstrap S3 bucket, create a child
Stack, and execute it recursively on the same thread. Child outputs are surfaced
as Outputs.X attributes on the parent resource so Fn::GetAtt cross-stack
references resolve correctly.
Removes the provisionNestedStack stub from CloudFormationResourceProvisioner.
Closes#1051
Centralizes engine versions in a new OpenSearchVersions catalog and
threads them through CreateDomain / UpdateDomainConfig / UpgradeDomain
validation plus per-version Docker image resolution.
- Adds OpenSearch 3.0–3.6 and 2.15 / 2.17 / 2.19 to the supported list;
default version is now OpenSearch_2.19 (was 2.11).
- EngineVersion now maps to a concrete image tag at start time, so
CreateDomain --engine-version=OpenSearch_3.6 actually pulls
opensearchproject/opensearch:3.6.0 instead of always pulling the
default 2.x rolling tag.
- Elasticsearch_7.10 / 7.9 / 7.8 now resolve to their OSS images on
docker.elastic.co; previously these versions were advertised but the
service silently ran an OpenSearch 2.x container under the hood.
- OpenSearch 2.12+ start scripts require OPENSEARCH_INITIAL_ADMIN_PASSWORD
even when the security plugin is disabled. Set automatically.
- The Elasticsearch OSS distribution ships without x-pack, so any xpack.*
setting is rejected as an unknown setting at boot. Don't touch xpack
env on Elasticsearch_* domains.
- CreateDomain / UpdateDomainConfig / UpgradeDomain now reject unknown
engine versions and unsupported upgrade hops with ValidationException.
- GetCompatibleVersions returns the full source→targets matrix when
domainName is omitted and a single domain-scoped row when set, matching
AWS's documented behavior.
- INSTANCE_TYPES catalog gains Graviton2/3 (m6g, r6g, c6g, m7g, r7g, c7g)
and or1.* OpenSearch-optimized families that AWS now exposes.
Tests: 44 OpenSearch tests pass (31 integration + 13 new
OpenSearchVersionsTest unit tests). All four engine version paths
exercised live against Docker (OS 3.6, OS 2.11, ES 7.10 OSS, unknown
version rejection).
IamService constructed its accountId once at startup from
config.defaultAccountId() (always '000000000000'), so every CreateRole,
CreateUser, CreateGroup, CreatePolicy and CreateInstanceProfile call
returned an ARN with the wrong account — identical to the STS bug fixed
in #983.
Inject RegionResolver and call regionResolver.getAccountId() per request
inside iamArn(), so the ARN reflects the caller's account when a 12-digit
AKID is used.
Add integration tests iamCreateRoleHonoursTwelveDigitAccessKey and
iamGetRoleHonoursTwelveDigitAccessKey to cover the fix.
Co-authored-by: Simon B. Laursen <sls@bankdata.dk>
* feat: support PublishLayerVersion, GetLayerVersion, ListLayerVersions, DeleteLayerVersion and layer attachment
Implements full Lambda Layer lifecycle:
- PublishLayerVersion: POST /2018-10-31/layers/{name}/versions
- GetLayerVersion: GET /2018-10-31/layers/{name}/versions/{ver}
- ListLayerVersions: GET /2018-10-31/layers/{name}/versions
- DeleteLayerVersion: DELETE /2018-10-31/layers/{name}/versions/{ver}
- ListLayers: GET /2018-10-31/layers (now returns real data)
Layer content is extracted to disk and copied into Lambda containers
at /opt during launch, matching real AWS behavior where layers are
available at /opt/nodejs/node_modules/ etc.
CreateFunction and UpdateFunctionConfiguration already stored layer
ARNs; this commit makes the layer data actually resolvable and
mountable at runtime.
Closes#875
* feat: add Node SDK compatibility tests for Lambda Layers
Adds lambda-layers.test.ts covering:
- PublishLayerVersion (version 1 and 2)
- GetLayerVersion (success and 404)
- ListLayerVersions
- ListLayers
- DeleteLayerVersion (success, idempotent for non-existent)
- Layer attachment on CreateFunction
- Layer round-trip via GetFunctionConfiguration
- Layer update/removal via UpdateFunctionConfiguration
@pulumi/aws 6.66+ calls DescribeListenerAttributes and
DescribeCapacityReservation when refreshing Listener and LoadBalancer
resources. Floci returned UnsupportedOperation for both, which crashes
the AWS provider.
Implement DescribeListenerAttributes and ModifyListenerAttributes
(mirroring the existing load balancer / target group attribute handlers,
backed by the Listener.attributes map) and DescribeCapacityReservation
(reports an empty reservation, since Floci does not reserve load balancer
capacity). Add integration coverage for all three actions and their
not-found error paths.
ID tokens were missing all standard user attributes (e.g. given_name,
family_name, email_verified) and every custom:* attribute, leaving only
the AWS-internal claims. Copy the stored user attributes into the ID
token (id_token only, not access_token) and coerce email_verified,
phone_number_verified, and updated_at to their OIDC-spec JSON types
instead of leaving them as strings.
* fix(s3): persist inline x-amz-tagging header on PutObject
PutObject silently dropped tags supplied via the x-amz-tagging request header — the controller did not read the header and tags never reached the object store. Adds a header parameter, parses the URL-encoded key=value tag set (with 10-tag and 8 KB limits), and persists via the existing putObjectTagging path so behavior matches real AWS S3.
* test(s3): add negative-path tests for inline x-amz-tagging header
Cover malformed pair, empty key, duplicate key, >10 tags, and oversized header. Note in S3Controller that the InvalidArgument and BadRequest codes match observed real-AWS behavior even though they are not in the S3 Smithy service model
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>