本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
從使用 AWS Config 的客戶受管組態記錄器開始 AWS CLI
您可以從建立客戶受管組態記錄器 AWS Config 開始。若要使用 建立客戶受管組態記錄器 AWS CLI,請使用下列命令:put-configuration-recorder
、 put-delivery-channel
和 start-configuration-recorder
。
put-configuration-recorder
命令會建立客戶受管組態記錄器。put-delivery-channel
命令會建立交付管道,其中 會將組態資訊 AWS Config 交付至 S3 儲存貯體和 SNS 主題。會
start-configuration-recorder
啟動客戶受管組態記錄器。客戶受管組態記錄器將開始記錄您指定資源類型的組態變更。
主題
考量事項
需要 S3 儲存貯體、SNS 主題和 IAM 角色
若要建立客戶受管組態記錄器,您需要建立 S3 儲存貯體、SNS 主題,以及連接政策做為先決條件的 IAM 角色。若要設定 的先決條件 AWS Config,請參閱先決條件。
每個區域每個帳戶一個客戶受管組態記錄器
AWS 帳戶 每個 的每個 只能有一個客戶受管組態記錄器 AWS 區域。
每個區域每個帳戶一個交付管道
每個 只能有一個交付管道區域 AWS 帳戶 AWS 區域。
政策和合規結果
在 中管理的 IAM 政策和其他政策可能會影響 是否 AWS Config 具有記錄資源組態變更的許可。 AWS Organizations此外,規則會直接評估資源的組態,而規則在執行評估時不會考慮這些政策。確定有效政策符合您打算使用的方式 AWS Config。
步驟 1:執行 put-configuration-recorder
使用 put-configuration-recorder
命令來建立客戶受管組態記錄器:
此命令使用 --configuration-recorder
和 ---recording-group
欄位。
$ aws configservice put-configuration-recorder \ --configuration-recorder
file://configurationRecorder.json
\ --recording-groupfile://recordingGroup.json
configuration-recorder
欄位
configurationRecorder.json
檔案會指定組態記錄器 () 的預設記錄頻率name
roleArn
和 recordingMode
。您也可以使用此欄位來覆寫特定資源類型的錄製頻率。
{ "name": "
default
", "roleARN": "arn:aws:iam::123456789012:role/config-role
", "recordingMode": { "recordingFrequency":CONTINUOUS
orDAILY
, "recordingModeOverrides": [ { "description": "Description you provide for the override
", "recordingFrequency":CONTINUOUS
orDAILY
, "resourceTypes": [Comma-separated list of resource types to include in the override
] } ] } }
recording-group
欄位
recordingGroup.json
檔案會指定要記錄的資源類型。
{ "allSupported":
boolean
, "exclusionByResourceTypes": { "resourceTypes": [Comma-separated list of resource types to exclude
] }, "includeGlobalResourceTypes":boolean
, "recordingStrategy": { "useOnly": "Recording strategy for the configuration recorder
" }, "resourceTypes": [Comma-separated list of resource types to include
] }
如需這些欄位的詳細資訊,請參閱 AWS CLI 命令參考put-configuration-recorder
中的 。
步驟 2:執行 put-delivery-channel 命令
使用 put-delivery-channel
命令來建立交付管道:
此命令使用 --delivery-channel
欄位。
$ aws configservice put-delivery-channel --delivery-channel file://deliveryChannel.json
delivery-channel
欄位
deliveryChannel.json
檔案會指定下列項目:
交付管道
name
的 。AWS Config 傳送組態快照
s3BucketName
的 。AWS Config 傳送通知
snsTopicARN
的 位置configSnapshotDeliveryProperties
會設定組態快照 AWS Config 的交付頻率,以及它調用定期規則評估的頻率。
{ "name": "
default
", "s3BucketName": "config-bucket-123456789012
", "snsTopicARN": "arn:aws:sns:us-east-1:123456789012:config-topic
", "configSnapshotDeliveryProperties": { "deliveryFrequency": "Twelve_Hours
" } }
如需這些欄位的詳細資訊,請參閱 AWS CLI 命令參考put-delivery-channel
中的 。
步驟 3:執行 start-configuration-recorder 命令
使用 start-configuration-recorder
命令啟動 AWS Config:
$ aws configservice start-configuration-recorder --configuration-recorder-name
configRecorderName
如需這些欄位的詳細資訊,請參閱 AWS CLI 命令參考start-configuration-recorder
中的 。