代码之家  ›  专栏  ›  技术社区  ›  Vinod Jayachandran

在没有红移凭证的情况下从S3加载到红移

  •  0
  • Vinod Jayachandran  · 技术社区  · 7 年前

    我们正在将数据从S3加载到Redshift,但在命令行上验证Redshift用户名和密码。

    我们是否也可以这样做,因为这会导致在代码中硬编码用户名密码,这是一个安全漏洞。

    psql -h $redshift_jdbc_url -U $redshift_db_username -d $redshift_dbname -p $port_number -c "copy $destinationTable$columnList from '$s3fileName' credentials 'aws_iam_role=arn:aws:iam::$account_number:role/$s3role;master_symmetric_key=$master_key' region '$s3region' format as json '$jsonPathFile' timeformat 'auto' GZIP TRUNCATECOLUMNS maxerror $maxError";
    
    2 回复  |  直到 7 年前
        1
  •  0
  •   Red Boy    7 年前

    code repository cvs git

    environment variable instance

    psql.sh

    #!/bin/bash
    echo "Loading environment variable"
    
    . "$HOME/.env"
    Your other commands
    

    #!/bin/bash
    export REDSHIFT_USER="xxxxxxxxx"
    export REDSHIFT_PASSWORD="xxxxxx"
    

    推荐文章