如何在无服务器中将 vpc 端点与 ses 一起使用

Shu*_*ham 5 amazon-ses aws-sdk-nodejs serverless

我在没有 nat 网关/互联网访问的 vpc 中部署了功能。目标:从此函数通过 SES 发送电子邮件(在 vpc 中)

我尝试过使用公共私有子网和 nat 网关来发送电子邮件,效果很好。但我正在尝试通过 VPC 端点使用它。我已经创建了一个电子邮件 vpc 端点,但不确定如何在 serverless.yml 中配置它。已尝试按照https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/中所述设置配置

但没有任何作用,因为没有提到 ses。

小智 5

您需要以下配置以便 CloudFormation 创建资源。(注意括号中的变量)

resources:
  Resources:  
    VPCEndpointForSES:
      Type: AWS::EC2::VPCEndpoint
      Properties:
        PrivateDnsEnabled: True
        SecurityGroupIds:
          - <ID of the VPC Security Group>
        ServiceName: 'com.amazonaws.<AWS Region String>.email-smtp'
        SubnetIds:
          - <Subnet of your VPC>
          - <Subnet of your VPC>
          - <Subnet of your VPC>
        VpcEndpointType: Interface
        VpcId: <ID of your VPC>
Run Code Online (Sandbox Code Playgroud)


Fra*_*cis 0

您是否查看过适用于 VPC 终端节点的 AWS PrivateLink?

\n

您无需设置 Internet 网关、NAT 设备、VPN 连接或 AWS Direct Connect 连接。您的 VPC 可以使用 AWS PrivateLink 与 Amazon 网络内的 AWS SES 进行通信。

\n

请注意,VPC 终端节点当前不支持跨区域请求\xe2\x80\x94请确保您在计划向 Amazon SES 发出 API 调用的同一区域中创建终端节点。

\n

您需要创建一个安全组和一个 VPC 接口点。这里有一个分步示例

\n

其他资源: AWS PrivateLink 接口终端节点

\n