將組態快照交付到 Amazon S3 儲存貯體 - AWS Config

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

將組態快照交付到 Amazon S3 儲存貯體

AWS Config 將記錄 AWS 資源的 AWS Config 組態快照交付到您在設定交付通道時指定的 Amazon S3 儲存貯體。

提供組態快照

AWS Config 當您呼叫「快照」動作或執行 AWS CLI deliver-config-snapshot指令時,會產生組態DeliverConfig快照。 AWS Config 將組態快照存放在啟用時指定的 Amazon S3 儲存貯體中 AWS Config。

透過deliver-config-snapshot指定設定傳送通道 AWS Config 時所指派的名稱來輸入命令,例如:

$ aws configservice deliver-config-snapshot --delivery-channel-name default { "configSnapshotId": "94ccff53-83be-42d9-996f-b4624b3c1a55" }

範例組態快照來源 AWS Config

以下是組態快照集中 AWS Config 包含的資訊範例。快照說明目前區域中記錄您 AWS Config 的資源的組態 AWS 帳戶,並說明這些資源之間的關係。

注意

組態快照可以包含不受支援資源類型和資源 ID 的參考。

{ "fileVersion": "1.0", "requestId": "asudf8ow-4e34-4f32-afeb-0ace5bf3trye", "configurationItems": [ { "configurationItemVersion": "1.0", "resourceId": "vol-ce676ccc", "arn": "arn:aws:us-west-2b:123456789012:volume/vol-ce676ccc", "accountId": "12345678910", "configurationItemCaptureTime": "2014-03-07T23:47:08.918Z", "configurationStateID": "3e660fdf-4e34-4f32-afeb-0ace5bf3d63a", "configurationItemStatus": "OK", "relatedEvents": [ "06c12a39-eb35-11de-ae07-adb69edbb1e4", "c376e30d-71a2-4694-89b7-a5a04ad92281" ], "availibilityZone": "us-west-2b", "resourceType": "AWS::EC2::Volume", "resourceCreationTime": "2014-02-27T21:43:53.885Z", "tags": {}, "relationships": [ { "resourceId": "i-344c463d", "resourceType": "AWS::EC2::Instance", "name": "Attached to Instance" } ], "configuration": { "volumeId": "vol-ce676ccc", "size": 1, "snapshotId": "", "availabilityZone": "us-west-2b", "state": "in-use", "createTime": "2014-02-27T21:43:53.0885+0000", "attachments": [ { "volumeId": "vol-ce676ccc", "instanceId": "i-344c463d", "device": "/dev/sdf", "state": "attached", "attachTime": "2014-03-07T23:46:28.0000+0000", "deleteOnTermination": false } ], "tags": [ { "tagName": "environment", "tagValue": "PROD" }, { "tagName": "name", "tagValue": "DataVolume1" } ], "volumeType": "standard" } }, { "configurationItemVersion": "1.0", "resourceId": "i-344c463d", "accountId": "12345678910", "arn": "arn:aws:ec2:us-west-2b:123456789012:instance/i-344c463d", "configurationItemCaptureTime": "2014-03-07T23:47:09.523Z", "configurationStateID": "cdb571fa-ce7a-4ec5-8914-0320466a355e", "configurationItemStatus": "OK", "relatedEvents": [ "06c12a39-eb35-11de-ae07-adb69edbb1e4", "c376e30d-71a2-4694-89b7-a5a04ad92281" ], "availibilityZone": "us-west-2b", "resourceType": "AWS::EC2::Instance", "resourceCreationTime": "2014-02-26T22:56:35.000Z", "tags": { "Name": "integ-test-1", "examplename": "examplevalue" }, "relationships": [ { "resourceId": "vol-ce676ccc", "resourceType": "AWS::EC2::Volume", "name": "Attached Volume" }, { "resourceId": "vol-ef0e06ed", "resourceType": "AWS::EC2::Volume", "name": "Attached Volume", "direction": "OUT" }, { "resourceId": "subnet-47b4cf2c", "resourceType": "AWS::EC2::SUBNET", "name": "Is contained in Subnet", "direction": "IN" } ], "configuration": { "instanceId": "i-344c463d", "imageId": "ami-ccf297fc", "state": { "code": 16, "name": "running" }, "privateDnsName": "ip-172-31-21-63.us-west-2.compute.internal", "publicDnsName": "ec2-54-218-4-189.us-west-2.compute.amazonaws.com", "stateTransitionReason": "", "keyName": "configDemo", "amiLaunchIndex": 0, "productCodes": [], "instanceType": "t1.micro", "launchTime": "2014-02-26T22:56:35.0000+0000", "placement": { "availabilityZone": "us-west-2b", "groupName": "", "tenancy": "default" }, "kernelId": "aki-fc8f11cc", "monitoring": { "state": "disabled" }, "subnetId": "subnet-47b4cf2c", "vpcId": "vpc-41b4cf2a", "privateIpAddress": "172.31.21.63", "publicIpAddress": "54.218.4.189", "architecture": "x86_64", "rootDeviceType": "ebs", "rootDeviceName": "/dev/sda1", "blockDeviceMappings": [ { "deviceName": "/dev/sda1", "ebs": { "volumeId": "vol-ef0e06ed", "status": "attached", "attachTime": "2014-02-26T22:56:38.0000+0000", "deleteOnTermination": true } }, { "deviceName": "/dev/sdf", "ebs": { "volumeId": "vol-ce676ccc", "status": "attached", "attachTime": "2014-03-07T23:46:28.0000+0000", "deleteOnTermination": false } } ], "virtualizationType": "paravirtual", "clientToken": "aBCDe123456", "tags": [ { "key": "Name", "value": "integ-test-1" }, { "key": "examplekey", "value": "examplevalue" } ], "securityGroups": [ { "groupName": "launch-wizard-2", "groupId": "sg-892adfec" } ], "sourceDestCheck": true, "hypervisor": "xen", "networkInterfaces": [ { "networkInterfaceId": "eni-55c03d22", "subnetId": "subnet-47b4cf2c", "vpcId": "vpc-41b4cf2a", "description": "", "ownerId": "12345678910", "status": "in-use", "privateIpAddress": "172.31.21.63", "privateDnsName": "ip-172-31-21-63.us-west-2.compute.internal", "sourceDestCheck": true, "groups": [ { "groupName": "launch-wizard-2", "groupId": "sg-892adfec" } ], "attachment": { "attachmentId": "eni-attach-bf90c489", "deviceIndex": 0, "status": "attached", "attachTime": "2014-02-26T22:56:35.0000+0000", "deleteOnTermination": true }, "association": { "publicIp": "54.218.4.189", "publicDnsName": "ec2-54-218-4-189.us-west-2.compute.amazonaws.com", "ipOwnerId": "amazon" }, "privateIpAddresses": [ { "privateIpAddress": "172.31.21.63", "privateDnsName": "ip-172-31-21-63.us-west-2.compute.internal", "primary": true, "association": { "publicIp": "54.218.4.189", "publicDnsName": "ec2-54-218-4-189.us-west-2.compute.amazonaws.com", "ipOwnerId": "amazon" } } ] } ], "ebsOptimized": false } } ] }

