When creating DynamoDB with the following options(the length of attribute name is 2):
$ copilot storage init -n todotable -t "DynamoDB" -w backend --partition-key Id:S --no-lsi --no-sort
Copilot throws the following error:
✘ value must contain only alphanumeric characters and ._-
If the length of DynamoDB table's attribute name is longer like following:
$ copilot storage init -n todotable -t "DynamoDB" -w backend --partition-key TodoId:S --no-lsi --no-sort
Copilot wrote CFn template successfully.
✔ Wrote CloudFormation template for DynamoDB Table todotable at copilot/backend/addons/todotable.yml
According to DynamoDB's naming rule(https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.NamingRules ), attribute names must be at least one character long.
Validation for the length of partition key name is needed in validateKey function
|
func validateKey(val interface{}) error { |
When creating DynamoDB with the following options(the length of attribute name is 2):
$ copilot storage init -n todotable -t "DynamoDB" -w backend --partition-key Id:S --no-lsi --no-sortCopilot throws the following error:
✘ value must contain only alphanumeric characters and ._-If the length of DynamoDB table's attribute name is longer like following:
$ copilot storage init -n todotable -t "DynamoDB" -w backend --partition-key TodoId:S --no-lsi --no-sortCopilot wrote CFn template successfully.
✔ Wrote CloudFormation template for DynamoDB Table todotable at copilot/backend/addons/todotable.ymlAccording to DynamoDB's naming rule(https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.NamingRules ), attribute names must be at least one character long.
Validation for the length of partition key name is needed in validateKey function
copilot-cli/internal/pkg/cli/validate.go
Line 515 in d5d54a5