<p>Can I pass AWS creds to Kops CLI or programmatically? How to handle multiple AWS accounts?</p>

Punit Naik
<p>You can redefine the <code>KOPS_STATE_STORE</code> environment variable to point to different s3 buckets in different aws accounts. You'll also have to export <code>AWS_ACCESS_KEY_ID</code> and <code>AWS_SECRET_ACCESS_KEY</code> variables for the given s3 bucket's account authorization.</p>
<p>To make the switch easier on yourself, do the following. Create two export var files, let's call them <code>aws_cluster_acct_1.env</code> and <code>aws_cluster_acct_2.env</code>.</p>
<p>aws_cluster_acct_1.env:</p>
<blockquote>
<p>export AWS_ACCESS_KEY_ID=foo1</p>
<p>export AWS_SECRET_ACCESS_KEY=bar1</p>
<p>export KOPS_STATE_STORE=s3://aws-account-kops-bucket-1</p>
</blockquote>
<p>aws_cluster_acct_2.env:</p>
<blockquote>
<p>export AWS_ACCESS_KEY_ID=foo2</p>
<p>export AWS_SECRET_ACCESS_KEY=bar2</p>
<p>export KOPS_STATE_STORE=s3://aws-account-kops-bucket-2</p>
</blockquote>
<p>Now when you want to switch between KOPS clusters in different AWS accounts, you can run either <code>source aws_cluster_acct_1.env</code> or <code>source aws_cluster_acct_2.env</code> and that will load up the appropriate environment variables for you to start doing stuff with either AWS account's KOPS clusters.</p>
