| new skills - Team Nuggets
New Training: Managing Amazon DynamoDB with Python and Boto3
In this 8-video skill, CBT Nuggets trainer Trevor Sullivan demonstrates how to use the boto3 library from AWS to manage Amazon DynamoDB resources and read/write items into DynamoDB tables. Watch this new DevOps training.
Learn DevOps with one of these courses:
- AWS Cloud Automation with Python
- AWS Cloud Automation
This training includes:
- 8 videos
- 1.2 hours of training
You’ll learn these topics in this skill:
- Introduction to Amazon DynamoDB and Python Boto3 SDK
- Configure Amazon DynamoDB and Python Boto3 Development Environment
- Create an Amazon DynamoDB Table with Python
- Enable Amazon DynamoDB Streams with Python Boto3
- Create an Amazon DynamoDB Global Table with Python
- Add Items to Amazon DynamoDB Table with Python
- Restore Amazon DynamoDB Table with Point-in-time-Restore from Python
- Scale Provisioned Throughput for Amazon DynamoDB Tables using Python
How to Create a New Table in DynamoDB with Python
Creating a new table in DynamoDB with Python is straightforward. Before being able to work with DynamoDB with Python, you will first need to install the Boto3 library for Python. The Boto3 library is a library offered by AWS to integrate the AWS SDK into Python.
To install the Boto3 package in Python, use the Python package manager called Pip. The package name for Boto3 is simply 'boto3', so issuing an install command with Pip with that package name will install boto3 and its required dependencies.
After Boto3 is installed, it needs to be configured with the AWS credentials. Don't forget to create an IAM profile in AWS for Boto3 with any required permissions it may need. AWS credentials for Boto3 can either be configured in a common AWS credentials file or programmatically in the Boto3.client function. These credentials will be used with all Boto3 functions when using Boto3 to manage DynamoDB.
After Boto3 is installed, first instantiate the DynamoDB resource in Python and assign it to a variable.
After instantiating the DynamoDB resource, call the create_table function to create a new table in DynamoDB. It's common to create the schema for that new table within calling that function:
That's it! You have created a new table in DynamoDB with Python.