[Python / Lambda] boto3 sqs client raise botocore.exception.ClientError(Access Denied)

0

[ENV] Trigger Lambda -> ap-northeast-2 SQS queue -> ap-northeast-1 Crawler EC2 -> ap-northeast-1

[Pipeline] Trigger Lambda -> send_message -> SQS queue -> Crawler EC2

[Permission] Trigger Lambda -> queue.grant_send_messages(trigger_lambda) Crawler EC2 -> queue.grant_consume_messages(crawler_cluster_worker)

[Owner] ALL -> root account

[Python Code in Trigger Lambda] sqs_client.send_message( QueueUrl=CRAWLER_SQS_MESSAGE_QUEUE_URL, MessageBody=json.dumps(sqs_message) )

[Trigger Lambda's Error Detail] [ERROR] ClientError: An error occurred (AccessDenied) when calling the SendMessage operation: Access to the resource https://sqs.ap-northeast-1.amazonaws.com/ is denied. Traceback (most recent call last): File "/var/task/main.py", line 136, in lambda_handler raise e File "/var/task/main.py", line 116, in lambda_handler sqs_client.send_message( File "/var/task/botocore/client.py", line 530, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/task/botocore/client.py", line 960, in _make_api_call raise error_class(parsed_response, operation_name)

[Question] The trigger lambda failed an sending sqs message always succeeded. There are no issues with permissions and regions. It is judged to be a temporary error. Can you tell me what could be the reason for the temporary error?

1개 답변
1
수락된 답변

If you're seeing this error all the time then the Lambda function doesn't have permission to send to that SQS queue. Check the IAM permissions and the role assigned to the Lambda function.

If you're seeing this error intermittently then there is something wrong - please contact our support team so that they can investigate. Here on re:Post we don't have access to your details, your account and the services that you're using. This is a forum for general advice; the support team are there to help with troubleshooting these types of issues.

profile pictureAWS
전문가
답변함 일 년 전
  • Thank you for answer. We will contact the aws support team.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인