I am trying below command after 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 AttributeName=SongTitle,KeyType=RANGE
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Output: Nothing
Please give suggestion how to create dyanmodb table using AWS CLI.
Create the JSON file create-table-movies.json
with the below content
{
"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
}
}
Browse to the file path on DOS command prompt (assuming Windows OS) and execute the below command
Creates the table on local DynamoDB:-
aws dynamodb create-table --cli-input-json file://create-table-movies.json --endpoint-url http://localhost:8000
To create the table on AWS DynamoDB service, please provide the correct region name. If your config is done already, it should work.
aws dynamodb create-table --cli-input-json file://create-table-movies.json --region us-west-2
AWS CLI Configure:-
$ 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]:
Once you execute the above command, it updates the data on your profile (on windows).
C:\Users\<username>\.aws\
Check the following files:-
config - should have the region name
credentials - should have access key and secret key
Credentials Sample:-
[default]
aws_access_key_id = aaaadffewe
aws_secret_access_key = t45435egfdg456retgfg
Config File Sample:-
[default]
region = us-east-1