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

Invokes the PutConfigRule operation against AWS Config.

Syntax

Write-CFGConfigRule
-ConfigRule_ConfigRuleName <String>
-Scope_ComplianceResourceId <String>
-Scope_ComplianceResourceType <String[]>
-ConfigRule_ConfigRuleArn <String>
-ConfigRule_ConfigRuleId <String>
-ConfigRule_ConfigRuleState <ConfigRuleState>
-ConfigRule_Description <String>
-ConfigRule_InputParameter <String>
-ConfigRule_MaximumExecutionFrequency <MaximumExecutionFrequency>
-Source_SourceDetail <SourceDetail[]>
-Source_SourceIdentifier <String>
-Scope_TagKey <String>
-Scope_TagValue <String>
-Source_Owner <Owner>
-PassThru <SwitchParameter>
-Force <SwitchParameter>

Description

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 Config rules and AWS managed Config rules. A custom 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 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 50. For more 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.

Parameters

-ConfigRule_ConfigRuleArn <String>
The Amazon Resource Name (ARN) of the AWS Config rule.
Required?False
Position?Named
Accept pipeline input?False
-ConfigRule_ConfigRuleId <String>
The ID of the AWS Config rule.
Required?False
Position?Named
Accept pipeline input?False
-ConfigRule_ConfigRuleName <String>
The name that you assign to the AWS Config rule. The name is required if you are adding a new rule.
Required?False
Position?1
Accept pipeline input?True (ByValue, )
-ConfigRule_ConfigRuleState <ConfigRuleState>
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 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 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 Config rule.AWS Config sets the state of a rule to DELETING temporarily 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.
Required?False
Position?Named
Accept pipeline input?False
-ConfigRule_Description <String>
The description that you provide for the AWS Config rule.
Required?False
Position?Named
Accept pipeline input?False
-ConfigRule_InputParameter <String>
A string in JSON format that is passed to the AWS Config rule Lambda function.
Required?False
Position?Named
Accept pipeline input?False
-ConfigRule_MaximumExecutionFrequency <MaximumExecutionFrequency>
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.
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?False
-Force <SwitchParameter>
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?False
-PassThru <SwitchParameter>
Returns the value passed to the ConfigRule_ConfigRuleName parameter. By default, this cmdlet does not generate any output.
Required?False
Position?Named
Accept pipeline input?False
-Scope_ComplianceResourceId <String>
The IDs 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.
Required?False
Position?Named
Accept pipeline input?False
-Scope_ComplianceResourceType <String[]>
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.
Required?False
Position?Named
Accept pipeline input?False
-Scope_TagKey <String>
The tag key that is applied to only those AWS resources that you want to trigger an evaluation for the rule.
Required?False
Position?Named
Accept pipeline input?False
-Scope_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.
Required?False
Position?Named
Accept pipeline input?False
-Source_Owner <Owner>
Indicates whether AWS or the customer owns and manages the AWS Config rule.
Required?False
Position?Named
Accept pipeline input?False
-Source_SourceDetail <SourceDetail[]>
Provides the source and type of the event that causes AWS Config to evaluate your AWS resources.
Required?False
Position?Named
Accept pipeline input?False
-Source_SourceIdentifier <String>
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.
Required?False
Position?Named
Accept pipeline input?False

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? False
-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? False
-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. Note that the encrypted credential file is not supported on all platforms. It will be skipped when searching for profiles on Windows Nano Server, Mac, and Linux platforms.

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? False
-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? False
-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? False
-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? False
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-Region <String>
The system name of the AWS region in which the operation should be invoked. For example, us-east-1, eu-west-1 etc.
Required? False
Position? Named
Accept pipeline input? False
-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? False

Inputs

You can pipe a String object to this cmdlet for the ConfigRule_ConfigRuleName parameter.

Outputs

None or System.String
When you use the PassThru parameter, this cmdlet outputs the value supplied to the ConfigRule_ConfigRuleName parameter. Otherwise, this cmdlet does not return any output. The service response (type Amazon.ConfigService.Model.PutConfigRuleResponse) can be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Supported Version

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