Amazon dynamodb 使用AWS CLI创建dynamodb表
在aws之后,我正在尝试低于命令Amazon dynamodb 使用AWS CLI创建dynamodb表,amazon-dynamodb,aws-cli,Amazon Dynamodb,Aws Cli,在aws之后,我正在尝试低于命令 --configure command: aws dynamodb create-table --table-name MusicCollection2 --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S -- key-schema AttributeName=Artist,KeyType=HASH A
--configure command:
aws dynamodb create-table
--table-name MusicCollection2
--attribute-definitions
AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S --
key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
输出:无
请给出如何使用AWS CLI创建dyanmodb表的建议
Create table movies.JSON
{
"TableName": "MusicCollection2",
"KeySchema": [
{ "AttributeName": "Artist", "KeyType": "HASH" },
{ "AttributeName": "SongTitle", "KeyType": "RANGE" }
],
"AttributeDefinitions": [
{ "AttributeName": "Artist", "AttributeType": "S" },
{ "AttributeName": "SongTitle", "AttributeType": "S" }
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}
aws dynamodb create-table --cli-input-json file://create-table-movies.json --endpoint-url http://localhost:8000
$ aws configure
AWS Access Key ID [None]: accesskey
AWS Secret Access Key [None]: secretkey
Default region name [None]: us-west-2
Default output format [None]:
config - should have the region name
credentials - should have access key and secret key
[default]
aws_access_key_id = aaaadffewe
aws_secret_access_key = t45435egfdg456retgfg
[default]
region = us-east-1
要在AWS DynamoDB服务上创建表,请提供正确的区域名称。如果您的配置已经完成,它应该可以工作。
aws dynamodb create-table --cli-input-json file://create-table-movies.json --region us-west-2
AWS CLI配置:-
aws dynamodb create-table --cli-input-json file://create-table-movies.json --endpoint-url http://localhost:8000
$ aws configure
AWS Access Key ID [None]: accesskey
AWS Secret Access Key [None]: secretkey
Default region name [None]: us-west-2
Default output format [None]:
config - should have the region name
credentials - should have access key and secret key
[default]
aws_access_key_id = aaaadffewe
aws_secret_access_key = t45435egfdg456retgfg
[default]
region = us-east-1
执行上述命令后,它将更新配置文件上的数据(在windows上)
凭证样本:-
aws dynamodb create-table --cli-input-json file://create-table-movies.json --endpoint-url http://localhost:8000
$ aws configure
AWS Access Key ID [None]: accesskey
AWS Secret Access Key [None]: secretkey
Default region name [None]: us-west-2
Default output format [None]:
config - should have the region name
credentials - should have access key and secret key
[default]
aws_access_key_id = aaaadffewe
aws_secret_access_key = t45435egfdg456retgfg
[default]
region = us-east-1
配置文件示例:-
aws dynamodb create-table --cli-input-json file://create-table-movies.json --endpoint-url http://localhost:8000
$ aws configure
AWS Access Key ID [None]: accesskey
AWS Secret Access Key [None]: secretkey
Default region name [None]: us-west-2
Default output format [None]:
config - should have the region name
credentials - should have access key and secret key
[default]
aws_access_key_id = aaaadffewe
aws_secret_access_key = t45435egfdg456retgfg
[default]
region = us-east-1
我得到以下错误:CreateTable操作:“Access”不是有效的键=值对(缺少等号),我缺少什么?更新了答案,包含所有必需的详细信息。如果您有我在回答中提到的详细信息,但仍然出现一些错误,那么问题可能出在您的访问密钥上。谢谢@conceptquest。您能告诉我使用一个json文件创建多个表的想法吗?我将检查可行性。你原来的问题解决了吗?如果是,请接受答案。不幸的是,除了@conceptquest的答案之外,我没有看到使用一个JSON文件创建两个表的方法(即命令不接受创建表请求数组),下面是