AWS Direct Connect
用户指南
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。点 击 Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

在 AWS CloudTrail 中记录 AWS Direct Connect API 调用

AWS Direct Connect 与 AWS CloudTrail 集成在一起,后者是一个可捕获由 AWS 账户或代表 AWS 账户进行的 API 调用的服务。此信息在收集后写入存储在您指定的 Amazon Simple Storage Service (S3) 存储桶中的日志文件。当您使用 AWS Direct Connect API、AWS Direct Connect 控制台、后端控制台或 AWS CLI 时,将会记录 API 调用。使用由 CloudTrail 收集的信息,您可以确定向 AWS Direct Connect 发出了什么请求、发出请求的源 IP 地址、谁发出的请求以及发出请求的时间等。

要了解有关 CloudTrail 的更多信息(包括如何配置和启用它),请参阅 AWS CloudTrail 用户指南

CloudTrail 中的 AWS Direct Connect 信息

如果启用了 CloudTrail 日志记录,则会将对所有 AWS Direct Connect 操作的调用捕获在日志文件中。AWS Direct Connect API Reference 中记载了所有 AWS Direct Connect 操作。例如,对 CreateConnectionCreatePrivateVirtualInterfaceDescribeConnections 操作的调用会在 CloudTrail 日志文件中生成相应条目。

每个日志条目都包含有关生成请求的人员的信息。例如,如果发出了创建与 AWS Direct Connect 间的新连接的请求 (CreateConnection),那么 CloudTrail 将记录发出该请求的人或服务的用户身份。用户身份信息有助于您确定该请求是使用根证书、AWS Identity and Access Management (IAM) 用户证书、适用于某个角色或联合身份用户的临时安全证书发出的,还是由 AWS 中的另一个服务发出的。有关 CloudTrail 字段的更多信息,请参阅 AWS CloudTrail 用户指南中的 CloudTrail 事件参考

日志文件可以在存储桶中存储任意长时间,不过您也可以定义 Amazon S3 生命周期规则以自动存档或删除日志文件。默认情况下,将使用 Amazon S3 服务器端加密 (SSE) 对日志文件进行加密。

了解 AWS Direct Connect 日志文件条目

CloudTrail 日志文件可包含一个或多个日志条目,每个条目由多个 JSON 格式的事件组成。一个日志条目表示来自任何源的一个请求,并包括所请求的操作、所有输入参数以及操作的日期和时间等信息。日志条目不按任何特定顺序显示。也就是说,它们不表示公用 API 调用的有序堆栈跟踪。

以下日志文件记录显示一个用户调用了 CreateConnection 操作。

{
    "Records": [{
        "eventVersion": "1.0",
        "userIdentity": {
            "type": "IAMUser",
            "principalId": "EX_PRINCIPAL_ID",
            "arn": "arn:aws:iam::123456789012:user/Alice",
            "accountId": "123456789012",
            "accessKeyId": "EXAMPLE_KEY_ID",
            "userName": "Alice",
            "sessionContext": {
                "attributes": {
                    "mfaAuthenticated": "false",
                    "creationDate": "2014-04-04T12:23:05Z"
                }
            }
        },
        "eventTime": "2014-04-04T17:28:16Z",
        "eventSource": "directconnect.amazonaws.com",
        "eventName": "CreateConnection",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Coral/Jakarta",
        "requestParameters": {
            "location": "EqSE2",
            "connectionName": "MyExampleConnection",
            "bandwidth": "1Gbps"
        },
        "responseElements": {
            "location": "EqSE2",
            "region": "us-west-2",
            "connectionState": "requested",
            "bandwidth": "1Gbps",
            "ownerAccount": "123456789012",
            "connectionId": "dxcon-fhajolyy",
            "connectionName": "MyExampleConnection"
        }
    },
    ...additional entries
  ]
}

以下日志文件记录显示一个用户调用了 CreatePrivateVirtualInterface 操作。

