Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rule Request] Unused DynamoDB AttributeDefinitions #1037

Closed
PatMyron opened this issue Jul 18, 2019 · 0 comments
Closed

[Rule Request] Unused DynamoDB AttributeDefinitions #1037

PatMyron opened this issue Jul 18, 2019 · 0 comments
Assignees
Labels
new rule New rule

Comments

@PatMyron
Copy link
Contributor

PatMyron commented Jul 18, 2019

Declaring DynamoDB AttributeDefinitions without using them as keys led to errors like these:

Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes - CloudFormation

An error occurred (ValidationException) when calling the CreateTable operation: One or more parameter values were invalid: Some AttributeDefinitions are not used. AttributeDefinitions: [Album, Artist, Sales], keys used: [Album, Artist] - Boto

$ aws dynamodb create-table --table-name table --billing-mode PAY_PER_REQUEST --attribute-definitions AttributeName=Artist,AttributeType=S --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE

An error occurred (ValidationException) when calling the CreateTable operation: Invalid KeySchema: Some index key attribute have no definition

$ aws dynamodb create-table --table-name table --billing-mode PAY_PER_REQUEST --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S --key-schema AttributeName=Artist,KeyType=HASH

An error occurred (ValidationException) when calling the CreateTable operation: One or more parameter values were invalid: Number of attributes in KeySchema does not exactly match number of attributes defined in AttributeDefinitions

Minimal examples of templates that pass cfn-lint but fail to deploy: #1044


https://stackoverflow.com/questions/38142870/cloudformation-insists-my-dynamodb-creation-json-is-invalid-but-i-cant-see-h
https://stackoverflow.com/questions/41915749/propertydefinition-inconsistent

@kddejong kddejong added the new rule New rule label Jul 27, 2019
@PatMyron PatMyron self-assigned this Jan 5, 2020
@PatMyron PatMyron closed this as completed Jan 5, 2020
kddejong added a commit that referenced this issue Feb 15, 2020
* DynamoDB inconsistent AttributeDefinitions / KeySchemas

#1037

* fixing DynamoDB test template

* add testing

* fix lint error

* sorting AttributeDefinitions and KeySchemas lists

Co-authored-by: Kevin DeJong <kddejong@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule
Projects
None yet
Development

No branches or pull requests

2 participants