Skip to main content

Creating Global Environment Variables

Global environment variables are varible that is accessible globally. Usually it's declared in file with name .env.

# PostgreSQL
PGHOST="Your DB IP address"
PGPASSWORD="Your DB password"
PGDATABASE="You DB name"
PGUSER="Your DB username"

# CSV files on S3 bucket
S3_LOG_BUCKET_URI=S3_CSV_BUCKET_URI="s3://<Bucket name>/<Folder name>"
S3_LOG_CONFIG_FILE=S3_CREDENTIAL_FILE="/var/task/prd_s3.cfg"
S3_LOG_FOLDER=S3_CSV_FOLDER="/tmp/store"

# Logging file to upload into S3 bucket
LAMBDA_FOLDER="/tmp/log"
LAMBDA_FILE="export_logs.log"

# Connection
TIMEZONE="<Your timezone>"
MAX_CONCURRENT_REQUESTS=10
SERVER_ID_LIMIT=5
AFTER_FAILED_IGNORING_MINUTES=10

PostgreSQL DB Variables

Make sure you have already set up AWS Lambda function to the RDS permission with IAM.

  1. PGHOST - PostgreSQL RDS host IP address.
  2. PGPASSWORD - PostgreSQL RDS database password.
  3. PGDATABASE - PostgreSQL RDS database name.
  4. PGUSER - PostgreSQL RDS database username.

CSV Files on S3 Bucket Variables

Make sure you have already set up AWS Lambda function to the AWS S3 permission with IAM.

  1. S3_LOG_BUCKET_URIS3_CSV_BUCKET_URI - The S3 bucket's URI.
  2. S3_LOG_CONFIG_FILES3_CREDENTIAL_FILE - The credential configuration file.
  3. S3_LOG_FOLDERS3_CSV_FOLDER - The folder where the downloaded CSV files will be stored.

Connection Variables

  1. TIMEZONE - Your local timezone.
  2. MAX_CONCURRENT_REQUESTS - Maximum concurrent request for PostgreSQL connection.
  3. SERVER_ID_LIMIT - Server limited count.
  4. AFTER_FAILED_IGNORING_MINUTES - When invocation failed, how long the lock will be ignored in minutes.