Boto3

Cette page est à ce jour disponible en anglais uniquement.

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 Variable

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 give access_key_id and secret_access_key as parameters of the boto.client() object or using 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

Here is an example to connect to the OUTSCALE EC2-like service called FCU. For more information about our services and Regions, see Régions et Availability Zones.

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, with which the 3DS OUTSCALE Cloud is compatible. You thus need to configure the service name with its Amazon equivalent.

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

3DS OUTSCALE Service Name Amazon Service Name

fcu

ec2

lbu

elb

directlink

directconnect

eim

iam

Related Pages

AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.