mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
* feat(config): add aggregation authorization CRUD PutAggregationAuthorization, DescribeAggregationAuthorizations and DeleteAggregationAuthorization were unrouted, so the JSON handler answered InvalidAction and aws_config_aggregate_authorization could not be created. Authorizations are keyed by (AuthorizedAccountId, AuthorizedAwsRegion) within the request region, persisted through StorageFactory like the other durable Config resources. Put is an upsert that preserves the ARN and creation time of an existing authorization, and accepts Tags, which land in the same tag store that ListTagsForResource reads. Delete of an absent authorization succeeds: the Config model declares no not-found error for that operation. * fix(config): remove aggregation-authorization tags on every delete attempt Tag cleanup ran only when the delete found an entry to remove. A delete that removed the authorization but did not reach the tags left them behind, and the retry that should have cleaned them up skipped the cleanup because the entry was already gone. Put reuses a deterministic ARN, so those tags reappeared on the next authorization for the same account and region. The ARN is now derived from the key instead of read off the removed entry, and its tags are dropped on every attempt. The authorization map is still persisted only when an entry was actually removed. * fix(config): apply PutAggregationAuthorization tags at creation only PutAggregationAuthorization is idempotent, and AWS applies request tags at creation only: a later Put that finds the authorization already there ignores its Tags and leaves the existing ones alone. Tagging the existing ARN on every Put let a local test retag by re-putting, which production would silently refuse. Return the existing authorization untouched and tag only the one just created. Tags still change through TagResource/UntagResource, which is the only way AWS offers. * fix(config): make aggregation authorization put/delete atomic putAggregationAuthorization did a get-then-put on the region map with nothing holding the two together, and deleteAggregationAuthorization removed-then- persisted the same way. Two concurrent Puts for one (AuthorizedAccountId, AuthorizedAwsRegion) could both find nothing and both create: the second overwrote the first's CreationTime and re-applied creation tags over a set TagResource may already have changed, so the documented idempotency held only probabilistically. Both now take the same per-key lock putConfigRule/deleteConfigRule already use for rules. The lock keys are namespaced apart from the rule keys in the shared map rather than relying on rule names never containing '|'. The regression runs many short rounds rather than one wide one, because the unlocked window is a few instructions: repeated fresh starts land the race, more threads on one start do not. It asserts reference identity, which is what distinguishes the two cases -- the store is keyed on the pair so its size is 1 either way, the ARN is derived from the key so it is equal either way, and CreationTime is epoch seconds so a racing pair created inside one second is indistinguishable by timestamp. Verified to fail with the lock removed (17 mismatches) and pass with it, five runs.
7.5 KiB
7.5 KiB
AWS Config
Protocol: JSON 1.1 (X-Amz-Target: StarlingDoveService.*)
Endpoint: POST http://localhost:4566/
Supported Actions
Config Rules
| Action | Description |
|---|---|
PutConfigRule |
Create or update a config rule (full rule shape round-trips: description, scope, source details, input parameters, execution frequency, evaluation modes) |
DeleteConfigRule |
Delete a config rule and its evaluation results |
DescribeConfigRules |
List config rules, optionally filtered by name, paginated via NextToken |
DescribeConfigRuleEvaluationStatus |
Get evaluation status for config rules |
StartConfigRulesEvaluation |
Trigger evaluation for config rules |
Compliance & Evaluations
| Action | Description |
|---|---|
PutEvaluations |
Report evaluation results for a config rule (supports TestMode) |
PutExternalEvaluation |
Report a single external evaluation for a config rule |
DeleteEvaluationResults |
Delete all evaluation results for a config rule |
DescribeComplianceByConfigRule |
Get rule-level compliance aggregated from reported evaluations |
DescribeComplianceByResource |
Get resource-level compliance aggregated across rules |
GetComplianceDetailsByConfigRule |
List the evaluation results recorded for a rule |
GetComplianceDetailsByResource |
List the evaluation results recorded for a resource |
GetComplianceSummaryByConfigRule |
Count compliant and non-compliant rules |
GetComplianceSummaryByResourceType |
Count compliant and non-compliant resources, grouped by type |
Configuration Recorder
| Action | Description |
|---|---|
PutConfigurationRecorder |
Create or update a configuration recorder |
DescribeConfigurationRecorders |
List configuration recorders |
DeleteConfigurationRecorder |
Delete a configuration recorder |
StartConfigurationRecorder |
Start recording configuration changes |
StopConfigurationRecorder |
Stop recording configuration changes |
DescribeConfigurationRecorderStatus |
Get the status of configuration recorders |
Delivery Channel
| Action | Description |
|---|---|
PutDeliveryChannel |
Create or update a delivery channel |
DescribeDeliveryChannels |
List delivery channels |
DeleteDeliveryChannel |
Delete a delivery channel (fails while the recorder is running) |
Retention Configuration
| Action | Description |
|---|---|
PutRetentionConfiguration |
Set the retention period (30-2557 days) |
DescribeRetentionConfigurations |
List retention configurations |
DeleteRetentionConfiguration |
Delete the retention configuration |
Conformance Packs
| Action | Description |
|---|---|
PutConformancePack |
Create or update a conformance pack |
DeleteConformancePack |
Delete a conformance pack |
DescribeConformancePacks |
List conformance packs, paginated via Limit/NextToken |
DescribeConformancePackStatus |
Get the deployment status of conformance packs |
Aggregation Authorizations
| Action | Description |
|---|---|
PutAggregationAuthorization |
Authorize an account and region to aggregate this account's Config data |
DescribeAggregationAuthorizations |
List aggregation authorizations, paginated via Limit/NextToken |
DeleteAggregationAuthorization |
Revoke an aggregation authorization |
Tagging
| Action | Description |
|---|---|
TagResource |
Add tags to a Config resource |
UntagResource |
Remove tags from a Config resource |
ListTagsForResource |
List tags on a Config resource |
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_CONFIGSERVICE_ENABLED |
true |
Enable or disable the service |
Examples
export AWS_ENDPOINT_URL=http://localhost:4566
# Create a config rule
aws configservice put-config-rule --config-rule '{
"ConfigRuleName": "s3-bucket-versioning",
"Description": "Checks that versioning is enabled",
"Scope": {"ComplianceResourceTypes": ["AWS::S3::Bucket"]},
"Source": {
"Owner": "AWS",
"SourceIdentifier": "S3_BUCKET_VERSIONING_ENABLED"
}
}'
# List config rules
aws configservice describe-config-rules
# Report evaluation results (the ResultToken is the rule name, see Deviations)
aws configservice put-evaluations \
--result-token s3-bucket-versioning \
--evaluations '[{
"ComplianceResourceType": "AWS::S3::Bucket",
"ComplianceResourceId": "my-bucket",
"ComplianceType": "NON_COMPLIANT",
"Annotation": "Versioning is suspended",
"OrderingTimestamp": 1700000000.0
}]'
# Rule compliance now reflects the reported evaluations
aws configservice describe-compliance-by-config-rule \
--config-rule-names s3-bucket-versioning
# Inspect per-resource evaluation results
aws configservice get-compliance-details-by-config-rule \
--config-rule-name s3-bucket-versioning
# Set the retention period
aws configservice put-retention-configuration --retention-period-in-days 365
# Create a configuration recorder
aws configservice put-configuration-recorder --configuration-recorder '{
"name": "default",
"roleARN": "arn:aws:iam::012345678901:role/config-role",
"recordingGroup": {
"allSupported": true,
"includeGlobalResourceTypes": true
}
}'
# Start recording
aws configservice start-configuration-recorder --configuration-recorder-name default
# Check recorder status
aws configservice describe-configuration-recorder-status
# Create a conformance pack
aws configservice put-conformance-pack \
--conformance-pack-name my-pack \
--template-body "Resources: {}"
# List conformance packs
aws configservice describe-conformance-packs
# Authorize another account to aggregate this account's data
aws configservice put-aggregation-authorization \
--authorized-account-id 111122223333 \
--authorized-aws-region eu-west-1
# List aggregation authorizations
aws configservice describe-aggregation-authorizations
# Tag a resource
aws configservice tag-resource \
--resource-arn arn:aws:config:us-east-1:000000000000:config-rule/config-rule-abc123 \
--tags Key=env,Value=dev
# Delete a config rule
aws configservice delete-config-rule --config-rule-name s3-bucket-versioning
Deviations
!!! note
Compliance is driven entirely by evaluations reported through PutEvaluations and
PutExternalEvaluation — Floci does not record resource configurations or run rule
evaluations itself. Until an evaluation is reported, compliance returns
INSUFFICIENT_DATA.
- **ResultToken**: real AWS hands custom rules an opaque token inside the evaluation
event. Floci has no evaluation event, so `PutEvaluations` expects the config rule
name as the token (a `<rule-name>:<suffix>` form is also accepted).
- `StartConfigRulesEvaluation` marks the rule as invoked but does not call the rule's
Lambda function.
- `FirstActivatedTime` and invocation timestamps are runtime state and are not
persisted across restarts.
- `DescribeConfigRules` and `DescribeComplianceByConfigRule` use a fixed page size
of 25.
- Configuration recorders and delivery channels are stored and validated, but no
configuration items or snapshots are produced.
- Conformance pack status is always `CREATE_SUCCESSFUL`; pack templates are stored,
not evaluated.
- `PutAggregationAuthorization` records the authorization and returns its ARN, but no
data is aggregated: configuration aggregators are not emulated.
`DeleteAggregationAuthorization` on an authorization that does not exist succeeds,
because the Config API models no "not found" error for that operation.