create_tdapi_context Method | teradataml AWS Extension Library | API Integration - create_tdapi_context Method - Teradata Vantage

Teradata Vantageā„¢ - API Integration Guide for Cloud Machine Learning

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
1.4
Published
September 2023
Language
English (United States)
Last Update
2023-09-28
dita:mapPath
mgu1643999543506.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
mgu1643999543506

Use the create_tdapi_context method to create an TDAPI context to be used to run TDApiClient functions.

Required Argument:
  • type: Specifies the cloud type of the TDAPI context.

    For example: "aws".

  • bucket_name: Specifies the S3 bucket name.
    Provide the bucket name without leading "/s3" or "s3://", and without "s3.amazonaws.com" at the end.

Environment Variables

Create the following environment variables before using the module.
  • Required environment variables:
    • AWS_ACCESS_KEY_ID: Specifies AWS Access Key ID.
    • AWS_SECRET_ACCESS_KEY: Specifies AWS Secret Access Key.
    • AWS_REGION: Specifies the AWS region.

      If this is defined, it overrides the values in the environment variable AWS_DEFAULT_REGION.

  • Optional environment variables:
    • AWS_SESSION_TOKEN: Specifies the AWS session token.
    • AWS_DEFAULT_REGION: Specifies the default AWS region.

Examples:

For Linux or macOS:
export AWS_REGION="us-west-2"
export AWS_ACCESS_KEY_ID="aws_access_key_id"
export AWS_SECRET_ACCESS_KEY="aws_secret_access_key"
export AWS_SESSION_TOKEN="aws_session_token"
For Windows Command Prompt:
set AWS_ACCESS_KEY_ID=aws_access_key_id
set AWS_SECRET_ACCESS_KEY=aws_secret_access_key
set AWS_REGION=us-west-2
set AWS_SESSION_TOKEN=aws_session_token
For PowerShell:
$Env:AWS_ACCESS_KEY_ID="aws_access_key_id"
$Env:AWS_SECRET_ACCESS_KEY="aws_secret_access_key"
$Env:AWS_REGION="us-west-2"
$Env:AWS_SESSION_TOKEN="aws_session_token"

Example

This example creates AWS context using "s3_bucket" as parent folder in default bucket.

from tdapiclient import create_tdapi_context, TDApiClient
context = create_tdapi_context("aws", "s3_bucket")