DescribeConfigRuleEvaluationStatus与 a 一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DescribeConfigRuleEvaluationStatus与 a 一起使用 CLI

以下代码示例演示如何使用 DescribeConfigRuleEvaluationStatus

CLI
AWS CLI

获取 AWS Config 规则的状态信息

以下命令返回名为的 AWS Config 规则的状态信息MyConfigRule

aws configservice describe-config-rule-evaluation-status --config-rule-names MyConfigRule

输出:

{ "ConfigRulesEvaluationStatus": [ { "ConfigRuleArn": "arn:aws:config:us-east-1:123456789012:config-rule/config-rule-abcdef", "FirstActivatedTime": 1450311703.844, "ConfigRuleId": "config-rule-abcdef", "LastSuccessfulInvocationTime": 1450314643.156, "ConfigRuleName": "MyConfigRule" } ] }
PowerShell
用于 PowerShell

示例 1:此示例返回给定配置规则的状态信息。

Get-CFGConfigRuleEvaluationStatus -ConfigRuleName root-account-mfa-enabled, vpc-flow-logs-enabled

输出:

ConfigRuleArn : arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-kvq1wk ConfigRuleId : config-rule-kvq1wk ConfigRuleName : root-account-mfa-enabled FirstActivatedTime : 8/27/2019 8:05:17 AM FirstEvaluationStarted : True LastErrorCode : LastErrorMessage : LastFailedEvaluationTime : 1/1/0001 12:00:00 AM LastFailedInvocationTime : 1/1/0001 12:00:00 AM LastSuccessfulEvaluationTime : 12/13/2019 8:12:03 AM LastSuccessfulInvocationTime : 12/13/2019 8:12:03 AM ConfigRuleArn : arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-z1s23b ConfigRuleId : config-rule-z1s23b ConfigRuleName : vpc-flow-logs-enabled FirstActivatedTime : 8/14/2019 6:23:44 AM FirstEvaluationStarted : True LastErrorCode : LastErrorMessage : LastFailedEvaluationTime : 1/1/0001 12:00:00 AM LastFailedInvocationTime : 1/1/0001 12:00:00 AM LastSuccessfulEvaluationTime : 12/13/2019 7:12:01 AM LastSuccessfulInvocationTime : 12/13/2019 7:12:01 AM