Boto3

The boto3 project is different from boto2 and runs with Python3.

Installation

To install Boto3, run the following command:

$ pip install boto3

Configuration

Credentials Setup

There are different ways to set up your Boto3 credentials. However, the endpoint can only be configured when instantiating the boto.client() object.

Environment Variables

The export variables are:

  • AWS_ACCESS_KEY_ID

  • AWS_SECRET_ACCESS_KEY

Configuration File

You can edit the following files:

  • ~/.aws/credentials

  • ~/.aws/config

  • /etc/boto.cfg

  • ~/.boto

To configure one of these files, use the following elements:

[<PROFIL_NAME>]
aws_access_key_id=<ACCESS_KEY_ID>
aws_secret_access_key=<SECRET_KEY_ID>

Connector Setup

Low-Level Client

You can set access_key_id and secret_access_key as parameters of the boto.client() object or use previous methods. However, the region and endpoint_url parameters must be configured as follows:

import boto3

connection = boto3.client('<SERVICE_NAME>', aws_access_key_id='<ACCESS_KEY_ID>', aws_secret_access_key='<SECRET_ACCESS_KEY>', region_name='eu-west-2', endpoint_url='https://fcu.eu-west-2.outscale.com')

Examples

Initialization

Below is an example to connect to the OUTSCALE EC2-like service called FCU. For more information about our services and Regions, see Regions and Subregions.

import boto3

connection = boto3.client('ec2', aws_access_key_id='<ACCESS_KEY_ID>', aws_secret_access_key='<SECRET_ACCESS_KEY>', region_name='eu-west-2', endpoint_url='https://fcu.eu-west-2.outscale.com')
connection.describe_instances()

The first parameter of the boto.client() object is the service name. The Boto3 SDK is built to run on Amazon services, with which the OUTSCALE Cloud is compatible. You therefore need to configure the service name with its Amazon equivalent.

The following table presents the Amazon equivalent for each OUTSCALE service name:

OUTSCALE Service Name Amazon Service Name

fcu

ec2

lbu

elb

eim

iam

directlink

directconnect

Related Pages

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.