下一步是驗證已將組態快照成功交付至交付管道。

驗證交付狀態

輸入describe-delivery-channel-status命令以確認是否 AWS Config 已開始將組態傳遞至指定的傳遞通道,例如:

$ aws configservice describe-delivery-channel-status { "DeliveryChannelsStatus": [ { "configStreamDeliveryInfo": { "lastStatusChangeTime": 1415138614.125, "lastStatus": "SUCCESS" }, "configHistoryDeliveryInfo": { "lastSuccessfulTime": 1415148744.267, "lastStatus": "SUCCESS", "lastAttemptTime": 1415148744.267 }, "configSnapshotDeliveryInfo": { "lastSuccessfulTime": 1415333113.4159999, "lastStatus": "SUCCESS", "lastAttemptTime": 1415333113.4159999 }, "name": "default" } ] }

回應會列出三種傳遞格式的狀態,這三種傳遞格式會 AWS Config 用來將組態傳遞至您的儲存貯體和主題。

請查看 configSnapshotDeliveryInfo 中的 lastSuccessfulTime 欄位。時間應該符合您上次請求交付組態快照的時間。

注意

AWS Config 使用 UTC 格式(國際標準時間)來記錄時間。

檢視 Amazon S3 儲存貯體中的組態快照

  1. 登入 AWS Management Console 並開啟 Amazon S3 主控台,網址為 https://console.aws.amazon.com/s3/

  2. 在 Amazon S3 主控台 所有儲存貯體 清單中,按一下 Amazon S3 儲存貯體的名稱。

  3. 按一下儲存貯體中的巢狀資料夾,直到您看到 ConfigSnapshot 物件,而其快照 ID 符合命令所傳回的 ID。下載並開啟物件,以檢視組態快照。

    S3 儲存貯體也包含名為的空檔案ConfigWritabilityCheckFile。 AWS Config 建立此檔案以驗證服務是否可成功寫入 S3 儲存貯體。