AWS Config

2019/05/06 - AWS Config - 3 updated api methods

Changes  AWS Config now supports tagging on PutConfigRule, PutConfigurationAggregator and PutAggregationAuthorization APIs.

PutAggregationAuthorization (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Authorizes the aggregator account and region to collect data from the source account and region.

See also: AWS API Documentation

Request Syntax

client.put_aggregation_authorization(
    AuthorizedAccountId='string',
    AuthorizedAwsRegion='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type AuthorizedAccountId

string

param AuthorizedAccountId

[REQUIRED]

The 12-digit account ID of the account authorized to aggregate data.

type AuthorizedAwsRegion

string

param AuthorizedAwsRegion

[REQUIRED]

The region authorized to collect aggregated data.

type Tags

list

param Tags
  • (dict) --

    The tags for the resource. The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

    • Key (string) --

      One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) --

      The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

rtype

dict

returns

Response Syntax

{
    'AggregationAuthorization': {
        'AggregationAuthorizationArn': 'string',
        'AuthorizedAccountId': 'string',
        'AuthorizedAwsRegion': 'string',
        'CreationTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • AggregationAuthorization (dict) --

      Returns an AggregationAuthorization object.

      • AggregationAuthorizationArn (string) --

        The Amazon Resource Name (ARN) of the aggregation object.

      • AuthorizedAccountId (string) --

        The 12-digit account ID of the account authorized to aggregate data.

      • AuthorizedAwsRegion (string) --

        The region authorized to collect aggregated data.

      • CreationTime (datetime) --

        The time stamp when the aggregation authorization was created.

PutConfigRule (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Adds or updates an AWS Config rule for evaluating whether your AWS resources comply with your desired configurations.

You can use this action for custom AWS Config rules and AWS managed Config rules. A custom AWS Config rule is a rule that you develop and maintain. An AWS managed Config rule is a customizable, predefined rule that AWS Config provides.

If you are adding a new custom AWS Config rule, you must first create the AWS Lambda function that the rule invokes to evaluate your resources. When you use the PutConfigRule action to add the rule to AWS Config, you must specify the Amazon Resource Name (ARN) that AWS Lambda assigns to the function. Specify the ARN for the SourceIdentifier key. This key is part of the Source object, which is part of the ConfigRule object.

If you are adding an AWS managed Config rule, specify the rule's identifier for the SourceIdentifier key. To reference AWS managed Config rule identifiers, see About AWS Managed Config Rules.

For any new rule that you add, specify the ConfigRuleName in the ConfigRule object. Do not specify the ConfigRuleArn or the ConfigRuleId . These values are generated by AWS Config for new rules.

If you are updating a rule that you added previously, you can specify the rule by ConfigRuleName , ConfigRuleId , or ConfigRuleArn in the ConfigRule data type that you use in this request.

The maximum number of rules that AWS Config supports is 150.

For information about requesting a rule limit increase, see AWS Config Limits in the AWS General Reference Guide .

For more information about developing and using AWS Config rules, see Evaluating AWS Resource Configurations with AWS Config in the AWS Config Developer Guide .

See also: AWS API Documentation

Request Syntax

client.put_config_rule(
    ConfigRule={
        'ConfigRuleName': 'string',
        'ConfigRuleArn': 'string',
        'ConfigRuleId': 'string',
        'Description': 'string',
        'Scope': {
            'ComplianceResourceTypes': [
                'string',
            ],
            'TagKey': 'string',
            'TagValue': 'string',
            'ComplianceResourceId': 'string'
        },
        'Source': {
            'Owner': 'CUSTOM_LAMBDA'|'AWS',
            'SourceIdentifier': 'string',
            'SourceDetails': [
                {
                    'EventSource': 'aws.config',
                    'MessageType': 'ConfigurationItemChangeNotification'|'ConfigurationSnapshotDeliveryCompleted'|'ScheduledNotification'|'OversizedConfigurationItemChangeNotification',
                    'MaximumExecutionFrequency': 'One_Hour'|'Three_Hours'|'Six_Hours'|'Twelve_Hours'|'TwentyFour_Hours'
                },
            ]
        },
        'InputParameters': 'string',
        'MaximumExecutionFrequency': 'One_Hour'|'Three_Hours'|'Six_Hours'|'Twelve_Hours'|'TwentyFour_Hours',
        'ConfigRuleState': 'ACTIVE'|'DELETING'|'DELETING_RESULTS'|'EVALUATING',
        'CreatedBy': 'string'
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ConfigRule

dict

param ConfigRule

[REQUIRED]

The rule that you want to add to your account.

  • ConfigRuleName (string) --

    The name that you assign to the AWS Config rule. The name is required if you are adding a new rule.

  • ConfigRuleArn (string) --

    The Amazon Resource Name (ARN) of the AWS Config rule.

  • ConfigRuleId (string) --

    The ID of the AWS Config rule.

  • Description (string) --

    The description that you provide for the AWS Config rule.

  • Scope (dict) --

    Defines which resources can trigger an evaluation for the rule. The scope can include one or more resource types, a combination of one resource type and one resource ID, or a combination of a tag key and value. Specify a scope to constrain the resources that can trigger an evaluation for the rule. If you do not specify a scope, evaluations are triggered when any resource in the recording group changes.

    • ComplianceResourceTypes (list) --

      The resource types of only those AWS resources that you want to trigger an evaluation for the rule. You can only specify one type if you also specify a resource ID for ComplianceResourceId .

      • (string) --

    • TagKey (string) --

      The tag key that is applied to only those AWS resources that you want to trigger an evaluation for the rule.

    • TagValue (string) --

      The tag value applied to only those AWS resources that you want to trigger an evaluation for the rule. If you specify a value for TagValue , you must also specify a value for TagKey .

    • ComplianceResourceId (string) --

      The ID of the only AWS resource that you want to trigger an evaluation for the rule. If you specify a resource ID, you must specify one resource type for ComplianceResourceTypes .

  • Source (dict) -- [REQUIRED]

    Provides the rule owner (AWS or customer), the rule identifier, and the notifications that cause the function to evaluate your AWS resources.

    • Owner (string) -- [REQUIRED]

      Indicates whether AWS or the customer owns and manages the AWS Config rule.

    • SourceIdentifier (string) -- [REQUIRED]

      For AWS Config managed rules, a predefined identifier from a list. For example, IAM_PASSWORD_POLICY is a managed rule. To reference a managed rule, see Using AWS Managed Config Rules.

      For custom rules, the identifier is the Amazon Resource Name (ARN) of the rule's AWS Lambda function, such as arn:aws:lambda:us-east-2:123456789012:function:custom_rule_name .

    • SourceDetails (list) --

      Provides the source and type of the event that causes AWS Config to evaluate your AWS resources.

      • (dict) --

        Provides the source and the message types that trigger AWS Config to evaluate your AWS resources against a rule. It also provides the frequency with which you want AWS Config to run evaluations for the rule if the trigger type is periodic. You can specify the parameter values for SourceDetail only for custom rules.

        • EventSource (string) --

          The source of the event, such as an AWS service, that triggers AWS Config to evaluate your AWS resources.

        • MessageType (string) --

          The type of notification that triggers AWS Config to run an evaluation for a rule. You can specify the following notification types:

          • ConfigurationItemChangeNotification - Triggers an evaluation when AWS Config delivers a configuration item as a result of a resource change.

          • OversizedConfigurationItemChangeNotification - Triggers an evaluation when AWS Config delivers an oversized configuration item. AWS Config may generate this notification type when a resource changes and the notification exceeds the maximum size allowed by Amazon SNS.

          • ScheduledNotification - Triggers a periodic evaluation at the frequency specified for MaximumExecutionFrequency .

          • ConfigurationSnapshotDeliveryCompleted - Triggers a periodic evaluation when AWS Config delivers a configuration snapshot.

          If you want your custom rule to be triggered by configuration changes, specify two SourceDetail objects, one for ConfigurationItemChangeNotification and one for OversizedConfigurationItemChangeNotification .

        • MaximumExecutionFrequency (string) --

          The frequency at which you want AWS Config to run evaluations for a custom rule with a periodic trigger. If you specify a value for MaximumExecutionFrequency , then MessageType must use the ScheduledNotification value.

          Note

          By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

          Based on the valid value you choose, AWS Config runs evaluations once for each valid value. For example, if you choose Three_Hours , AWS Config runs evaluations once every three hours. In this case, Three_Hours is the frequency of this rule.

  • InputParameters (string) --

    A string, in JSON format, that is passed to the AWS Config rule Lambda function.

  • MaximumExecutionFrequency (string) --

    The maximum frequency with which AWS Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

    • You are using an AWS managed rule that is triggered at a periodic frequency.

    • Your custom rule is triggered when AWS Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

    Note

    By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

  • ConfigRuleState (string) --

    Indicates whether the AWS Config rule is active or is currently being deleted by AWS Config. It can also indicate the evaluation status for the AWS Config rule.

    AWS Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the AWS Config rule.

    AWS Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the AWS Config rule.

    AWS Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After AWS Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

  • CreatedBy (string) --

    Service principal name of the service that created the rule.

    Note

    The field is populated only if the service linked rule is created by a service. The field is empty if you create your own rule.

type Tags

list

param Tags
  • (dict) --

    The tags for the resource. The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

    • Key (string) --

      One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) --

      The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

returns

None

PutConfigurationAggregator (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Creates and updates the configuration aggregator with the selected source accounts and regions. The source account can be individual account(s) or an organization.

Note

AWS Config should be enabled in source accounts and regions you want to aggregate.

If your source type is an organization, you must be signed in to the master account and all features must be enabled in your organization. AWS Config calls EnableAwsServiceAccess API to enable integration between AWS Config and AWS Organizations.

See also: AWS API Documentation

Request Syntax

client.put_configuration_aggregator(
    ConfigurationAggregatorName='string',
    AccountAggregationSources=[
        {
            'AccountIds': [
                'string',
            ],
            'AllAwsRegions': True|False,
            'AwsRegions': [
                'string',
            ]
        },
    ],
    OrganizationAggregationSource={
        'RoleArn': 'string',
        'AwsRegions': [
            'string',
        ],
        'AllAwsRegions': True|False
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ConfigurationAggregatorName

string

param ConfigurationAggregatorName

[REQUIRED]

The name of the configuration aggregator.

type AccountAggregationSources

list

param AccountAggregationSources

A list of AccountAggregationSource object.

  • (dict) --

    A collection of accounts and regions.

    • AccountIds (list) -- [REQUIRED]

      The 12-digit account ID of the account being aggregated.

      • (string) --

    • AllAwsRegions (boolean) --

      If true, aggregate existing AWS Config regions and future regions.

    • AwsRegions (list) --

      The source regions being aggregated.

      • (string) --

type OrganizationAggregationSource

dict

param OrganizationAggregationSource

An OrganizationAggregationSource object.

  • RoleArn (string) -- [REQUIRED]

    ARN of the IAM role used to retrieve AWS Organization details associated with the aggregator account.

  • AwsRegions (list) --

    The source regions being aggregated.

    • (string) --

  • AllAwsRegions (boolean) --

    If true, aggregate existing AWS Config regions and future regions.

type Tags

list

param Tags
  • (dict) --

    The tags for the resource. The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

    • Key (string) --

      One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) --

      The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

rtype

dict

returns

Response Syntax

{
    'ConfigurationAggregator': {
        'ConfigurationAggregatorName': 'string',
        'ConfigurationAggregatorArn': 'string',
        'AccountAggregationSources': [
            {
                'AccountIds': [
                    'string',
                ],
                'AllAwsRegions': True|False,
                'AwsRegions': [
                    'string',
                ]
            },
        ],
        'OrganizationAggregationSource': {
            'RoleArn': 'string',
            'AwsRegions': [
                'string',
            ],
            'AllAwsRegions': True|False
        },
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • ConfigurationAggregator (dict) --

      Returns a ConfigurationAggregator object.

      • ConfigurationAggregatorName (string) --

        The name of the aggregator.

      • ConfigurationAggregatorArn (string) --

        The Amazon Resource Name (ARN) of the aggregator.

      • AccountAggregationSources (list) --

        Provides a list of source accounts and regions to be aggregated.

        • (dict) --

          A collection of accounts and regions.

          • AccountIds (list) --

            The 12-digit account ID of the account being aggregated.

            • (string) --

          • AllAwsRegions (boolean) --

            If true, aggregate existing AWS Config regions and future regions.

          • AwsRegions (list) --

            The source regions being aggregated.

            • (string) --

      • OrganizationAggregationSource (dict) --

        Provides an organization and list of regions to be aggregated.

        • RoleArn (string) --

          ARN of the IAM role used to retrieve AWS Organization details associated with the aggregator account.

        • AwsRegions (list) --

          The source regions being aggregated.

          • (string) --

        • AllAwsRegions (boolean) --

          If true, aggregate existing AWS Config regions and future regions.

      • CreationTime (datetime) --

        The time stamp when the configuration aggregator was created.

      • LastUpdatedTime (datetime) --

        The time of the last update.