Ошибка ниже, когда я пытаюсь подключить кластер красных смещений.
Я импортировал все библиотеки для запуска кода Python на моей лямбде.
Запуск кода Python выдает ошибку.
import json
import boto3
import os
import psycopg2
import base64
from datetime import datetime
import logging
import sys
import hashlib
import urllib
import platform
def lambda_test():
print('hello')
conn_string = "dbname='dev' port='5439' user='my-user' password='my-password' host='redshift-cluster-1.calcocahphdx.us-east-1.redshift.amazonaws.com:5439'"
conn = psycopg2.connect(conn_string)
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
lambda_test()
Ответ:
{
"errorMessage": "module initialization error"
}
Request ID:
"e9a8c853-f0d0-486c-8210-5c39fb7f660b"
Function Logs:
START RequestId: e9a8c853-f0d0-486c-8210-5c39fb7f660b Version: $LATEST
module initialization error: could not translate host name "redshift-cluster-1.calcocahphdx.us-east-1.redshift.amazonaws.com:5439" to address: Name or service not known
END RequestId: e9a8c853-f0d0-486c-8210-5c39fb7f660b
REPORT RequestId: e9a8c853-f0d0-486c-8210-5c39fb7f660b Duration: 510.13 ms Billed Duration: 600 ms Memory Size: 128 MB Max Memory Used: 61 MB
module initialization error
could not translate host name "redshift-cluster-1.calcocahphdx.us-east-1.redshift.amazonaws.com:5439" to address: Name or service not known