Я создал лямбда-функцию, которая создаст таблицу в Dynamodb. Я использую localstack. Проблема в том, что таблица создается, но не отображается в Dynamodb при использовании команды aws Dynamodb list-tables --endpoint-url http: // localhost: 4566
мой код лямбда-функции:
dynamodb = boto3.resource('dynamodb', aws_access_key_id='',aws_secret_access_key='',endpoint_url="http://<ip address>:4566")
def lambda_handler(event, context):
movie_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:", movie_table.table_status)
Также получение EndpointConnectionError, если указано значение endpoint-url = http: // localhost: 4566
template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: >
AWS
Sample SAM Template for AWS
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 60
Resources:
AddItem:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: dynamodbAddItem/
Handler: app.lambda_handler
Runtime: python3.7