AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the AWS Config PutConfigRule API operation.

Syntax

Write-CFGConfigRule
-ConfigRule_ConfigRuleName <String>
-Scope_ComplianceResourceId <String>
-Scope_ComplianceResourceType <String[]>
-ConfigRule_ConfigRuleArn <String>
-ConfigRule_ConfigRuleId <String>
-ConfigRule_ConfigRuleState <ConfigRuleState>
-ConfigRule_CreatedBy <String>
-ConfigRule_Description <String>
-CustomPolicyDetails_EnableDebugLogDelivery <Boolean>
-ConfigRule_EvaluationMode <EvaluationModeConfiguration[]>
-ConfigRule_InputParameter <String>
-ConfigRule_MaximumExecutionFrequency <MaximumExecutionFrequency>
-Source_Owner <Owner>
-CustomPolicyDetails_PolicyRuntime <String>
-CustomPolicyDetails_PolicyText <String>
-Source_SourceDetail <SourceDetail[]>
-Source_SourceIdentifier <String>
-Scope_TagKey <String>
-Tag <Tag[]>
-Scope_TagValue <String>
-Select <String>
-Force <SwitchParameter>
-ClientConfig <AmazonConfigServiceConfig>

Description

Adds or updates an Config rule to evaluate if your Amazon Web Services resources comply with your desired configurations. For information on how many Config rules you can have per account, see Service Limits in the Config Developer Guide. There are two types of rules: Config Managed Rules and Config Custom Rules. You can use PutConfigRule to create both Config Managed Rules and Config Custom Rules. Config Managed Rules are predefined, customizable rules created by Config. For a list of managed rules, see List of Config Managed Rules. If you are adding an Config managed rule, you must specify the rule's identifier for the SourceIdentifier key. Config Custom Rules are rules that you create from scratch. There are two ways to create Config custom rules: with Lambda functions ( Lambda Developer Guide) and with Guard (Guard GitHub Repository), a policy-as-code language. Config custom rules created with Lambda are called Config Custom Lambda Rules and Config custom rules created with Guard are called Config Custom Policy Rules. If you are adding a new Config Custom Lambda rule, you first need to create an Lambda function that the rule invokes to evaluate your resources. When you use PutConfigRule to add a Custom Lambda rule to Config, you must specify the Amazon Resource Name (ARN) that Lambda assigns to the function. You specify the ARN in the SourceIdentifier key. This key is part of the Source object, which is part of the ConfigRule object. For any new Config rule that you add, specify the ConfigRuleName in the ConfigRule object. Do not specify the ConfigRuleArn or the ConfigRuleId. These values are generated by 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. For more information about developing and using Config rules, see Evaluating Resources with Config Rules in the Config Developer Guide. Tags are added at creation and cannot be updated with this operationPutConfigRule is an idempotent API. Subsequent requests won’t create a duplicate resource if one was already created. If a following request has different tags values, Config will ignore these differences and treat it as an idempotent request of the previous. In this case, tags will not be updated, even if they are different. Use TagResource and UntagResource to update tags after creation.

Parameters

Amazon.PowerShell.Cmdlets.CFG.AmazonConfigServiceClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ConfigRule_ConfigRuleArn <String>
The Amazon Resource Name (ARN) of the Config rule.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ConfigRule_ConfigRuleId <String>
The ID of the Config rule.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ConfigRule_ConfigRuleName <String>
The name that you assign to the Config rule. The name is required if you are adding a new rule.
Required?False
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-ConfigRule_ConfigRuleState <ConfigRuleState>
Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.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 Config rule.Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ConfigRule_CreatedBy <String>
Service principal name of the service that created the rule.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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ConfigRule_Description <String>
The description that you provide for the Config rule.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ConfigRule_EvaluationMode <EvaluationModeConfiguration[]>
The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_EvaluationModes
-ConfigRule_InputParameter <String>
A string, in JSON format, that is passed to the Config rule Lambda function.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_InputParameters
-ConfigRule_MaximumExecutionFrequency <MaximumExecutionFrequency>
The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:
  • This is for an Config managed rule that is triggered at a periodic frequency.
  • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.
By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-CustomPolicyDetails_EnableDebugLogDelivery <Boolean>
The boolean expression for enabling debug logging for your Config Custom Policy rule. The default value is false.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Source_CustomPolicyDetails_EnableDebugLogDelivery
-CustomPolicyDetails_PolicyRuntime <String>
The runtime system for your Config Custom Policy rule. Guard is a policy-as-code language that allows you to write policies that are enforced by Config Custom Policy rules. For more information about Guard, see the Guard GitHub Repository.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Source_CustomPolicyDetails_PolicyRuntime
-CustomPolicyDetails_PolicyText <String>
The policy definition containing the logic for your Config Custom Policy rule.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Source_CustomPolicyDetails_PolicyText
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Scope_ComplianceResourceId <String>
The ID of the only Amazon Web Services 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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Scope_ComplianceResourceId
-Scope_ComplianceResourceType <String[]>
The resource types of only those Amazon Web Services 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. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Scope_ComplianceResourceTypes
-Scope_TagKey <String>
The tag key that is applied to only those Amazon Web Services resources that you want to trigger an evaluation for the rule.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Scope_TagKey
-Scope_TagValue <String>
The tag value applied to only those Amazon Web Services 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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Scope_TagValue
-Select <String>
Use the -Select parameter to control the cmdlet output. The cmdlet doesn't have a return value by default. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.ConfigService.Model.PutConfigRuleResponse). Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Source_Owner <Owner>
Indicates whether Amazon Web Services or the customer owns and manages the Config rule.Config Managed Rules are predefined rules owned by Amazon Web Services. For more information, see Config Managed Rules in the Config developer guide.Config Custom Rules are rules that you can develop either with Guard (CUSTOM_POLICY) or Lambda (CUSTOM_LAMBDA). For more information, see Config Custom Rules in the Config developer guide.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Source_Owner
-Source_SourceDetail <SourceDetail[]>
Provides the source and the message types that cause Config to evaluate your Amazon Web Services resources against a rule. It also provides the frequency with which you want Config to run evaluations for the rule if the trigger type is periodic.If the owner is set to CUSTOM_POLICY, the only acceptable values for the Config rule trigger message type are ConfigurationItemChangeNotification and OversizedConfigurationItemChangeNotification. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Source_SourceDetails
-Source_SourceIdentifier <String>
For Config Managed rules, a predefined identifier from a list. For example, IAM_PASSWORD_POLICY is a managed rule. To reference a managed rule, see List of Config Managed Rules.For Config Custom Lambda rules, the identifier is the Amazon Resource Name (ARN) of the rule's Lambda function, such as arn:aws:lambda:us-east-2:123456789012:function:custom_rule_name.For Config Custom Policy rules, this field will be ignored.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesConfigRule_Source_SourceIdentifier
-Tag <Tag[]>
An array of tag object. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTags

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-EndpointUrl <String>
The endpoint to make the call against.Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet does not generate any output.The service response (type Amazon.ConfigService.Model.PutConfigRuleResponse) be returned by specifying '-Select *'.

Supported Version

AWS Tools for PowerShell: 2.x.y.z