Cloud

Boto3 AWS SDK for Python

A man and woman collaborating and discussing work on a computer

Using Boto 3, you can integrate your Python application, library, or script with Amazon S3, Amazon EC2, Amazon DynamoDB, and more.

Key Features of Boto3

  1. Resource APIs.
  2. Up-to-date and Consistent Interface.
  3. Support for Python 2 and 3.
  4. Waiters.
  5. Service-specific High-level Features.

Resource APIs

Boto 3 has two distinct levels of APIs. Client APIs provide a one-to-one mapping to underlying HTTP API operations. Using resource APIs, characteristics and activities are accessed through resource objects and collections rather than through explicit network calls.

Up-to-date and Consistent Interface

AWS APIs are described by JSON models that are dynamically inserted into Boto3 client and resource interfaces. As a result, we are able to provide speedy updates across all the services we support.

Support for Python 2 and 3

Boto3 supports Python 2.7+ and 3.4+ natively.

Waiters

Boto3 comes with ‘waiters,’ which automatically poll AWS resources for predefined changes. For example, you can start an Amazon EC2 instance and use a waiter to wait until it reaches the ‘running’ state, or create a new Amazon DynamoDB table and wait until it becomes available. Both client and resource APIs have waiters in Boto3.
   

Service-specific High-level Features

It has a lot of service-specific functionalities, like multi-part transfers that happen automatically for Amazon S3 and query conditions that are made simpler for Amazon DynamoDB.

The Boto 3 library is built on top of botocore; it is a Python library that is used to send API requests to Amazon Web Services and receive responses from the service.

Botocore
Fig. Level of abstraction in boto3 with botocore example

  • With a client, you directly interact with the response dictionary from a deserialized API response.
  • Using the resource, you can interact with common Python classes and objects instead of unprocessed response dictionaries.

To learn more about boto3 please refer to AWS SDK for Python (Boto3) Documentation

Creating clients and resources for AWS DynamoDB.

Dynamodb Client

Dynamodb Resource

Accessing table from DynamoDB using DynamoDB resource

Accessing Table

Fetching data from DynamoDB table using getItem()

Getitem

Sending data into DynamoDB table using putItem()

Putitem

Query data from DynamoDB table using query()
Query

Conclusion

In this blog, we discussed Boto 3’s internal design and application. As a result of examining the differences between clients and resources. In addition, we explored DynamoDB’s compatibility with Boto3.

A Basic Introduction to Amazon Web Services (AWS) for IoT

Thoughts on “Boto3 AWS SDK for Python”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ahmad Raza Kaliwala

Ahmad Raza Kaliwala is an Associate Technical Consultant at Perficient. He has over one year of experience in ETL Development and Testing. He has exposure to ETL tools like AWS Glue, SSIS, and Azure Data Factory.

More from this Author

Subscribe to the Weekly Blog Digest:

Sign Up
Follow Us
TwitterLinkedinFacebookYoutubeInstagram