Create DynamoDB Table Using AWS CLI
To create a table in DynamoDB using AWS CLI, configure the AWS by typing the following command on the Command Prompt:
To configure the AWS CLI, provide the credentials mentioned in the following screenshot. After that, the AWS CLI will be configured to use the AWS services:
To check the tables available on the DynamoDB, use the following command:
Running this command will display the list of all the tables present on the AWS DynamoDB:
The following is the syntax for the command to create the table in DynamoDB in AWS:
--table-name [table_name]
--attribute-definitions [attribute_definition(s)]
--key-schema [key_schema]
--provisioned-throughput [provisioned_throughput]
[other options]
If you wish to create a new table using the Syntax mentioned above, then simply fill in the values of the attributes accordingly, for example, to create a table for Music Collection, then command will become:
--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
--tags Key=Owner, Value=blueTeam
Side Note: Fill in the values of the attributes according to the table that you want to create
Executing the command will produce this output onto the terminal:
The table has been created on DynamoDB using the above command:
You have successfully created the DynamoDB table using the AWS CLI:
Conclusion
To create the DynamoDB table using the AWS CLI, simply configure the AWS CLI using the command prompt. After that, use the syntax and demo command available in the post. Running the command will create the table in AWS DynamoDB. This post has taught you how to create a table in AWS DynamoDB using the AWS CLI.
from https://ift.tt/ArqDzh7
0 Comments