AWS Lambda: Unable to access SQS Queue from a Lambda function with VPC access

后端 未结 5 2065
独厮守ぢ
独厮守ぢ 2021-02-07 07:25

I have a Lambda function that needs to read messages from an SQS queue using it\'s URL. Then it needs to insert that data to Cassandra running on a server inside a VPC.

5条回答
  •  孤街浪徒
    2021-02-07 08:05

    At the end of 2018, AWS announced support for SQS endpoints which provide

    connectivity to Amazon SQS without requiring an internet gateway, network address translation (NAT) instance, or VPN connection.

    There is a tutorial for Sending a Message to an Amazon SQS Queue from Amazon Virtual Private Cloud

    See also the SQS VPC Endpoints Documentation for more information.

    Its important to note that if you want to access SQS within the Lambda VPC there are a couple other things you need to do:

    • Make sure to specify the SQS region in your code. For example, I had to set my endpoint_url to "https://sqs.us-west-2.amazonaws.com"
    • Make sure that you have attached a "wide open" security group to the SQS VPC Interface, otherwise SQS will not work.
    • Make sure that your subnets in your Lambda VPC match what you have set up for your SQS VPC Interface.

提交回复
热议问题