为终端节点服务创建和管理通知
您可以创建通知以针对在连接到您的终端节点服务的终端节点上发生的特定事件接收提醒。例如,您可以在接受或拒绝针对您的终端节点服务的终端节点请求时收到电子邮件。要创建通知,您必须将 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/
。 -
在导航窗格中,选择终端节点服务。
-
选择端点服务然后选择 Notifications(通知)选项卡。
-
选择 Create notification(创建通知)。
-
对于 Notification ARN(通知 ARN),选择要与通知关联的 SNS 主题的 ARN。
-
对于 Events(事件),选择要接收其通知的端点事件。
-
选择 Create notification(创建通知)。
创建通知后,您可以修改其设置。
为终端节点服务修改通知
通过以下网址打开 Amazon VPC 控制台:https://console.aws.amazon.com/vpc/
。 -
在导航窗格中,选择终端节点服务。
-
选择端点服务然后选择 Notifications(通知)选项卡。
-
选择通知,然后依次选择 Actions(操作)、Modify notification(修改通知)。
-
根据要求更改 SNS 主题和端点事件。
-
选择保存更改。
如果您不再需要某通知,则可删除它。
删除通知
通过以下网址打开 Amazon VPC 控制台:https://console.aws.amazon.com/vpc/
。 -
在导航窗格中,选择终端节点服务。
-
选择端点服务然后选择 Notifications(通知)选项卡。
-
选择通知,然后依次选择 Actions(操作)、Delete notification(删除通知)。
-
提示进行确认时,输入
delete
,然后选择 Delete(删除)。
- Amazon 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
- Tools for Windows PowerShell
- API