AWS Developer Tools Blog
Migrating to Boto3
Boto3, the latest version of the AWS SDK for Python, was released earlier this year. Since its release, we’ve seen more and more customers migrating to the latest major version of Boto. Boto3 provides many significant improvements over Boto:
- Faster availability of API updates and consistency in exposed interfaces
- Collections that provide an iterable interface to a collection of resources, including batch actions that can be used to perform an API operation on an entire collection
- Waiters that make it easier to poll resources for status changes
- Data-driven resource abstractions that provide an object-oriented API while still allowing a rapid relase cadence with significantly reduced maintenance overhead
We understand that migrating to a new major version of a project can be a big undertaking. It can take significant developer time to migrate; it requires more testing to ensure the successful migration of your application; and it can often involve wrestling with your dependency graph to ensure everything is compatible.
Using Boto and Boto3 side-by-side
To make the process of migrating to Boto3 easier, we released Boto3 under the boto3
namespace so that you can use Boto and Boto3 in the same project without conflicts. This allows you to continue to use Boto for legacy applications Boto3 for new development.
pip install boto
pip install boto3
import boto3
import boto.ec2
# For new development, use boto3. In this case, S3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
print(bucket.name)
# Feel free to use boto for legacy code. In this case, EC2
conn = boto.ec2.connect_to_region('us-west-2')
conn.run_instances('ami-image-id')
If your legacy applications or individual application components are currently running without issue, you might not have much motiviation to migrate from Boto to Boto3. After all, if it ain’t broke, dont’ fix it. However, if you have new applications or applications that need to use newer services and service features, you are strongly encouraged to upgrade to Boto3. Boto3 is the future of Boto. It is where most of our development will be focused.
Anything holding you back?
We want to make Boto3 as good as it can be. Your input and feedback is crucial in helping us decide how to allocate developer time and which features to develop. We’d like to know if there’s something holding you back from migrating or using Boto3 for new application development. Maybe there’s a feature you relied on in Boto that is not present in Boto3. Or perhpas you find something confusing in the documentation or the way a client is used. Please open an issue on the Boto3 issue tracker and let us know. We’ll apply the appropriate issue labels to make it easier to find and +1
existing issues.
Ready to migrate?
Ready to migrate now? Our migration guide covers some of the high-level concepts to keep in mind. And again, feel free to use the the Boto3 issue tracker for questions or feature requests.