/sama-aws

sama-aws script to get temporary AWS credentials

Primary LanguagePython

How to upload your assets to Sama

Gather your Sama info

If you already know your Sama API key and project ID, you can skip this section.

API Key

How to get your API key?

  1. Go to the clients tab
  2. Look for your client
  3. Click on show API key

Project ID

How to get your project ID?

  1. Go to the projects page
  2. Use the filters and search for the client you are working with (i.e.,BDD)
  3. Click on view
  4. Choose the BDD project
  5. Take the ID from the URL (i.e., app.sama.com/projects/12345)

Sama CLI

You can use the Sama CLI to upload assets and directly create tasks if it fit your needs. Sama CLI documentation

AWS CLI

Using the AWS CLI will give you the best performance to upload a lot of assets.

Install Python 3

Windows

Python3 is available on the Microsoft store

MacOs

Python3 is available on macOS via Homebrew:

brew install python3

On macOS, make sure to run Install Certificates.command after the installation.

Install AWS CLI

AWS CLI

Configure sama-aws tool

Download the sama-aws.py

Start a terminal. The configure command create a sama AWS CLI profile and AWS CLI will fetch temporary credentials from https://app.sama.com using your API key. It will auto-renew the credentials every hour.

python3 sama-aws.py configure

Look for Assets S3 URL in the command output, you will need it later.

Test AWS CLI sama profile.

aws --profile sama sts get-caller-identity 
aws --profile sama s3 ls <Assets S3 URL as printed by the configure command>

Uploads assets

This command upload the batch-1 folder to your S3 dedicated prefix.

aws --profile sama s3 sync ./batch-1 <Assets S3 URL>/batch-1

Configure Cyberduck

Install Cyberduck

Run the following command in a shell. It will create or update the sama-cyberduck AWS profile.

python3 sama-aws.py update-credentials-file
  • Add S3 (Credentials from AWS Command Line Interface) bookmark in Cyberduck
  • Set profile name as sama-cyberduck
  • Set path to Assets S3 URL as printed by the configure command but without the s3:// prefix.

After an hour, the temporary credentials will expire in Cyberduck. You will need to run the script again and reconnect by going back to the Cyberduck landing page.