<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alfonso Cabrera on Medium]]></title>
        <description><![CDATA[Stories by Alfonso Cabrera on Medium]]></description>
        <link>https://medium.com/@alfonso_cabrera?source=rss-bea92589780c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*w_msr1rqL3IM9NS4.jpeg</url>
            <title>Stories by Alfonso Cabrera on Medium</title>
            <link>https://medium.com/@alfonso_cabrera?source=rss-bea92589780c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 00:47:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alfonso_cabrera/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Terraform security with aws-vault]]></title>
            <link>https://medium.com/@alfonso_cabrera/terraform-security-with-aws-vault-901b64c72003?source=rss-bea92589780c------2</link>
            <guid isPermaLink="false">https://medium.com/p/901b64c72003</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Alfonso Cabrera]]></dc:creator>
            <pubDate>Thu, 07 Apr 2016 03:00:49 GMT</pubDate>
            <atom:updated>2016-04-07T03:00:49.191Z</atom:updated>
            <content:encoded><![CDATA[<p>I really like <a href="https://www.terraform.io/">Terraform</a>.</p><p>It’s a HashiCorp tool that enables us to treat infrastructure as code and <a href="https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile">smile more</a>. I can’t speak to the other supported cloud providers but it works really well with AWS. Being an AWS heavy shop with close to 20 separate accounts, we wanted to figure out a good way to securely run terraform without having a ton of keys with admin access floating around on laptops.</p><p>That’s where <a href="https://github.com/99designs/aws-vault">aws-vault</a> comes into play. It stores your AWS keys into your OS keystore (KeyChain on Macs) and then generates <strong>temporary </strong>credentials from those keys to expose to your shell. The keychain file is password protected and requires your password after a 5 minute timeout. It works really well with the aws-cli and is also aware of your ~/.aws/config file. Best practice is to use IAM <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html">roles</a> to temporarily assume to a role that has admin access. You can setup a base IAM user that has the ability to assume role:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6002016655cc3e65c11f35d35ade6ed4/href">https://medium.com/media/6002016655cc3e65c11f35d35ade6ed4/href</a></iframe><p>Then you can create a terraform admin IAM role that has the AdministratorAccess policy attached along with a trust policy that allows specific users to assume to it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/639457e47b9181664abe2da629fc2656/href">https://medium.com/media/639457e47b9181664abe2da629fc2656/href</a></iframe><p>If you’re managing multiple AWS accounts, you’ll want to add the terraform admin role and trust policy to each account.</p><p>Back on your local machine, you want to add your base user keys with aws-vault:</p><pre>aws-vault add mainUser</pre><p>Then you can add the various AWS accounts to your ~/.aws/config file:</p><pre>[profile account1]<br>source_profile = mainUser  <br>role_arn = arn:aws:iam::accountNumber1:role/terraformadmin_role_name</pre><pre>[profile account2]<br>source_profile = mainUser  <br>role_arn = arn:aws:iam::accountNumber2:role/terraformadmin_role_name</pre><p>Once that’s in place you can run:</p><pre>aws-vault exec &lt;profileName&gt; -- terraform plan</pre><p>and it should use your temporary AWS keys to assume role to the profile you specify.</p><p>Congratulations, now you can run any of the terraform or aws cli commands in a security conscious way!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=901b64c72003" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>