0
AWS Dynamodb에서 샘플 코드를 실행할 수 없습니다.AWS DynamoDB Python 연결 오류
웹 사이트에서 제공하는 AWS 샘플 Python 코드를 실행하려고합니다. 그때 내가 터미널에서 파이썬 파일을 실행
from __future__ import print_function # Python 2/3 compatibility
import boto3
dynamodb = boto3.resource('dynamodb', region_name='us-west-2', endpoint_url="http://localhost:8000")
table = dynamodb.create_table(
TableName='Movies',
KeySchema=[
{
'AttributeName': 'year',
'KeyType': 'HASH' #Partition key
},
{
'AttributeName': 'title',
'KeyType': 'RANGE' #Sort key
}
],
AttributeDefinitions=[
{
'AttributeName': 'year',
'AttributeType': 'N'
},
{
'AttributeName': 'title',
'AttributeType': 'S'
},
],
ProvisionedThroughput={
'ReadCapacityUnits': 10,
'WriteCapacityUnits': 10
}
)
print("Table status:", table.table_status)
나는 다음과 같은 오류 얻을 : 여기 내 파이썬 파일입니다 DynamoDB의이 실행되지 않을 때
File "MoviesCreateTable.py", line 32, in <module>
'WriteCapacityUnits': 10
File "/home/name/.local/lib/python2.7/site-packages/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs)
File "/home/name/.local/lib/python2.7/site-packages/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/home/name/.local/lib/python2.7/site-packages/botocore/client.py", line 159, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/name/.local/lib/python2.7/site-packages/botocore/client.py", line 483, in _make_api_call
operation_model, request_dict)
File "/home/name/.local/lib/python2.7/site-packages/botocore/endpoint.py", line 141, in make_request
return self._send_request(request_dict, operation_model)
File "/home/name/.local/lib/python2.7/site-packages/botocore/endpoint.py", line 170, in _send_request
success_response, exception):
File "/home/name/.local/lib/python2.7/site-packages/botocore/endpoint.py", line 249, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)
File "/home/name/.local/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
return self._emit(event_name, kwargs)
File "/home/name/.local/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
response = handler(**kwargs)
File "/home/name/.local/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/home/name/.local/lib/python2.7/site-packages/botocore/retryhandler.py", line 251, in __call__
caught_exception)
File "/home/name/.local/lib/python2.7/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/home/name/.local/lib/python2.7/site-packages/botocore/retryhandler.py", line 317, in __call__
caught_exception)
File "/home/name/.local/lib/python2.7/site-packages/botocore/retryhandler.py", line 223, in __call__
attempt_number, caught_exception)
File "/home/name/.local/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
botocore.vendored.requests.exceptions.ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))
감사합니다. 로컬 컴퓨터 대신 AWS에서 실제로 테이블을 만드는 방법은 무엇입니까? – jacob
@acsrujan도 aws dynamodb를 연결하는 방법,'endpoint_url'을 설정하는 방법을 알고 싶습니다. – Mil0R3