mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 17:58:05 -05:00
AWS Config had no configuration aggregator operations, so Terraform's aws_config_configuration_aggregator failed on create. PutConfigurationAggregator, DescribeConfigurationAggregators and DeleteConfigurationAggregator are now served, with aggregators stored per account and Region. A second Put with the same name updates in place, keeping the ARN and CreationTime. The source and region rules refuse with AWS's messages, Describe pages 100 at a time, and an unknown name is NoSuchConfigurationAggregatorException. Tags given on the first Put work with the tagging operations, and IAM checks an aggregator against its stored ARN and tags. Closes #7019
263 lines
13 KiB
Markdown
263 lines
13 KiB
Markdown
# 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 using a delivery channel in the same account and Region |
|
|
| `StopConfigurationRecorder` | Stop recording configuration changes |
|
|
| `DescribeConfigurationRecorderStatus` | Get the status of configuration recorders. Whether a recorder is recording, and when it last started and stopped, persist with the recorder, so a started recorder is still recording after a restart |
|
|
|
|
`DescribeConfigurationRecorders` and `DescribeConfigurationRecorderStatus` accept at
|
|
most one entry in `ConfigurationRecorderNames`. More than one entry returns HTTP 400
|
|
`ValidationException`, including repeated names and requests made before any recorder exists.
|
|
An omitted or empty list selects all recorders; one unknown name returns
|
|
`NoSuchConfigurationRecorderException`.
|
|
|
|
### 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 |
|
|
|
|
### Configuration Aggregators
|
|
|
|
| Action | Description |
|
|
|---|---|
|
|
| `PutConfigurationAggregator` | Create or update (same ARN, `LastUpdatedTime` moves) an aggregator from exactly one of `AccountAggregationSources` or `OrganizationAggregationSource`, each source setting either `AllAwsRegions: true` without `AwsRegions`, or a nonempty `AwsRegions` list with `AllAwsRegions` absent or `false`; `AggregatorFilters` is stored and echoed (only checked for `ResourceType` or `ServicePrincipal`, not applied); creation `Tags` are visible through the tagging actions |
|
|
| `DescribeConfigurationAggregators` | List aggregators, optionally by name (unknown name fails with `NoSuchConfigurationAggregatorException`), paginated via `Limit`/`NextToken` (default page 100) |
|
|
| `DeleteConfigurationAggregator` | Delete an aggregator and its tags |
|
|
|
|
### Tagging
|
|
|
|
| Action | Description |
|
|
|---|---|
|
|
| `TagResource` | Add tags to a Config resource |
|
|
| `UntagResource` | Remove tags from a Config resource |
|
|
| `ListTagsForResource` | List tags on a Config resource |
|
|
|
|
## IAM enforcement
|
|
|
|
With IAM enforcement on, each action is checked on the resources the AWS Service Authorization
|
|
Reference lists for it, read from the request. A config rule, a configuration recorder and a
|
|
conformance pack carry an id Config mints in their ARNs (`config-rule/<id>`,
|
|
`configuration-recorder/<name>/<id>`, `conformance-pack/<name>/<id>`), so a request naming one by
|
|
its name is checked on the ARN Config stores it under. One Config holds none of is checked on its
|
|
name with the id open (`conformance-pack/<name>/*`), or on `config-rule/*` for a rule. The tag
|
|
calls are checked on their `ResourceArn`.
|
|
|
|
A `PutConfigRule` is checked on the rule its `ConfigRuleArn` or `ConfigRuleId` names, which is the
|
|
rule it updates (below), and on `*` when it names neither, as a new rule does and an update by
|
|
`ConfigRuleName` alone does. `PutConfigurationRecorder` is checked on the recorder its
|
|
`ConfigurationRecorder` structure's `name` names, the ARN Config stores it under, or
|
|
`configuration-recorder/<name>/*` for a new one. `PutAggregationAuthorization` is checked on
|
|
`arn:aws:config:<region>:<account>:aggregation-authorization/<AuthorizedAccountId>/<AuthorizedAwsRegion>`,
|
|
in the caller's account, the ARN Config gives the authorization. `DeleteAggregationAuthorization`,
|
|
`StartConfigRulesEvaluation`, the delivery channel and retention calls and the Describe and
|
|
compliance summaries that name no single rule are checked on `*`.
|
|
|
|
## Configuration
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `FLOCI_SERVICES_CONFIGSERVICE_ENABLED` | `true` | Enable or disable the service |
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
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
|
|
}
|
|
}'
|
|
|
|
# Create a delivery channel before starting the recorder
|
|
aws configservice put-delivery-channel --delivery-channel '{
|
|
"name": "default",
|
|
"s3BucketName": "my-config-bucket"
|
|
}'
|
|
|
|
# Start recording (without a delivery channel, returns NoAvailableDeliveryChannelException)
|
|
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 stored and described, never collected.
|
|
`DeleteAggregationAuthorization` on an authorization that does not exist succeeds,
|
|
because the Config API models no "not found" error for that operation.
|
|
- `TagResource`, `UntagResource` and `ListTagsForResource` answer
|
|
`ResourceNotFoundException` for a config rule, conformance pack, aggregation
|
|
authorization, configuration aggregator or configuration recorder ARN that does not name an
|
|
existing resource in the caller's account and region. ARNs of resource kinds Floci does not
|
|
model (stored queries, organization rules and packs) are accepted without an existence check.
|
|
- `PutConfigRule` updates the rule its `ConfigRuleArn` names, else the one its `ConfigRuleId`
|
|
names, else the one its `ConfigRuleName` names, as the PutConfigRule reference lets an update
|
|
name its rule by any of the three; a rule named by its ARN or id keeps its name. An ARN or id
|
|
that names no rule answers `InvalidParameterValueException`, in Floci's wording.
|
|
- `PutConfigRule` applies its `Tags` only when it creates the rule; a later
|
|
`PutConfigRule` for the same rule leaves its tags unchanged, as AWS documents. Use
|
|
`TagResource` and `UntagResource` to change them. `DeleteConfigRule` drops the rule's tags.
|
|
`PutConfigurationRecorder` and `DeleteConfigurationRecorder` do the same for the recorder.
|
|
- Every request is checked by `RequestConstraintCheck` against the types, required
|
|
members, bounds, patterns and enums generated from botocore's AWS Config service model.
|
|
`tools/aws/regen_config_shapes.py` vendors every operation's input constraints;
|
|
`make aws-data-sync` regenerates them and `make aws-data-check` checks for drift. A
|
|
violation answers `ValidationException`, or `InvalidLimitException` for a `Limit` out of
|
|
range where the operation models that error, in Floci's own wording. CloudFormation
|
|
checks an `AWS::Config::ConfigRule` against `PutConfigRule`'s constraints the same way,
|
|
so a property outside them fails the resource with that message.
|
|
- `PutConfigRule`, `PutAggregationAuthorization` and `PutConfigurationRecorder` reject more
|
|
than 50 `Tags`, a `Key` outside 1-128 characters or a `Value` over 256 characters with
|
|
`ValidationException`, and a tag without a `Key` with the operation's modelled error
|
|
(`InvalidParameterValueException` for the first two). They store nothing. A tag with no
|
|
`Value` is stored with an empty value.
|