title: CodeBuild to RDS connection issue
body: <p>I am trying to connect a Postgres RDS serverless instance from a CodeBuild project.</p>
  <p>this is where it fails:
  <code>psql --host ${PG_HOST} --dbname ${PG_DBNAME} --user ${SECRET_USER} -f /tmp/file</code></p>
  <p>/tmp/file exists, so a file permission/non-existing issue is out of question</p>
  <p>What I have tried so far, the username and password have been:</p>
  <ol>
  <li>Stored as environment variables in CodeBuild</li>
  <li>Stored in AWS Secrets manager</li>
  </ol>
  <pre><code>env:
    secrets-manager:
       # key: secret-id:json-key:version-stage:version-id
       SECRET_USER: rds-db-credentials:username
       SECRET_PASSWORD: rds-db-credentials:password 
  </code></pre>
  <ol start="3">
  <li>Given as parameters in the call directly</li>
  </ol>
  <pre><code>psql --host ${PG_HOST} --dbname ${PG_DBNAME} &quot;user=mydbuser password=0fNKJtNv&quot; -f /tmp/file;
  </code></pre>
  <ol start="4">
  <li>Stored in .pgpass file</li>
  </ol>
  <pre><code>echo ${PG_HOST}:${PG_PORT}:${PG_DBNAME}:${SECRET_USER}:${SECRET_PASSWORD} &gt; ~/.pgpass
  chmod 600 ~/.pgpass
  </code></pre>
  <p>And to be sure, I exported the variable too, <code>PGPASSFILE=&quot;~/.pgpass&quot;</code></p>
  <p>When I echo the username and password, I only get *** printed, like:</p>
  <pre><code>[Container] 2020/09/27 07:39:34 Running command cat ~/.pgpass
  something.eu-central-1.rds.amazonaws.com:5432:spumdb:***:***
  </code></pre>
  <p>Errors:</p>
  <ol>
  <li>For <code>psql --host ${PG_HOST} --dbname ${PG_DBNAME} --user ${PG_USER} -f /tmp/file</code>, the error is</li>
  </ol>
  <pre><code>psql: warning: extra command-line argument &quot;/tmp/file&quot; ignored
  Password for user -f: 
  psql: fe_sendauth: no password supplied
  </code></pre>
  <ol start="2">
  <li>For <code>psql --host ${PG_HOST} --dbname ${PG_DBNAME} --user ${SECRET_USER} -f /tmp/file</code>, the error is</li>
  </ol>
  <pre><code>Password for user ***: 
  psql: fe_sendauth: no password supplied
  </code></pre>
  <ol start="3">
  <li>For <code>psql --host ${PG_HOST} --dbname ${PG_DBNAME} &quot;user=mydbuser password=0fNKJtNv&quot; -f /tmp/file</code>, the error is:</li>
  </ol>
  <pre><code>Password for user user=*** password=***: 
  psql: fe_sendauth: no password supplied
  </code></pre>
  <p>Just for info,</p>
  <ul>
  <li>The RDS security group has the entry to allow all TCP connections from CodeBuild in the AWS region where the project is (35.157.127.248/29)</li>
  <li>Both CodeBuild and RDS lie in the <strong>same</strong> private subnet of an user created VPC</li>
  <li>I am able to connect to the RDS instance from an EC2 instance using the same RDS credentials</li>
  <li>I am using the latest image for Amazon Linux 2 (aws/codebuild/amazonlinux2-x86_64-standard:3.0)</li>
  </ul>
  <p>It looks like a problem at the CodeBuild end, not at the RDS end. For some reason, CodeBuild doesn't get the value of the parameters, that too only username and password, others like hostname, dbname are evaluated correctly!</p>
  <p>Does anybody see any problem anywhere? Thank you!</p>