{
    "Records": [
    {
        "eventVersion": "1.0",
        "userIdentity": {
            "type": "IAMUser",
            "principalId": "EX_PRINCIPAL_ID",
            "arn": "arn:aws:iam::123456789012:user/Alice",
            "accountId": "123456789012",
            "accessKeyId": "EXAMPLE_KEY_ID",
            "userName": "Alice",
            "sessionContext": {
                "attributes": {
                    "mfaAuthenticated": "false",
                    "creationDate": "2014-04-04T12:23:05Z"
                }
            }
        },
        "eventTime": "2014-04-04T17:39:55Z",
        "eventSource": "directconnect.amazonaws.com",
        "eventName": "CreatePrivateVirtualInterface",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Coral/Jakarta",
        "requestParameters": {
            "connectionId": "dxcon-fhajolyy",
            "newPrivateVirtualInterface": {
                "virtualInterfaceName": "MyVirtualInterface",
                "customerAddress": "[PROTECTED]",
                "authKey": "[PROTECTED]",
                "asn": -1,
                "virtualGatewayId": "vgw-bb09d4a5",
                "amazonAddress": "[PROTECTED]",
                "vlan": 123
            }
        },
        "responseElements": {
            "virtualInterfaceId": "dxvif-fgq61m6w",
            "authKey": "[PROTECTED]",
            "virtualGatewayId": "vgw-bb09d4a5",
            "customerRouterConfig": "[PROTECTED]",
            "virtualInterfaceType": "private",
            "asn": -1,
            "routeFilterPrefixes": [],
            "virtualInterfaceName": "MyVirtualInterface",
            "virtualInterfaceState": "pending",
            "customerAddress": "[PROTECTED]",
            "vlan": 123,
            "ownerAccount": "123456789012",
            "amazonAddress": "[PROTECTED]",
            "connectionId": "dxcon-fhajolyy",
            "location": "EqSE2"
        }
    },
    ...additional entries
  ]
}

以下日志文件记录显示一个用户调用了 DescribeConnections 操作。

{
    "Records": [
    {
        "eventVersion": "1.0",
        "userIdentity": {
            "type": "IAMUser",
            "principalId": "EX_PRINCIPAL_ID",
            "arn": "arn:aws:iam::123456789012:user/Alice",
            "accountId": "123456789012",
            "accessKeyId": "EXAMPLE_KEY_ID",
            "userName": "Alice",
            "sessionContext": {
                "attributes": {
                    "mfaAuthenticated": "false",
                    "creationDate": "2014-04-04T12:23:05Z"
                }
            }
        },
        "eventTime": "2014-04-04T17:27:28Z",
        "eventSource": "directconnect.amazonaws.com",
        "eventName": "DescribeConnections",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Coral/Jakarta",
        "requestParameters": null,
        "responseElements": null
    },
    ...additional entries
  ]
}

以下日志文件记录显示一个用户调用了 DescribeVirtualInterfaces 操作。

{
    "Records": [
    {
        "eventVersion": "1.0",
        "userIdentity": {
            "type": "IAMUser",
            "principalId": "EX_PRINCIPAL_ID",
            "arn": "arn:aws:iam::123456789012:user/Alice",
            "accountId": "123456789012",
            "accessKeyId": "EXAMPLE_KEY_ID",
            "userName": "Alice",
            "sessionContext": {
                "attributes": {
                    "mfaAuthenticated": "false",
                    "creationDate": "2014-04-04T12:23:05Z"
                }
            }
        },
        "eventTime": "2014-04-04T17:37:53Z",
        "eventSource": "directconnect.amazonaws.com",
        "eventName": "DescribeVirtualInterfaces",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Coral/Jakarta",
        "requestParameters": {
            "connectionId": "dxcon-fhajolyy"
        },
        "responseElements": null
    },
    ...additional entries
  ]
}