How to (properly) use external credentials in an AWS Lambda function?
<p>I have a (extremely basic but perfectly working) AWS lambda function written in Python that however has embedded credentials to connect to: 
1) an external web service 
2) a DynamoDB table. </p>

<p>What the function does is fairly basic: it POSTs a login against a service (with credentials #1) and then saves part of the response status into a DynamoDB table (with AWS credentials #2). </p>

<p>These are the relevant parts of the function: </p>

<pre><code>h = httplib2.Http()
auth = base64.encodestring('myuser' + ':' + 'mysecretpassword')
(response, content) = h.request('https://vca.vmware.com/api/iam/login', 'POST', headers = {'Authorization':'Basic ' + auth,'Accept':'application/xml;version=5.7'})
</code></pre>

<p>and then </p>

<pre><code>conn = boto.connect_dynamodb(aws_access_key_id='FAKEhhahahah',aws_secret_access_key='FAKEdhdhdudjjdjdjhdjjhdjdjjd')
</code></pre>

<p>How would you go about cleaning the code by NOT having these credentials inside the function? </p>

<p>FYI this function is scheduled to run every 5 minutes (there is no other external event that triggers it).  </p>