AWS is a library for operating with Amazon AWS services S3, SQS, Textract and Comprehend.

Services are initialized with keywords like Init S3 Client for S3.

AWS authentication

Authentication for AWS is set with key id and access key which can be given to the library in three different ways.

  • Method 1 as environment variables, AWS_KEY_ID and AWS_KEY.
  • Method 2 as keyword parameters to Init Textract Client for example.
  • Method 3 as Robocloud vault secret. The vault name needs to be given in library init or with keyword Set Robocloud Vault. Secret keys are expected to match environment variable names.

Note. Starting from rpaframework-aws 1.0.3 region can be given as environment variable AWS_REGION or include as Robocloud Vault secret with the same key name.

Redshift Data authentication: Depending on the authorization method, use one of the following combinations of request parameters, which can only be passed via method 2:

  • Secrets Manager - when connecting to a cluster, specify the Amazon Resource Name (ARN) of the secret, the database name, and the cluster identifier that matches the cluster in the secret. When connecting to a serverless endpoint, specify the Amazon Resource Name (ARN) of the secret and the database name.
  • Temporary credentials - when connecting to a cluster, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required. When connecting to a serverless endpoint, specify the database name.

Role Assumption: With the use of the STS service client, you are able to assume another role, which will return temporary credentials. The temporary credentials will include an access key and session token, see keyword documentation for Assume Role for details of how the credentials are returned. You can use these temporary credentials as part of method 2, but you must also include the session token.

Method 1. credentials using environment variable

*** Settings ***
Library   RPA.Cloud.AWS

*** Tasks ***
Init AWS services
    # NO parameters for client, expecting to get credentials
    # with AWS_KEY, AWS_KEY_ID and AWS_REGION environment variables
    Init S3 Client

Method 2. credentials with keyword parameter

*** Settings ***
Library   RPA.Cloud.AWS   region=us-east-1

*** Tasks ***
Init AWS services
    Init S3 Client  aws_key_id=${AWS_KEY_ID}  aws_key=${AWS_KEY}

Method 3. setting Robocloud Vault in the library init

*** Settings ***
Library   RPA.Cloud.AWS  robocloud_vault_name=aws

*** Tasks ***
Init AWS services
    Init S3 Client  use_robocloud_vault=${TRUE}

Method 3. setting Robocloud Vault with keyword

*** Settings ***
Library   RPA.Cloud.AWS

*** Tasks ***
Init AWS services
    Set Robocloud Vault     vault_name=aws
    Init Textract Client    use_robocloud_vault=${TRUE}

Requirements

The default installation depends on boto3 library. Due to the size of the dependency, this library is available separate package rpaframework-aws but can also be installed as an optional package for rpaframework.

Recommended installation is rpaframework-aws plus rpaframework package. Remember to check latest versions from rpaframework Github repository.

channels:
  - conda-forge
dependencies:
  - python=3.7.5
  - pip=20.1
  - pip:
    - rpaframework==13.0.2
    - rpaframework-aws==1.0.3

Following declaration, rpaframework[aws], will install all rpaframework libraries plus RPA.Cloud.AWS as an optional package. The extras support is deprecated and will be removed in the future major release of rpaframework.

channels:
  - conda-forge
dependencies:
  - python=3.7.5
  - pip=20.1
  - pip:
    - rpaframework[aws]==13.0.2

Example

*** Settings ***
Library   RPA.Cloud.AWS   region=us-east-1

*** Variables ***
${BUCKET_NAME}        testbucket12213123123

*** Tasks ***
Upload a file into S3 bucket
    [Setup]   Init S3 Client
    Upload File      ${BUCKET_NAME}   ${/}path${/}to${/}file.pdf
    @{files}         List Files   ${BUCKET_NAME}
    FOR   ${file}  IN   @{files}
        Log  ${file}
    END