Unable to provision DynamoDB table using CloudFormation

Issue #56 resolved
Steffan Westcott created an issue

I'm having problems creating a very basic CloudFormation stack which contains a single DynamoDB table.

I'm using the latest Docker image of localstack:

$ docker image ls
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
atlassianlabs/localstack   latest              8ec4e6975e03        10 hours ago        1.2GB

The command to create the stack is as follows:

awslocal cloudformation create-stack --template-body file://simple.json --stack-name simple-stack

The content of simple.json is as follows:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Resources": {
        "TableCustomFieldsCustomFields": {
            "Type": "AWS::DynamoDB::Table",
            "Properties": {
                "AttributeDefinitions": [
                    {
                        "AttributeName": "id",
                        "AttributeType": "S"
                    }
                ],
                "KeySchema": [
                    {
                        "AttributeName": "id",
                        "KeyType": "HASH"
                    }
                ],
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": 5,
                    "WriteCapacityUnits": 5
                },
                "TableName": "myTable"
            }
        }
    }
}

On running the command, I get this error in the logs (which I suspect is not really helpful)

ERROR:localstack.services.generic_proxy:Error forwarding request: An error occurred (ValidationError) when calling the DescribeStackResources operation: Stack with id simple-stack does not exist Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/generic_proxy.py", line 144, in forward
data=data, headers=forward_headers, response=response)
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_listener.py", line 175, in update_cloudformation
template_deployer.deploy_template(template, req_data.get('StackName')[0])
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 443, in deploy_template
stack_resources = describe_stack_resources(stack_name, resource_id)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 192, in describe_stack_resources
resources = client.describe_stack_resources(StackName=stack_name, LogicalResourceId=logical_resource_id)
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/botocore/client.py", line 557, in _make_api_call
raise error_class(parsed_response, operation_name)
ClientError: An error occurred (ValidationError) when calling the DescribeStackResources operation: Stack with id simple-stack does not exist

Creating the DynamoDB table directly (without CloudFormation) appears to work correctly:

$ awslocal dynamodb create-table \
    --table-name \
        myTable \
    --attribute-definitions \
        AttributeName=id,AttributeType=S \
    --key-schema \
        AttributeName=id,KeyType=HASH \
    --provisioned-throughput \
        ReadCapacityUnits=5,WriteCapacityUnits=5

$ awslocal dynamodb list-tables
{
    "TableNames": [
        "myTable"
    ]
}

Comments (3)

  1. Log in to comment