For the complete documentation index, see llms.txt. This page is also available as Markdown.

AWS SDKs

The AWS SDKs behave identically to the AWS CLI. For example you can use Environment Variables or a Named Profile before the application is launced with the AWS SDK.

Environment Variables

myscript.py

import boto3

ec2 = boto3.client('ec2')

for i in ec2.instances.all():
    if i.state['Name'] == 'stopped':
        i.start()

Then, to invoke myscript.py with temporary credentials from SAML.to, in a Subshell ($(...))

$(saml-to assume the-role-name --headless)
python myscript.py

Named Profiles

myscript.py

import boto3

ec2 = boto3.client('ec2', profile_name='the-profile-name')

for i in ec2.instances.all():
    if i.state['Name'] == 'stopped':
        i.start()

Then, to invoke myscript.py with temporary credentials from SAML.to:

Last updated