为终端节点服务创建和管理通知
您可以创建通知以针对在连接到您的终端节点服务的终端节点上发生的特定事件接收提醒。例如,您可以在接受或拒绝针对您的终端节点服务的终端节点请求时收到电子邮件。要创建通知,您必须将 Amazon SNS 主题与通知关联。您可以订阅 SNS 主题以在终端节点事件发生时收到电子邮件通知。有关更多信息,请参阅 Amazon Simple Notification Service 开发人员指南。
用于通知的 Amazon SNS 主题必须具有允许 Amazon VPC 终端节点服务代表您发布通知的主题策略。确保在您的主题策略中包含以下语句。有关更多信息,请参阅 Amazon Simple Notification Service 开发人员指南 中的管理对 Amazon SNS 主题的访问权限。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "vpce.amazonaws.com" }, "Action": "SNS:Publish", "Resource": "arn:aws:sns:region:account:topic-name" } ] }
- Console
-
为终端节点服务创建通知
-
通过以下网址打开 Amazon VPC 控制台:https://console.aws.amazon.com/vpc/
。 -
在导航窗格中,选择 Endpoint Services,然后选择您的终端节点服务。
-
选择 Notifications、Create Notification。
-
选择要与通知关联的 SNS 主题的 ARN。
-
对于 Events,选择要接收其通知的终端节点事件。
-
选择 Create Notification。
创建通知后,您可以更改与通知关联的 SNS 主题。还可以为通知指定不同的终端节点事件。
为终端节点服务修改通知
-
通过以下网址打开 Amazon VPC 控制台:https://console.aws.amazon.com/vpc/
。 -
在导航窗格中,选择 Endpoint Services,然后选择您的终端节点服务。
-
选择 Notifications、Actions、Modify Notification。
-
指定 SNS 主题的 ARN 并根据需要选择或取消选择终端节点事件。
-
选择 Modify Notification。
如果您不再需要某通知,则可删除它。
删除通知
-
通过以下网址打开 Amazon VPC 控制台:https://console.aws.amazon.com/vpc/
。 -
在导航窗格中,选择 Endpoint Services,然后选择您的终端节点服务。
-
依次选择 Notifications、Actions、Delete Notification。
-
选择 Yes, Delete。
-
- AWS CLI
-
使用 AWS CLI 创建和管理通知
-
要为终端节点服务创建通知,请使用 create-vpc-endpoint-connection-notification 命令并指定 SNS 主题的 ARN、要通知的事件以及终端节点服务的 ID。
aws ec2 create-vpc-endpoint-connection-notification --connection-notification-arn
arn:aws:sns:us-east-2:123456789012:VpceNotification
--connection-events Connect Accept Delete Reject --service-idvpce-svc-1237881c0d25a3abc
{ "ConnectionNotification": { "ConnectionNotificationState": "Enabled", "ConnectionNotificationType": "Topic", "ServiceId": "vpce-svc-1237881c0d25a3abc", "ConnectionEvents": [ "Reject", "Accept", "Delete", "Connect" ], "ConnectionNotificationId": "vpce-nfn-008776de7e03f5abc", "ConnectionNotificationArn": "arn:aws:sns:us-east-2:123456789012:VpceNotification" } }
-
要查看您的通知,请使用 describe-vpc-endpoint-connection-notifications 命令。
aws ec2 describe-vpc-endpoint-connection-notifications
-
要更改通知的 SNS 主题或终端节点事件,请使用 modify-vpc-endpoint-connection-notification 命令。
aws ec2 modify-vpc-endpoint-connection-notification --connection-notification-id
vpce-nfn-008776de7e03f5abc
--connection-events Accept Reject --connection-notification-arnarn:aws:sns:us-east-2:123456789012:mytopic
-
要删除通知,请使用 delete-vpc-endpoint-connection-notifications 命令。
aws ec2 delete-vpc-endpoint-connection-notifications --connection-notification-ids
vpce-nfn-008776de7e03f5abc
-
- AWS Tools for Windows PowerShell
-
使用 New-EC2VpcEndpointConnectionNotification、Get-EC2EndpointConnectionNotification、Edit-EC2VpcEndpointConnectionNotification 和 Remove-EC2EndpointConnectionNotification。
- API
-
使用 CreateVpcEndpointConnectionNotification、DescribeVpcEndpointConnectionNotifications、ModifyVpcEndpointConnectionNotification 和 DeleteVpcEndpointConnectionNotifications。