One of the great things about the AWS command-line tool is that you can do pretty much any AWS operation with it.
For today’s example, we’re going to show you how to easily create a new DynamoDB table.
Step 1: Set Up Your AWS CLI Credentials
Create the file
~/.aws/config and add a block like the following:
This will let you run authenticated AWS commands with
Step 2: Create the Table JSON File
The easiest way to create a new table is by passing a JSON file with the table schema to the AWS CLI tool.
You can read the create-table documentation to get an idea of all the available options.
You can also use the following command to view the schema of an existing table if you’re going to create something similar:
aws --profile=via dynamodb describe-table --table-name=MyTable
(Note: You won’t be able to use the exact output above to create a new table. First, you’ll have to remove any “Arn”, “Size”, “NumberOfDecreasesToday”, “Count”, and date/time attributes.)
Here’s a sample schema which creates the table
Items with two attributes,
Step 3: Create the Table
Once you have the JSON schema, creating the new table is super simple.
Assuming your JSON file is called Items.json, just run the following command:
aws --profile=via dynamodb create-table --cli-input-json file://Items.json
That’s all there is to it. Now go take a look at all the other neat things you can do with
Dive into the Sanity Structure Builder
By: Mark Biek on 6/13/2021
Sanity is the super fast, super customizable CMS that we're using as the backend for the new via.studio website. One of the more powerful concepts that Sanity is the Structure Builder which gives you the ability to customize how content is presented in the Sanity admin.Read More »
Wordpress to Sanity Data Script
By: Nick Stewart on 3/11/2021
One of the biggest challenges of moving from one CMS to another is getting your existing data to the new platform. In our case, we were moving our existing WordPress platform, which had been around for years, over to the Sanity.io platform.Read More »