<?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"><channel><title><![CDATA[Cloud security and access management blog for developers]]></title><description><![CDATA[A place for improving your Cloud security posture and the Developer experience of cloud developers. 
A community of passionate about Cloud access and IAM]]></description><link>https://blog.leapp.cloud</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1676029092874/I3SCyfmAf.png</url><title>Cloud security and access management blog for developers</title><link>https://blog.leapp.cloud</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 04:26:26 GMT</lastBuildDate><atom:link href="https://blog.leapp.cloud/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Noovolari has officially come to an end.]]></title><description><![CDATA[I have some difficult news to share as we approach the end of April. After much consideration, we have decided to close down Noovolari.
This decision, taken after careful evaluation and reflection, marks the end of a journey embarked upon with ambiti...]]></description><link>https://blog.leapp.cloud/noovolari-has-officially-come-to-an-end</link><guid isPermaLink="true">https://blog.leapp.cloud/noovolari-has-officially-come-to-an-end</guid><dc:creator><![CDATA[Andrea Cavagna]]></dc:creator><pubDate>Mon, 13 May 2024 13:16:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1713344450574/e35bcd7e-2c1d-463c-bf3b-7da7ed63dd3e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>I have some difficult news to share as we approach the end of April. After much consideration, we have decided to close down Noovolari.</em></p>
<p>This decision, taken after careful evaluation and reflection, marks the end of a journey embarked upon with ambition and passion to evolve into a self-sustaining Startup.</p>
<p>Despite our commitment and dedication, Noovolari did not achieve the self-sustainability necessary to operate independently from beSharp, our parent company. Over the last year, we have sought investment and explored potential acquisitions to bring Leapp to self-sustainability. Unfortunately, we were unable to secure the necessary support to continue.</p>
<p>This conclusion resulted from a careful analysis of costs and future prospects.</p>
<p>Despite beSharp's ability to support the project, we had set budget and time limits, which were unfortunately exceeded without achieving the desired sustainability.</p>
<p>This choice reflects the harsh reality that, despite the passion that drives our work, the demands of economic sustainability have the upper hand.</p>
<hr />
<p>Along with the closure of Noovolari, we also announce the termination of all development and commercial activities related to our Leapp Team and Pro products.</p>
<p>We will thank the users who supported our project with a full refund for annual subscriptions.</p>
<p>The Pro and Team versions will remain online <strong>until 30 June</strong> to facilitate the transition to other solutions. We remain available to assist you with specific needs.</p>
<p>Don't hesitate to get in touch with us at <a target="_blank" href="mailto:info@noovolari.com">info@noovolari.com</a></p>
<hr />
<p>Regarding the open-source project Leapp, we assure you that it will continue to receive support and updates even after the transition to beSharp.</p>
<p>During this period of transition, we are reevaluating how to best continue providing reliable support while adjusting to the new organizational structure. It’s possible that response times may initially be affected as we establish the most efficient processes.</p>
<p>However, please rest assured that our commitment to maintaining and improving Leapp remains steadfast. We appreciate your patience and understanding as we work through these changes.</p>
<hr />
<p><strong>We want to express our deepest thanks to everyone who believed in Noovolari and Leapp.</strong></p>
<p>Your support and passion have been crucial in this journey.</p>
<p><strong>We aim to keep the open-source project alive by exploring new ways to do so</strong>. We hope to continue to count on your support in the next chapter we are about to write.</p>
<p>Thank you all for sharing this journey with us.</p>
<p>The closing of Noovolari is not only the end of a chapter but also an opportunity to learn, grow, and innovate in new directions.</p>
<p>Wish you all the best,</p>
<p>The Noovolari Team</p>
]]></content:encoded></item><item><title><![CDATA[Welcome Import Sessions]]></title><description><![CDATA[📥 Import multiple Leapp Sessions at the same time!

One of our loved customers requests a way to import multiple Leapp sessions simultaneously.
To accommodate this need, we're offering a YAML format for the import functionality. This format provides...]]></description><link>https://blog.leapp.cloud/release-note-02</link><guid isPermaLink="true">https://blog.leapp.cloud/release-note-02</guid><dc:creator><![CDATA[Andrea Cavagna]]></dc:creator><pubDate>Fri, 09 Feb 2024 13:39:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1707485925322/490c7d0d-98e2-49bb-8f70-3a5f01c9037d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-import-multiple-leapp-sessions-at-the-same-time"><strong>📥</strong> Import multiple Leapp Sessions at the same time!</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706778184951/157e1895-fad3-4631-ad8a-adf5294fd076.gif" alt class="image--center mx-auto" /></p>
<p>One of our loved customers requests a way to <strong>import multiple Leapp sessions simultaneously.</strong></p>
<p>To accommodate this need, we're offering a YAML format for the import functionality. This format provides distinct advantages tailored to different preferences and needs, ensuring a seamless and efficient import process.</p>
<p>Here is an example of a YAML file</p>
<pre><code class="lang-yaml"><span class="hljs-attr">sessions:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">session-1:</span>
      <span class="hljs-attr">type:</span> <span class="hljs-string">"awsIamUserSession"</span>
      <span class="hljs-attr">awsAccount:</span>
        <span class="hljs-attr">accountId:</span> <span class="hljs-string">"&lt;account-id&gt;"</span>
        <span class="hljs-attr">accountName:</span> <span class="hljs-string">"&lt;account-name&gt;"</span>
      <span class="hljs-attr">iamUserName:</span> <span class="hljs-string">"john.doe"</span>
      <span class="hljs-attr">accessKey:</span> <span class="hljs-string">"&lt;access-key&gt;"</span>
      <span class="hljs-attr">secretKey:</span> <span class="hljs-string">"&lt;secret-key&gt;"</span>
      <span class="hljs-attr">mfaDevice:</span> <span class="hljs-string">"&lt;mfa-device&gt;"</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">session-2:</span>
      <span class="hljs-attr">type:</span> <span class="hljs-string">"awsIamRoleFederatedSession"</span>
      <span class="hljs-attr">awsAccount:</span>
        <span class="hljs-attr">accountId:</span> <span class="hljs-string">"&lt;account-id&gt;"</span>
        <span class="hljs-attr">accountName:</span> <span class="hljs-string">"&lt;account-name&gt;"</span>
      <span class="hljs-attr">roleArn:</span> <span class="hljs-string">"arn:aws:iam::account:role/developer"</span>
      <span class="hljs-attr">idpArn:</span> <span class="hljs-string">"&lt;idp-arn&gt;"</span>
      <span class="hljs-attr">samlUrl:</span> <span class="hljs-string">"&lt;saml-url&gt;"</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">session-3:</span>
      <span class="hljs-attr">type:</span> <span class="hljs-string">"awsIamRoleChainedSession"</span>
      <span class="hljs-attr">awsAccount:</span>
        <span class="hljs-attr">accountId:</span> <span class="hljs-string">"&lt;account-id&gt;"</span>
        <span class="hljs-attr">accountName:</span> <span class="hljs-string">"&lt;account-name&gt;"</span>
      <span class="hljs-attr">roleArn:</span> <span class="hljs-string">"&lt;role-arn&gt;"</span>
      <span class="hljs-attr">assumerSession:</span>
        <span class="hljs-string">$ref:</span> <span class="hljs-string">"session-1"</span>
</code></pre>
<hr />
<h1 id="heading-filter-sessions"><strong>🔎</strong> Filter Sessions</h1>
<p>We added a filter section on the session page to provide a better user experience.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706779963630/2be286a2-25d1-491d-a362-c1886d4be4b2.gif" alt class="image--center mx-auto" /></p>
<p>Now you can filter on the "All Sessions" page by the following search criteria:</p>
<ul>
<li><p><strong>Member</strong>: User with whom a Session is shared (from the list of all available Leapp Members).</p>
</li>
<li><p><strong>Sessions Type:</strong> Type of Session present in All Sessions (AWS IAM User, AWS IAM Role Federated, AWS IAM Role Chained, AWS Single Sign-On, etc.)</p>
</li>
<li><p><strong>Account Name:</strong> Filter only for certain accounts (from the list of available accounts)</p>
</li>
</ul>
<p>In addition, there is a "<strong>Collapse All/Expand All</strong>" button that allows you to view all the accounts in detail with just one click and organize the view more neatly.</p>
<hr />
<h1 id="heading-create-new-sessions-in-a-more-orderly-way"><strong>Create new Sessions in a more orderly way</strong> 🧹</h1>
<p>We decided to clean up the form to create a new Leapp Session:</p>
<p>Now, an Alias for each Session is no longer needed.</p>
<p>Also, we improved the way a user can select the Assumer Session for an AWS Role Chained</p>
<p>This feature lets you streamline your workflow by creating sessions without useless parameters!</p>
<hr />
<h1 id="heading-bug-fixing">🐞 Bug Fixing</h1>
<ul>
<li><p>⚙️ When you used to import a Leapp Team session on the Desktop App, the default region was always AF-South-1. Thanks to Ricky, now the <strong>default region is based on the region set by the user in the settings.</strong></p>
</li>
<li><p>🔗 <strong>Restored Dynamic Assumer functionality for IAM chained sessions.</strong> Thanks, Eric for resolving this bug!</p>
</li>
</ul>
<hr />
<p>But wait, there's more.</p>
<p>This Release note will be a bi-weekly update on the Noovolari news. <a target="_blank" href="https://blog.leapp.cloud/series/release-notes">Stay updated here</a></p>
<p>We'll see you very soon,</p>
<p>Your friends at Noovolari</p>
<p>---</p>
<p>P.S. We're actively looking for funding; contact us at info@noovolari.com for inquiries</p>
]]></content:encoded></item><item><title><![CDATA[Welcome Sessions folding]]></title><description><![CDATA[No more digging through heaps of sessions.
Now, your sessions are neatly tucked away in their dedicated account folders. Finding sessions is now as simple as finding your favorite socks! Just browse through the account folders, and voila!

Fresh out ...]]></description><link>https://blog.leapp.cloud/release-note-01</link><guid isPermaLink="true">https://blog.leapp.cloud/release-note-01</guid><category><![CDATA[AWS]]></category><category><![CDATA[leapp]]></category><category><![CDATA[release notes]]></category><dc:creator><![CDATA[Andrea Cavagna]]></dc:creator><pubDate>Thu, 25 Jan 2024 13:58:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1706176561290/161f220c-6117-41d2-9acd-4a784119db51.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705939879408/ea528888-1e27-4c28-be1a-5a0ab0e11b00.gif" alt class="image--center mx-auto" /></p>
<p>No more digging through heaps of sessions.</p>
<p>Now, your sessions are neatly tucked away in their <strong>dedicated account folders.</strong> Finding sessions is now as simple as finding your favorite socks! Just browse through the account folders, and voila!</p>
<hr />
<h1 id="heading-fresh-out-of-the-oven">Fresh out of the oven!</h1>
<h2 id="heading-integration-detail-is-more-comprehensive"><strong>Integration detail is more comprehensive.</strong></h2>
<p>We added a general info section in the integration detail to provide a more comprehensive overview.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706105441901/b75ec47b-6c91-403a-b48b-804b214afb99.png" alt class="image--center mx-auto" /></p>
<p>Now, at a glance, you can access essential information about the integration, including:</p>
<ul>
<li><p>AWS Identity Center Portal</p>
</li>
<li><p>AWS Instance Arn</p>
</li>
<li><p>AWS Account ID</p>
</li>
</ul>
<h2 id="heading-import-and-deletion-of-aws-identity-center-users">Import and deletion of AWS Identity Center Users</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706105421951/52cb303c-d820-42c0-89b6-8227395e42bf.png" alt class="image--center mx-auto" /></p>
<p>Now, you can add additional Leapp Members directly from your AWS Identity Center Users.</p>
<h2 id="heading-welcome-warp">Welcome Warp!</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706105540871/8ccb299f-552a-4744-b9ec-3ed4eee407b2.png" alt class="image--center mx-auto" /></p>
<p>We've <strong>added a new terminal to Leapp</strong>, specially tailored for all MacOS enthusiasts! This feature comes from one of our community rockstars. Thanks, <a target="_blank" href="https://github.com/Noovolari/leapp/pull/510">Blyzer</a>!</p>
<p><a target="_blank" href="https://www.warp.dev/">Warp</a> is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.</p>
<hr />
<h1 id="heading-bug-fixing">🐞 Bug Fixing</h1>
<ul>
<li><p>🌎 In the Leapp Team, now it is possible to enable <strong>multi-region for the integration setup.</strong> Thanks, Alex!</p>
</li>
<li><p>⚙️ Thanks Eric! In the Leapp Team, we fixed a bug that prevented retrieving users from an integration when using an alias in the portal URL of the AWS IAM Identity Center.</p>
</li>
<li><p>🙋‍♂️ In the Leapp Team, there was a bug with Leapp groups. Now, all the relevant Sessions are automatically shared by adding a new Member to a group. Thanks, Riky!</p>
</li>
</ul>
<hr />
<p>But wait, there's more.</p>
<p>This Release note will be a bi-weekly update on the Noovolari news. <a target="_blank" href="https://blog.leapp.cloud/series/release-notes">Stay updated here</a></p>
<p>We'll see you very soon,</p>
<p>Your friends at Noovolari</p>
<p>---</p>
<p>P.S. We're actively looking for funding; contact us at info@noovolari.com for inquiries</p>
]]></content:encoded></item><item><title><![CDATA[How to manage IAM Role Federated at scale]]></title><description><![CDATA[A real-case scenario in managing cloud access at scale: the PiedPiper company
PiedPiper company is a startup working on the AWS Cloud ecosystem. Like many others, it has adopted a Landing Zone approach in collecting and governing different AWS Accoun...]]></description><link>https://blog.leapp.cloud/how-to-manage-iam-role-federated-at-scale</link><guid isPermaLink="true">https://blog.leapp.cloud/how-to-manage-iam-role-federated-at-scale</guid><category><![CDATA[IAM Role Federated]]></category><category><![CDATA[IAM]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[aws-cross-account]]></category><dc:creator><![CDATA[Andrea Cavagna]]></dc:creator><pubDate>Wed, 13 Dec 2023 14:34:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702456355126/16c0dcf6-ed0a-4fc2-a4f7-8bfacd7ff4f8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-a-real-case-scenario-in-managing-cloud-access-at-scale-the-piedpiper-company">A real-case scenario in managing cloud access at scale: the PiedPiper company</h2>
<p>PiedPiper company is a startup working on the AWS Cloud ecosystem. Like many others, it has adopted a <strong>Landing Zone</strong> approach in collecting and governing different AWS Accounts, each with a specific purpose.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391294465/f1908dbb-1e19-429b-a0ef-b70e09d46a36.png" alt class="image--center mx-auto" /></p>
<p>PiedPiper has different developers, and each <strong>must operate in one or more accounts.</strong> Let’s see how PiedPiper leveraged some best practices to do so.</p>
<p>Let’s meet <strong>Bertram</strong>!</p>
<p>Bertram, like many other developers in PiedPiper, must at first identify himself in the cloud he has to operate. From many options, PiedPiper opted for the SAML 2.0 AWS IAM Federated Access approach</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391310412/cf7eaa00-4672-480b-910e-03365fb4ef63.png" alt class="image--center mx-auto" /></p>
<p>SAML 2.0 Federated Access is the way PiedPiper company identifies Bertram in its Cloud Identity Provider, and in general, <a target="_blank" href="https://aws.amazon.com/identity/federation/"><strong>Identity federation</strong></a> <strong>is a system of trust between two parties for the purpose of authenticating users and conveying the information needed to authorize their access to resources</strong>.</p>
<p>In this system, the <strong>identity provider (IdP)</strong> is responsible for user <strong>authentication</strong>, and a service provider (AWS) <strong>controls resource access</strong>.</p>
<p>A Federated Access through SAML 2.0 translates into an AWS IAM Role, which we call an <strong>IAM Role Hatbox</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391329574/8fd4c906-d54a-4267-898a-8b1d17d101d5.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-the-iam-roles-hatbox-account">The IAM Roles Hatbox account</h2>
<p>PiedPiper has adopted the Leapp suggested way to <strong>control and grant permissions</strong> to <strong>operate</strong> in different accounts while completely isolating the <strong>access</strong> account and <strong>defining a one-on-one relationship between the IdP Identity of the developer and its identity on AWS.</strong></p>
<p>The <strong>trust relationship policy in AWS guarantees this trust:</strong></p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Principal"</span>: {
                <span class="hljs-attr">"Federated"</span>: <span class="hljs-string">"arn:aws:iam::12345678910:saml-provider/Gsuite_PiedPiper"</span>
            },
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"sts:AssumeRoleWithSAML"</span>,
            <span class="hljs-attr">"Condition"</span>: {
                <span class="hljs-attr">"StringEquals"</span>: {
                    <span class="hljs-attr">"SAML:aud"</span>: <span class="hljs-string">"&lt;https://signin.aws.amazon.com/saml&gt;"</span>
                }
            }
        }
    ]
}
</code></pre>
<p>To do that, PiedPiper created a <strong>single AWS account with the sole purpose of managing User access.</strong></p>
<p>This <strong>AWS account</strong> (Aka: <strong>IAM Account</strong>) contains <strong>only IAM Roles</strong> that we call <strong>Hatbox IAM Roles, which can only do</strong> <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html"><strong>cross-account access</strong></a>, as shown in the picture.</p>
<p>A Hatbox <strong>IAM Roles is similar</strong> to a <strong>Hatbox,</strong> in which every <strong>hat</strong> represents a <strong>different role</strong> a developer can assume in an AWS Account, using the <a target="_blank" href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html"><strong>STS assume-role operation</strong></a> in AWS.</p>
<p>Every developer, Bertram included, has a <strong>nominal (name.surname)</strong> IAM Role whose policy only grants the <strong>assuming role to</strong> <strong>one or more specific AWS accounts</strong> each developer has to operate into.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391344285/f589955f-4a41-4074-a64d-b16d18d428c7.png" alt class="image--center mx-auto" /></p>
<p>Every IAM Hatbox Role will have a policy like the one for Bertram:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>,
      <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"arn:aws:iam::98765432101:role/developer-only"</span>
    }
  ]
}
</code></pre>
<p>This strategy can be adopted for one or <strong>more</strong> AWS Accounts, Internal or <strong>External</strong> to an AWS Organization. One of the immediate advantages is that it is simpler to isolate a developer's scope in the Cloud environment.</p>
<div data-node-type="callout">
<div data-node-type="callout-emoji">🔥</div>
<div data-node-type="callout-text">We firmly believe in doing so because it isolates the Access account and the Operations Accounts, differentiating <strong>where a <em>developer</em> CAN ACCESS</strong> from <strong>what a <em>developer</em> CAN OPERATE.</strong></div>
</div>

<h2 id="heading-managing-iam-roles-at-scale-with-the-leapp-team">Managing IAM Roles at scale with the Leapp Team</h2>
<p>PiedPiper uses the Leapp Team to manage its Developers’ accounts, and to do so, let’s see how Richards can access one account it must operate into.</p>
<p>At first, PiedPiper has created two <strong>Leapp Team Sessions:</strong></p>
<ul>
<li><p>The Nominal <strong>Hatbox Session</strong> <em>(where</em> <strong><em>Bertram</em></strong> <em>CAN ACCESS)</em></p>
</li>
<li><p>The <strong>IAM Role Chained session</strong> that Bertram must assume. (<em>what</em> <strong><em>Bertram</em></strong> <em>CAN OPERATE.)</em></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391369090/82f4f087-5fa9-4061-a347-822f972e33cf.png" alt class="image--center mx-auto" /></p>
<p>To take advantage of Leapp Team's dynamic session feature, PiedPiper created an IAM Federated Role Session with the alias <strong>bertram.gilfoyle</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391379742/7144da17-0e5e-4146-afa5-03ecdd097708.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-the-dynamic-parameter-feature">The dynamic parameter feature</h2>
<p>PiedPiper uses the dynamic feature to simplify sharing the Chained IAM Role with different developers. By using a <strong>name.surname pattern,</strong> it is possible to separate the final Role from every developer in the AWS Organization.</p>
<p>The company needs to create distinct <strong>hatbox IAM Roles</strong>, and the Leapp Team can effortlessly convert the final Role into an operational one by replacing the pattern with the actual <strong>name and surname of each developer</strong>. This streamlined process emphasizes simplicity.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391392534/481b393b-fb3f-4df3-a94b-3e4392a85e8a.png" alt class="image--center mx-auto" /></p>
<p>A <strong>single dynamic IAM Role Chained Session</strong> can be shared <strong>among as many developers</strong> as possible. The advantage here is clear: a company has the flexibility to manage and segregate account access in both directions; it can sever the entire account access to <strong>every developer</strong> by <strong>removing the chained role,</strong> or it can add/remove access to single developers using the <strong>Hatbox</strong> strategy.</p>
<p>By following what we described before, PiedPiper created a new IAM Role Chained Session, specifying the default dynamic pattern as the Assumer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391443573/2c6c59eb-b7cf-43d4-bb94-ac03b95e25e9.png" alt class="image--center mx-auto" /></p>
<p>PiedPiper now only needs to <strong>share these two sessions</strong> with Bertram to make him able to work in the destination account.</p>
<h2 id="heading-what-is-done-for-one-it-is-done-for-many">What is done for one it is done for many.</h2>
<p>Bertram is <strong>only one of many different developers</strong> in the PiedPieper company, and what we have seen for him can be easily extended for everyone in the company by following the same rules as shown before.</p>
<h2 id="heading-what-about-bertram">What about Bertram?</h2>
<p>Bertram can now operate in the destination account by logging into the Leapp Desktop App using his <strong>team credentials,</strong> and what happens is that a new Assumable Role Session is available to him; Leapp Team has converted the dynamic pattern to a valid IAM Role that identifies Bertram explicitly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391480058/553e3482-a102-4956-878d-c46f2a2f8f5b.png" alt class="image--center mx-auto" /></p>
<p>Bertram has one <strong>AWS</strong> <strong>IAM Federated Role</strong>, which is personal and <strong>shared only with him</strong>. The AWS Chained Session is, instead, shared with all the developers in the company; this way, PiedPiper <strong>has complete control over sharing/unsharing</strong> with Bertram and his colleagues.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391490470/00a8c97f-a8da-4f17-a64a-db1cbbb0c065.png" alt class="image--center mx-auto" /></p>
<p>Finally, Bertram can <strong>use these Leapp Sessions to access the correct AWS Account he needs to work into</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702391991259/4a479e46-14bf-42fe-9a0b-62b26251ea34.gif" alt class="image--center mx-auto" /></p>
<p>* The operations applied in the Leapp Team <strong>must reflect configurations already defined in AWS</strong>, e.g., <strong>having the correct assume role policies</strong> and the <strong>correct Hatbox IAM Roles defined in the IAM Account</strong>. Leapp Team <strong>helps you define a proper method, while in the future, we will also provide an automatic procedure to synchronize your Company’s dashboard with your AWS Organization.</strong></p>
]]></content:encoded></item><item><title><![CDATA[How to manage IAM Users at scale]]></title><description><![CDATA[A real-case scenario in managing cloud access at scale: the PiedPiper company
PiedPiper company is a startup working on the AWS Cloud ecosystem. Like many others, it has adopted a Landing Zone approach in collecting and governing different AWS Accoun...]]></description><link>https://blog.leapp.cloud/how-to-manage-iam-users-at-scale</link><guid isPermaLink="true">https://blog.leapp.cloud/how-to-manage-iam-users-at-scale</guid><category><![CDATA[IAM]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[AWS]]></category><category><![CDATA[aws-cross-account]]></category><dc:creator><![CDATA[Andrea Cavagna]]></dc:creator><pubDate>Wed, 13 Dec 2023 14:34:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702456328000/36a9d194-cefb-4906-985d-1f101806e026.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-a-real-case-scenario-in-managing-cloud-access-at-scale-the-piedpiper-company">A real-case scenario in managing cloud access at scale: the PiedPiper company</h2>
<p>PiedPiper company is a startup working on the AWS Cloud ecosystem. Like many others, it has adopted a <strong>Landing Zone</strong> approach in collecting and governing different AWS Accounts, each with a specific purpose.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392382358/f9672a68-6330-492a-a00d-cc7caf71b212.png" alt class="image--center mx-auto" /></p>
<p>PiedPiper has different developers, and each <strong>must operate in one or more accounts.</strong> Let’s see how PiedPiper leveraged some best practices to do so.</p>
<p>Let’s meet <strong>Richard</strong>!</p>
<p>Richard, like many other developers in PiedPiper, must at first identify himself in the cloud he has to operate. From many options, PiedPiper opted for the AWS IAM User approach.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392404987/6b537116-2def-4dfb-8d38-b484787d8a21.png" alt class="image--center mx-auto" /></p>
<p>An AWS IAM User is the way PiedPiper company identifies Richard in its Cloud environment, and this particular IAM User is called an <strong>IAM User Hatbox.</strong></p>
<h2 id="heading-the-iam-users-hatbox-account">The IAM Users Hatbox account</h2>
<p>PiedPiper has adopted the Leapp suggested way to control and grant permissions to <strong>operate</strong> in different accounts while completely isolating the <strong>access</strong> account. To do that, PiedPiper created a <strong>single AWS account with the sole purpose of managing User access.</strong></p>
<p>This <strong>AWS account</strong> (Aka: <strong>IAM Account</strong>) contains <strong>only IAM Users</strong> that we call <strong>Hatbox IAM Users, which can only do</strong> <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html"><strong>cross-account access</strong></a>, as shown in the picture.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392435518/b991ef91-0b9f-4807-8570-5c4966319c92.png" alt class="image--center mx-auto" /></p>
<p>A Hatbox <strong>IAM USER is similar</strong> to a <strong>Hatbox,</strong> in which every <strong>hat</strong> represents a <strong>different role</strong> a developer can assume in an AWS Account, using the <a target="_blank" href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html"><strong>STS assume-role operation</strong></a> in AWS.</p>
<p>Every developer, Richard included, has a <strong>nominal (name.surname)</strong> IAM user whose policy only grants <strong>assuming role to</strong> <strong>one or more specific AWS accounts</strong> each developer has to operate into.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392450506/404c5507-7541-458e-8f16-cad8f74357b2.png" alt class="image--center mx-auto" /></p>
<p>Every IAM Hatbox user will have a policy like the one for Richard:</p>
<pre><code class="lang-jsx">{
  <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-string">"Statement"</span>: [
    {
      <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-string">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>,
      <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"arn:aws:iam::98765432101:role/developer-only"</span>
    }
  ]
}
</code></pre>
<p>This strategy can be adopted for one or <strong>more</strong> AWS Accounts, Internal or <strong>External</strong> to an AWS Organization. One of the immediate advantages is that it is simpler to isolate a developer's scope in the Cloud environment.</p>
<div data-node-type="callout">
<div data-node-type="callout-emoji">🔥</div>
<div data-node-type="callout-text">We firmly believe in doing so because it isolates the Access account and the Operations Accounts, differentiating <strong>where a <em>developer</em> CAN ACCESS</strong> from <strong>what a <em>developer</em> CAN OPERATE.</strong></div>
</div>

<h2 id="heading-managing-iam-user-at-scale-with-leapp-team">Managing IAM User at scale with Leapp Team</h2>
<p>PiedPiper uses the Leapp Team to manage its Developers’ accounts, and to do so, let’s see how Richards can access one account it must operate into.</p>
<p>At first, PiedPiper has created two <strong>Leapp Team Sessions:</strong></p>
<ul>
<li><p>The Nominal <strong>Hatbox Session</strong> <em>(where</em> <strong><em>Richard</em></strong> <em>CAN ACCESS)</em></p>
</li>
<li><p>The <strong>IAM Role Chained session</strong> that Richard must assume. (<em>what</em> <strong><em>Richard</em></strong> <em>CAN OPERATE.)</em></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392516968/2a7852c4-bbcb-47d2-bc4b-bb3614be0ba4.png" alt class="image--center mx-auto" /></p>
<p>To take advantage of Leapp Team's dynamic session feature, PiedPiper created an IAM User Session with the alias <strong>richard.henricks</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392526869/c28918bd-2f69-48c2-ba87-aabb6c45c5a7.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-the-dynamic-parameter-feature">The dynamic parameter feature</h2>
<p>PiedPiper uses the dynamic feature to simplify sharing the Chained IAM Role with different developers. By using a <strong>name.surname pattern,</strong> it is possible to separate the final Role from every developer in the AWS Organization.</p>
<p>The company needs to create distinct <strong>hatbox IAM users</strong>, and the Leapp Team can effortlessly convert the final Role into an operational one by replacing the pattern with the actual <strong>name and surname of each developer</strong>. This streamlined process emphasizes simplicity.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392546461/16077465-f62a-4416-bd8c-eb2023f22aa4.png" alt class="image--center mx-auto" /></p>
<p>A <strong>single dynamic IAM Role Chained Session</strong> can be shared <strong>among as many developers</strong> as needed. The advantage here is clear: a company has the flexibility to manage and segregate account access in both directions; it can sever the entire account access to <strong>every developer</strong> by <strong>removing the chained role</strong> or add/remove access to single developers using the <strong>Hatbox</strong> strategy.</p>
<p>By following what we described before, PiedPiper created a new IAM Role Chained Session, specifying the default dynamic pattern as the Assumer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392612279/c0c57ec6-b522-46ce-a071-473ed8b23a1e.png" alt class="image--center mx-auto" /></p>
<p>PiedPiper now only needs to <strong>share these two sessions</strong> with Richard to make him able to work in the destination account.</p>
<h2 id="heading-what-is-done-for-one-it-is-done-for-many">What is done for one it is done for many.</h2>
<p>Richard is <strong>only one of many different developers</strong> in PiedPiper company, and what we have seen for him can be easily extended to everyone in the company by following the same rules as shown before.</p>
<h2 id="heading-what-about-richard">What about Richard?</h2>
<p>Richard can now operate in the destination account by logging into the Leapp Desktop App using his <strong>team credentials,</strong> and what happens is that a new Assumable Role Session is available to him; the Leapp Team has converted the dynamic pattern to a valid IAM Role that identifies Richard explicitly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392635610/e6d6dc7a-72b4-498d-ad43-82beea708264.png" alt class="image--center mx-auto" /></p>
<p>Richard has one <strong>IAM User</strong>, which is personal and <strong>shared only with him</strong>. The AWS Chained Session is, instead, shared with all the developers in the company; this way, PiedPiper <strong>has complete control over sharing/unsharing</strong> with Richard and his colleagues.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392644887/b967c3b8-aac4-46a4-baf2-fca469e29024.png" alt class="image--center mx-auto" /></p>
<p>Finally, Richard can <strong>use these Sessions to access the correct AWS Account he needs to work into</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702392822031/34fe477b-a2ab-438c-a8dc-f59dcd9a919f.gif" alt class="image--center mx-auto" /></p>
<p>* The operations applied in the Leapp Team <strong>must reflect configurations already defined in AWS</strong>, e.g., <strong>having the correct assume role policies</strong> and the <strong>correct Hatbox IAM Users defined in the IAM Account</strong>. Leapp Team <strong>helps you define a proper method, while in the future, we will also provide an automatic procedure to synchronize your Company’s dashboard with your AWS Organization.</strong></p>
]]></content:encoded></item><item><title><![CDATA[Introducing Leapp Team]]></title><description><![CDATA[From the CEO's Desk
We understand how challenging it can be to manage access in the constantly evolving world of cloud computing. It can take up so much time and effort, and we know how crucial it is to ensure that teams have smooth, secure, and effi...]]></description><link>https://blog.leapp.cloud/introducing-leapp-team</link><guid isPermaLink="true">https://blog.leapp.cloud/introducing-leapp-team</guid><dc:creator><![CDATA[Nicolò Marchesi]]></dc:creator><pubDate>Wed, 13 Dec 2023 14:28:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702294430289/6ecf658b-b841-46d4-aa56-02734df8dfcb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-from-the-ceos-desk"><strong>From the CEO's Desk</strong></h2>
<p>We understand how challenging it can be to manage access in the constantly evolving world of cloud computing. It can take up so much time and effort, and we know how crucial it is to ensure that teams have smooth, secure, and efficient access.</p>
<p><strong>Leapp isn't just a product; it represents our vision to simplify cloud access for everyone.</strong> We know how important collaboration is in today's fast-paced digital world. But we also know that tools must be efficient and secure to collaborate. That's why we've created Leapp, and we are <strong>now launching Leapp Team</strong> - a platform that will revolutionize how teams interact with cloud environments, making the process smoother, more secure, and inherently collaborative.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702295557578/a0d4d200-af83-4d5a-8fa0-f630013eed21.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-decentralization-in-cloud-computing-unlocking-efficiency-and-empowerment">Decentralization in Cloud Computing: Unlocking Efficiency and Empowerment</h2>
<p>In our journey through the cloud computing landscape, we've encountered a common pattern: the reliance on a delegation model. Traditionally, a select few hold the reins of cloud access, embodying a centralized approach that, while stable, often stifles the very essence of creativity and agility in a team.</p>
<p>Though rooted in a desire for control and oversight, this approach inadvertently creates bottlenecks. It places immense pressure on a few <strong>'gatekeepers'</strong> and leaves team members in a constant wait for access permissions - a scenario far from ideal in today's fast-paced work environments.</p>
<p>But we asked ourselves, "What if there's a better way?", “What if we embrace the spirit of collaboration and empowerment that thrives in the open-source community instead of centralizing?” This thought led us to a groundbreaking idea: decentralization.</p>
<p>Decentralization in cloud access isn't just a strategy; <strong>it's a shift towards a more democratic, empowering work culture.</strong> It's about giving every team member the keys to their part of the Cloud kingdom within a secure and structured environment. This approach creates a dynamic, responsive atmosphere where everyone has timely access to what they need, fostering a sense of ownership and responsibility.</p>
<p><strong>The beauty of decentralization lies in its ability to streamline operations and enhance security.</strong> This is our response to the limitations of the delegation model in cloud computing, and we have seen that by embracing this model, organizations can unlock greater efficiency, agility, and innovation in their cloud operations.</p>
<h2 id="heading-reimagining-cloud-access-a-user-centric-approach">Reimagining Cloud Access: A User-Centric Approach</h2>
<p>At Noovolari, we're driven by a simple yet profound belief: technology should empower, not hinder. We've been trying to find harmony in the intricate usage of cloud computing, where security and ease of use often seem at odds. We aim to create an environment that safeguards your work without adding complexity.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702295633035/c86aadc1-d260-48b7-abdf-b5bacea4bc85.png" alt class="image--center mx-auto" /></p>
<p>We've all been tangled in the web of cloud access management, feeling more like we're battling a maze rather than harnessing a tool. We understand how this frustration can overshadow the true potential of cloud computing. But more importantly, we see a path forward, a way to transform this experience into something empowering and fluid.</p>
<p>Leapp is the embodiment of this vision. <strong>It's where we put the user - you, the developers, the innovators - at the heart of everything.</strong> Our interfaces and workflows are crafted not just for functionality but for intuitiveness and ease. <strong>With Leapp, we're ensuring that your time is spent on what truly adds value to your work,</strong> surrounded by security that feels as natural as it is robust.</p>
<p>We firmly believe that access management is a pivotal element of user-centric design. It's why we've reimagined access controls to be more intuitive, reducing the mental load and turning what used to be a barrier into a gateway. Accessing the resources you need is now quick, smooth, and hassle-free, removing the friction that often clouds the day.</p>
<h2 id="heading-enhancing-functionality-through-integrations"><strong>Enhancing Functionality Through Integrations</strong></h2>
<p>While current solutions have set a standard in cloud access management, their approach often leans towards centralized control and one-size-fits-all frameworks that may not align with the unique needs of every organization. Teams can be constrained by inflexible workflows and a lack of adaptability, particularly in dynamic environments where quick access adjustments are crucial.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702295660174/ecf18533-cd66-4fcd-8954-616726fcdd33.png" alt class="image--center mx-auto" /></p>
<p>In Leapp Team, integrations mean more than just linking systems; they enhance how these systems work together. By integrating with platforms like AWS Identity Center, we're not just accessing their services but combining them with Leapp's unique capabilities. This approach doesn't only connect systems; it enhances them, creating a seamless and powerful experience.</p>
<h3 id="heading-temporary-access-for-dynamic-security"><strong>Temporary Access for Dynamic Security</strong></h3>
<p><strong>In our ongoing development of Leapp Team, a key focus is on implementing temporary access within AWS Identity Center.</strong> This feature, critical for dynamic security, is also designed with the principle of least privilege in mind. It ensures that access rights are granted on a need-to-use basis and for the minimum time necessary, significantly enhancing security.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702295705517/968075e2-0697-4886-a0a0-7f5dc2b1591b.png" alt class="image--center mx-auto" /></p>
<p>The temporary access feature will allow administrators to assign access permissions for a specific duration, aligning perfectly with situations where access requirements are transient. This approach minimizes security risks by limiting long-term access and adheres to the best practices of least privilege, ensuring that users have access only when absolutely necessary and for no longer than needed.</p>
<p>This feature will provide a robust mechanism to manage permissions more securely and effectively, embodying our commitment to creating a safer, more agile cloud environment.</p>
<h3 id="heading-building-decentralized-access-requests-and-approvals"><strong>Building Decentralized Access Requests and Approvals</strong></h3>
<p>Another core enhancement we are developing for AWS Identity Center is decentralized access through requests and approvals. Moving away from traditional centralized management, this feature will allow for a more agile and distributed approach to access management. Our goal is to empower individual team members to manage access requests and approvals autonomously, enhancing the process's speed, flexibility, and responsiveness. This enhancement is designed to seamlessly integrate with AWS Identity Center's existing security framework, offering a more dynamic approach to access management.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702295788184/e44f9fdf-e637-48c4-b3c3-def3d8b6fe0e.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-working-on-enhanced-visibility-into-aws-environments"><strong>Working on Enhanced Visibility into AWS Environments</strong></h3>
<p>We are also in the process of integrating visibility schemas into AWS Identity Center via Leapp Team. This feature, once completed, will provide a detailed and user-friendly view of access points within AWS environments. The aim is to make navigating the complex world of permissions and access rights simpler and more intuitive, thereby improving management efficiency and aiding in maintaining compliance with security standards.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702295814405/75bbcbd0-13d0-47b7-b001-b9cb28d8774f.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-conclusion-elevating-current-solutions-with-advanced-capabilities"><strong>Conclusion: Elevating Current Solutions with Advanced Capabilities</strong></h1>
<p>By integrating these advanced features into Integrations, Leapp Team is setting new standards in cloud access management. Decentralized access, temporary permissions, and enhanced visibility are not just features – they represent a holistic approach to managing cloud environments. With Leapp Team, users can now enjoy a more secure, flexible, and user-friendly experience tailored to meet the needs of modern, dynamic cloud teams.</p>
]]></content:encoded></item><item><title><![CDATA[IAM Users vs Roles]]></title><description><![CDATA[In this blog post, we will cover IAM User and IAM Role concepts, focusing on best practices and access patterns.If you are already familiar with IAM User and Role concepts and just want to know what you should opt for based on your use case, feel fre...]]></description><link>https://blog.leapp.cloud/iam-users-vs-roles</link><guid isPermaLink="true">https://blog.leapp.cloud/iam-users-vs-roles</guid><category><![CDATA[IAM]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Eric Villa]]></dc:creator><pubDate>Thu, 17 Aug 2023 12:00:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1692005278060/330396f1-8235-4960-a036-03a7be54dd32.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this blog post, we will cover IAM User and IAM Role concepts, focusing on best practices and access patterns.<br />If you are already familiar with IAM User and Role concepts and just want to know what you should opt for based on your use case, feel free to skip to the last section: "<em>When should I go for IAM Users and when for IAM Roles?</em>".</p>
<h2 id="heading-what-is-an-iam-user">What is an IAM User?</h2>
<p>When you create your first AWS account, you sign in with an identity that has full access to all the services and resources in your account. That identity is called the AWS account root user. As soon as you log into the AWS Console with the AWS account root user, you’ve to find a safer pattern to access it. Why? Because credentials associated with the AWS account root user are not disposable; in case of credentials theft, there is no way to invalidate them. That said, you can implement a safer access pattern by creating an IAM Identity called IAM User.</p>
<blockquote>
<p>An AWS Identity and Access Management (IAM) user is an entity that you create in AWS. The IAM user represents the human user or workload who uses the IAM user to interact with AWS. A user in AWS consists of a name and credentials.</p>
</blockquote>
<p>A brand-new IAM User has, by default, no permissions. To allow an IAM User to access services and resources in the AWS account in which it was created, you’ve to assign an IAM Policy and one or more credentials to it.</p>
<p>As explained in <a target="_blank" href="https://blog.leapp.cloud/increase-aws-security-posture-with-iam-roles-and-policies">this</a> article by my fellow colleague Alessandro Gaggia, an IAM Policy is a document that allows you to specify what an IAM Identity (in this case, an IAM User) can do on which resources or services, under what conditions. An IAM Policy is not enough to enable the IAM User permission to access resources or services; credentials must be associated with it.</p>
<p>Based on the way you want to access AWS, you have to use different kinds of credentials.</p>
<p>If you want to enable the IAM User to access the AWS Console, you’ve to assign a console password to the IAM User. The IAM User console password cannot be used to access AWS resources or services from the CLI or SDK.</p>
<p>Access to services or resources from the CLI or SDK is called programmatic access. To grant the IAM User programmatic access, you’ve to set up Access Keys; Access Keys that are created and assigned to an IAM User are long-term credentials. It means they’ve no expiration; you can use them to access your AWS account until they’re disabled or deleted. A common best practice to avoid long-term credentials is to rotate IAM User’s Access Keys periodically by deleting the old ones and replacing them with new ones created from scratch. In addition, IAM User Access Keys can be used to generate temporary credentials through the AWS Security Token Service GetSessionToken API.</p>
<p>Another important common best practice consists in requiring multi-factor authentication for all IAM users in your account. With MFA, users must provide two forms of identification: a console password or Access Keys, and a temporary numeric code that's generated on a hardware device or by an application on a smartphone, like Google Authenticator.</p>
<p>IAM Users are an effective instrument if you want to enable a human or application to access resources and services in a specific account, i.e. the one in which the IAM Users lives. But, there are many use cases that go beyond the possibilities of an IAM User. In particular, an IAM User does not fit a scenario in which we need to grant temporary permissions to trusted entities without sharing long-term credentials. Those trusted entities could be outside the boundary of my account (supposed that I have a single one), outside the boundary of AWS, or outside the boundary of my company.</p>
<p>At this point, you may wonder what kind of technology you can exploit to overcome these limits.</p>
<p>When it comes to granting temporary permissions to trusted entities without sharing long-term credentials, the IAM Identity that comes to the rescue is called IAM Role.</p>
<h2 id="heading-iam-role">IAM Role</h2>
<p>An IAM Role is an Identity that you create in your AWS Account. Like an IAM User, an IAM Role has permissions defined in one or more IAM Access Policies associated with it. But, instead of being associated with one person or application, a Role is designed to be assumed by trusted entities. Assuming an IAM Role means generating temporary credentials associated with that IAM Role. These credentials allow us to perform operations against resources or services based on the permissions defined in the IAM Access Policy associated with the IAM Role.</p>
<p>You can define which trusted entities are allowed to assume the role and acquire temporary security credentials using a Trust Policy for an IAM Role. In addition, the trust policy of a role defines the conditions under which the role can be assumed. The trust policy is written in JSON format and is attached to the role.</p>
<p>Here's an example of what a trust policy for an IAM role might look like:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: {
        <span class="hljs-attr">"AWS"</span>: <span class="hljs-string">"arn:aws:iam::YOUR_ACCOUNT_ID:root"</span>
      },
      <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>
    }
  ]
}
</code></pre>
<p>Replace <code>YOUR_ACCOUNT_ID</code> with your actual AWS account ID. In this trust policy, the <code>Principal</code> is set to the root user of the same AWS account (<code>arn:aws:iam::YOUR_ACCOUNT_ID:root</code>). This means that any entity within the account can assume the role.</p>
<p>Please note that while this example demonstrates granting access to any entity within the account, it's important to follow the principle of least privilege. Granting such broad permissions should be done with caution, as it might lead to unintended access and security risks. It's generally recommended to define more specific trust policies that only allow trusted entities that actually need the permissions provided by the role to assume it. It's important to craft trust policies carefully; trust policies, along with the permissions policies attached to the role, play a crucial role in controlling access to AWS resources in a secure and controlled manner.</p>
<p>Let’s deepen some access scenarios in which I can use IAM Roles to grant temporary permissions to trusted entities.</p>
<h3 id="heading-federated-access-from-external-identity-provider-idp"><strong>Federated Access from External Identity Provider (IdP)</strong></h3>
<p>In some organizations, user identities are managed outside of AWS using an Identity Provider (IdP). To provide users with access to AWS resources, you can enable federated access. This allows users authenticated by the external IdP to access your AWS environment without needing to create IAM Users. Instead, they're granted temporary access using security tokens based on their IdP authentication. This enhances security and reduces the need for separate user accounts in AWS. There are different kinds of federated access protocol, based on the IdP you’re using.</p>
<p><strong>SAML Federated Access</strong></p>
<p>SAML (Security Assertion Markup Language) is a widely used protocol for SSO. When a user from your organization tries to access AWS resources, they authenticate with your external SAML-compatible IdP (such as Microsoft Active Directory Federation Services or Okta). After successful authentication, the IdP generates a SAML assertion, which is a digitally signed document containing the user's identity and attributes.</p>
<p>The SAML assertion is passed to AWS through the <code>AssumeRoleWithSAML</code> API call. This API call includes the Amazon Resource Name (ARN) of the IAM role the user wants to assume, along with the SAML assertion. AWS verifies the SAML assertion's signature and attributes with the trusted IdP metadata.</p>
<p>If everything checks out, AWS issues temporary security credentials associated with the IAM role specified in the request. These credentials enable the user to access AWS services and resources according to the permissions defined in the IAM role's policies.</p>
<p><strong>OpenID Connect Federated Access</strong></p>
<p>OpenID Connect (OIDC) is a modern protocol built on top of OAuth 2.0 that allows applications to authenticate users. When users want to access AWS resources, they authenticate with their OpenID Connect-compatible IdP. The IdP returns an ID token, which contains the user's identity and other relevant information.</p>
<p>To enable federated access in AWS, you create an IAM identity provider that points to your OIDC IdP. Then, you create an IAM role with a trust policy that allows the OIDC identity provider to assume the role. Users initiate federated access by signing in through the IdP, and the OIDC token is exchanged for temporary AWS credentials through the <code>AssumeRoleWithWebIdentity</code> API call.</p>
<p><strong>Web Identity Federated Access</strong></p>
<p>Web identity providers include well-known platforms like Amazon, Facebook, Google, and more. These providers offer their own authentication mechanisms for user sign-ins. When a user authenticates with one of these providers, they receive an identity token.</p>
<p>Similar to OIDC, you establish an IAM identity provider for the web identity provider. You create an IAM role with a trust policy allowing the web identity provider to assume the role. Users authenticated by the web identity provider can assume the role using the <code>AssumeRoleWithWebIdentity</code> API call, receiving temporary AWS credentials to access resources based on the role's permissions.</p>
<h3 id="heading-cross-account-access"><strong>Cross-Account Access</strong></h3>
<p>Traditionally, managing access to resources across different AWS accounts could be complex and potentially compromise security by sharing long-term credentials. However, AWS cross-account access with IAM roles simplifies this process while enhancing security and control. It empowers organizations to collaborate seamlessly, allowing users from one AWS account to access resources in another account with well-defined permissions.</p>
<p>This capability is particularly valuable for scenarios such as:</p>
<ul>
<li><p><strong>Organizational Collaboration</strong>: different departments, teams, or external partners can work together effectively by granting controlled access to specific resources.</p>
</li>
<li><p><strong>Managed Services</strong>: organizations can centralize operations by providing external services, like managed security or analytics, and secure access to resources.</p>
</li>
<li><p><strong>Consulting and Vendor Engagement</strong>: consulting companies or vendors can access client resources while adhering to stringent security practices.</p>
</li>
</ul>
<p>The core concept behind AWS cross-account access is the utilization of IAM roles. Instead of sharing credentials, a trusted relationship is established between accounts. The trusting account defines an IAM role with a Trust Policy that allows IAM Identities in the trusted account to assume that role.</p>
<p>Let's say Account A (123456789012) wants to allow users from Account B (987654321001) to access specific resources. Account A creates an IAM role named <code>CrossAccountRoleA</code> and attaches a Trust Policy that specifies that Account B is allowed to assume this role.</p>
<p>Trust Policy for <code>CrossAccountRoleA</code> in Account A:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: {
        <span class="hljs-attr">"AWS"</span>: <span class="hljs-string">"arn:aws:iam::987654321001:root"</span>
      },
      <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>,
      <span class="hljs-attr">"Condition"</span>: {}
    }
  ]
}
</code></pre>
<p>In Account B (987654321001), IAM users or roles can assume the <code>CrossAccountRoleA</code> role from Account A (123456789012) because Account A has defined a trust policy allowing it. Users in Account B can use the <code>AssumeRole</code> API call to acquire temporary credentials for the <code>CrossAccountRoleA</code> role.</p>
<p>Assuming <code>CrossAccountRoleA</code> in Account B using AWS CLI:</p>
<pre><code class="lang-json">aws sts assume-role --role-arn arn:aws:iam::<span class="hljs-number">123456789012</span>:role/CrossAccountRoleA --role-session-name MySession
</code></pre>
<p>This will return temporary security credentials that can be used to access resources in Account A.</p>
<h3 id="heading-aws-service-to-service-access"><strong>AWS Service-to-Service Access</strong></h3>
<p>AWS services often need to interact with each other for various purposes. For example, you might want an AWS Lambda function to access data stored in Amazon S3. Instead of relying on long-term credentials, you can create an IAM role with the required permissions and allow the Lambda function to assume that role. This enables the Lambda function to securely access the necessary resources without exposing sensitive credentials.</p>
<p>Here's a concise breakdown of how AWS Service-to-Service Access works:</p>
<ol>
<li><p><strong>Role Creation</strong>: create an IAM role with necessary permissions for an AWS service to perform specific actions on other AWS resources.</p>
</li>
<li><p><strong>Trust Policy</strong>: specify the AWS service's ARN in the role's trust policy, allowing it to assume the role.</p>
</li>
<li><p><strong>Role Assumption</strong>: the AWS service requests temporary credentials from AWS STS by assuming the role.</p>
</li>
<li><p><strong>Temporary Credentials</strong>: AWS STS provides temporary credentials, including the Access Key ID, the Secret Access Key, and the Session Token.</p>
</li>
<li><p><strong>Resource Access</strong>: the AWS service uses temporary credentials to interact securely with other AWS resources.</p>
</li>
</ol>
<h3 id="heading-ec2-instance-access-without-long-term-credentials"><strong>EC2 Instance Access without Long-Term Credentials</strong></h3>
<p>On 12 June 2014, Mike Pope announced a new, crucial AWS feature: <a target="_blank" href="https://aws.amazon.com/blogs/security/granting-permission-to-launch-ec2-instances-with-iam-roles-passrole-permission/">Granting Permission to Launch EC2 Instances with IAM Roles</a><strong>.</strong></p>
<p>If you deploy a workload on an EC2 instance that requires access to AWS services, instead of embedding IAM User’s long-term credentials (Access Keys) directly into the instance, which can pose security risks, you can assign an IAM role to it. This role grants temporary permissions to the EC2 instance, ensuring that the workload running on this instance can interact with AWS services securely without exposing credentials. This dynamic and controlled approach simplifies management and enhances security.</p>
<p>When creating the IAM Role that has to be attached to the EC2 instance, remember to add a Trust Policy that allows the trusted entity (in this case, the EC2 service) to assume the role. In particular, you’ve to add <code>"Service": "</code><a target="_blank" href="http://ec2.amazonaws.com"><code>ec2.amazonaws.com</code></a><code>"</code> as the Principal in the Trust Policy.</p>
<p>The IAM Role can be attached to the instance during its creation or when it is already running.</p>
<p>When you assign an IAM role to an EC2 instance, an instance profile is automatically created. This instance profile is associated with the IAM role and acts as a container for temporary security credentials. The instance profile is managed by AWS and is not directly accessible from outside the instance.</p>
<p>When an application or process running on the EC2 instance needs to access AWS services, it makes an HTTP request to the metadata service, which is a web service that provides information about the instance's configuration and attributes. In this case, the <a target="_blank" href="http://169.254.169.254/latest/meta-data/iam/security-credentials/%3Crole-name%3E"><code>http://169.254.169.254/latest/meta-data/iam/security-credentials/&lt;role-name&gt;</code></a> endpoint is invoked to retrieve temporary security credentials associated with the IAM role. These credentials include an Access Key ID, a Secret Access Key, a Session Token, and an Expiration Time. EC2 instances automatically renew the temporary credentials by periodically requesting updated credentials from the metadata service. This ensures uninterrupted access to AWS resources.</p>
<h2 id="heading-interaction-between-iam-users-and-iam-roles">Interaction between IAM Users and IAM Roles</h2>
<p>As far as now, we didn’t take into account any possible interaction between IAM Users and IAM Roles. Well, IAM users can interact with IAM roles through the process of assuming roles. This allows IAM users to temporarily take on the permissions and privileges associated with an IAM role, granting them access to resources they might not have direct permissions. This interaction is commonly used to delegate access to specific resources without sharing long-term credentials.</p>
<p>An IAM User initiates the process by calling the <code>AssumeRole</code> API, specifying the ARN (Amazon Resource Name) of the IAM Role they want to assume. The IAM User must have the necessary permissions to assume the role in the first place. These permissions are defined by an IAM Access Policy attached to the user. The IAM Role’s Trust Policy must contain a statement that allows the IAM User to assume it. If the trust policy allows the IAM User to assume the role, AWS STS (Security Token Service) generates temporary credentials for the IAM User. The IAM User can use the temporary credentials to make requests to AWS services just like they would with their own IAM User credentials. The IAM User only has the permissions associated with the assumed role, not their original IAM User permissions.</p>
<p>As previously mentioned, it is possible to enable MFA for an IAM User. In the user's Access Policy, you can define actions that require MFA protection. This means that these actions can only be performed using IAM User credentials that include MFA information.</p>
<p>To generate credentials that include MFA information, you must call the STS GetSessionToken API and provide a valid MFA token associated with a hardware or virtual MFA device. You can then use the resulting credentials to call MFA-protected actions.</p>
<h2 id="heading-when-should-i-go-for-iam-users-and-when-for-iam-roles"><strong>When should I go for IAM Users and when for IAM Roles?</strong></h2>
<h3 id="heading-iam-users"><strong>IAM Users</strong></h3>
<p>IAM Users are well-suited for managing access within your AWS account, particularly for individuals and applications that require straightforward access to AWS services and resources. They offer personalized access control and are appropriate for the following scenarios:</p>
<ul>
<li><p><strong>Individuals</strong>: If you have human users who need to interact with AWS services using the AWS Management Console, IAM Users provide a way to grant personalized access. You can assign permissions based on each user's roles and responsibilities.</p>
</li>
<li><p><strong>Simple Application Access</strong>: For applications running within your AWS account that require programmatic access to AWS services, IAM Users can be used. However, it's important to note that IAM Roles are often a better choice for applications, as they provide temporary access without exposing long-term credentials.</p>
</li>
</ul>
<p>While IAM Users are useful for straightforward access requirements, they might not be the optimal solution for scenarios involving temporary access, cross-account access, or enhanced security.</p>
<h3 id="heading-iam-roles"><strong>IAM Roles</strong></h3>
<p>IAM Roles offer a more comprehensive approach to access management, particularly when dealing with complex access patterns and security considerations. They are the recommended choice in the following situations:</p>
<ul>
<li><p><strong>Federated Access</strong>: When you need to grant temporary access to users from external identity providers (IdPs) such as SAML, OpenID Connect, or web identity providers, IAM Roles provide a secure way to authenticate and access AWS resources without exposing long-term credentials.</p>
</li>
<li><p><strong>Cross-Account Access</strong>: IAM Roles excel at enabling secure collaboration between AWS accounts. This is crucial for scenarios like organizational partnerships, managed services, and consulting engagements.</p>
</li>
<li><p><strong>Service-to-Service Access</strong>: IAM Roles facilitate secure interactions between AWS services without relying on long-term credentials. This enhances security and adheres to the principle of least privilege.</p>
</li>
</ul>
<p>IAM Roles streamline security, minimize long-term credential exposure, and provide controlled access. They're designed to address a wide range of security and access requirements.</p>
<p>In summary, while IAM Users are suitable for simpler access scenarios within an AWS account, IAM Roles offer a more advanced and secure approach for managing complex access patterns, temporary access needs, and cross-account collaboration. The choice between IAM Users and IAM Roles should align with the specific security requirements and complexity of the access scenario you're addressing.</p>
<h1 id="heading-thats-all-folks">That’s all Folks!</h1>
<p>In this blog post we have seen what are IAM Users and IAM Roles, what are the differences between them, and the use cases in which they’re used.</p>
<p>I hope you enjoyed this blog post and that you find it informative. Please, don’t hesitate to provide your feedback and share your thoughts about the topic. Feel free to reach out to us on our <a target="_blank" href="https://join.slack.com/t/noovolari/shared_invite/zt-opn8q98k-HDZfpJ2_2U3RdTnN~u_B~Q">Community Slack</a>!</p>
<p>Stay tuned for new publications!</p>
]]></content:encoded></item><item><title><![CDATA[Increase AWS Security Posture with IAM Roles and Policies]]></title><description><![CDATA[In this article we will discuss identity and access management (IAM) within Amazon Web Services (AWS), focusing on the similarities and differences between IAM roles and policies.
This article will provide examples of both roles and policies and expl...]]></description><link>https://blog.leapp.cloud/increase-aws-security-posture-with-iam-roles-and-policies</link><guid isPermaLink="true">https://blog.leapp.cloud/increase-aws-security-posture-with-iam-roles-and-policies</guid><category><![CDATA[IAM]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Security]]></category><category><![CDATA[aws iam policies]]></category><dc:creator><![CDATA[Alessandro Gaggia]]></dc:creator><pubDate>Thu, 03 Aug 2023 12:00:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690368018441/678fe70a-4b4c-41b7-93a5-05bee5a8dea4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article we will discuss identity and access management (IAM) within Amazon Web Services (AWS), focusing on the similarities and differences between IAM roles and policies.</p>
<p>This article will provide examples of both roles and policies and explains how they relate to IAM roles, users, and groups.</p>
<p>By the end, you will have a clear understanding of IAM within AWS and be better equipped to manage access and identity needs on the platform.</p>
<h2 id="heading-what-is-an-iam-policy-in-aws">What is an IAM Policy in AWS?</h2>
<p>An IAM policy is a document that <strong>defines permissions for AWS resources</strong>. It is an essential component of AWS identity and access management (IAM) that provides fine-grained control over who can access specific resources in your AWS account.</p>
<p>IAM policies <strong>are used to grant or deny access to AWS resources</strong> such as Amazon S3 buckets, EC2 instances, and RDS databases.</p>
<p>IAM policies are written in JSON format and consist of one or more statements. Each statement contains a set of permissions for a specific resource or set of resources. For example, you might use an IAM policy to grant read-only access to a particular S3 bucket, or to allow a user to start and stop an EC2 instance.</p>
<h2 id="heading-elements-of-an-iam-policy">Elements of an IAM Policy</h2>
<p>An IAM policy is comprised of the following main elements:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Element</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td>Version</td><td>The version of the IAM policy language used.</td></tr>
<tr>
<td>Statement</td><td>A list of one or more statements that define the permissions for the policy.</td></tr>
<tr>
<td>Effect</td><td>Specifies whether the statement allows or denies access to the resource.</td></tr>
<tr>
<td>Action</td><td>The specific actions that are allowed or denied for the resource.</td></tr>
<tr>
<td>Resource</td><td>The AWS resource that the policy applies to.</td></tr>
<tr>
<td>Principal</td><td>The entity that the policy applies to.</td></tr>
</tbody>
</table>
</div><h3 id="heading-version">Version</h3>
<p>The Version element specifies the version of the IAM policy language used in the policy.</p>
<p>The current version of the policy language is October 17, 2012.</p>
<p>Example:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    ...
}
</code></pre>
<h3 id="heading-statement">Statement</h3>
<p>The Statement element is a list of one or more statements that define the permissions for the policy.</p>
<p>Example:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            ...
        },
        {
            ...
        }
    ]
}
</code></pre>
<h3 id="heading-effect">Effect</h3>
<p>The Effect element specifies whether the statement allows or denies access to the resource.</p>
<p>The values for Effect are <code>Allow</code> and <code>Deny</code>.</p>
<p>Example:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            ...
        },
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
            ...
        }
    ]
}
</code></pre>
<h3 id="heading-action">Action</h3>
<p>The Action element specifies the specific actions that are allowed or denied for the resource.</p>
<p>Example:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"s3:GetObject"</span>,
                <span class="hljs-string">"s3:PutObject"</span>
            ],
            ...
        },
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"ec2:*"</span>,
            ...
        }
    ]
}
</code></pre>
<h3 id="heading-resource">Resource</h3>
<p>The Resource element specifies the AWS resource that the policy applies to.</p>
<p>Example:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"s3:GetObject"</span>,
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"arn:aws:s3:::example-bucket/*"</span>,
            ...
        },
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"ec2:*"</span>,
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>,
            ...
        }
    ]
}
</code></pre>
<h3 id="heading-principal">Principal</h3>
<p>The Principal element specifies the entity that the policy applies to.</p>
<p>Example:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"s3:GetObject"</span>,
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"arn:aws:s3:::example-bucket/*"</span>,
            <span class="hljs-attr">"Principal"</span>: {
                <span class="hljs-attr">"AWS"</span>: [
                    <span class="hljs-string">"arn:aws:iam::123456789012:user/Bob"</span>,
                    <span class="hljs-string">"arn:aws:iam::123456789012:role/DevOps"</span>
                ]
            },
            ...
        },
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"ec2:*"</span>,
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>,
            <span class="hljs-attr">"Principal"</span>: <span class="hljs-string">"*"</span>,
            ...
        }
    ]
}
</code></pre>
<h2 id="heading-what-is-an-iam-role-in-aws">What is an IAM Role in AWS?</h2>
<p><strong>An IAM role is an AWS identity with permission policies that determine what the identity can and cannot do in AWS</strong>.</p>
<p>IAM roles are similar to IAM users, but with some important differences.</p>
<p>IAM roles are not associated with a specific user or group. Instead, they are intended to be assumed by anyone who needs the permissions associated with the role.</p>
<p><strong>IAM roles are a way to delegate access to AWS resources without the need to create and manage long-term AWS credentials</strong>.</p>
<p>For example, you might create an IAM role that grants access to an S3 bucket, and then allow a Lambda function to assume that role when it needs to access the bucket.</p>
<p>This way, you don't need to manage access keys for the Lambda function, and you can maintain tighter control over who has access to the S3 bucket.</p>
<h3 id="heading-main-elements-of-an-iam-role">Main Elements of an IAM Role</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Element</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td>Role Name</td><td>The name assigned to the role.</td></tr>
<tr>
<td>Role ARN</td><td>The Amazon Resource Name (ARN) assigned to the role.</td></tr>
<tr>
<td>Assume Role Policy</td><td>The policy document that grants permission to assume the role.</td></tr>
<tr>
<td>Inline Policies</td><td>One or more inline policies that are attached to the role.</td></tr>
<tr>
<td>Managed Policies</td><td>One or more managed policies that are attached to the role.</td></tr>
</tbody>
</table>
</div><h2 id="heading-assuming-an-aws-iam-role">Assuming an AWS IAM Role</h2>
<p>Assuming an AWS IAM Role means <strong>temporarily taking on the permissions and policies associated with that role</strong>. This is done by using the <strong>AWS Security Token Service (STS)</strong> API to obtain temporary security credentials, which include an access key, a secret access key, and a security token.</p>
<p>The <strong>user who is assuming the role must have permission to do so</strong>, which is granted <strong>by the role's trust policy</strong>. The trust policy specifies which users or services are allowed to assume the role.</p>
<p>There are several ways to assume an IAM Role in AWS, including using the AWS Management Console, AWS CLI, AWS SDKs, and the AssumeRole API.</p>
<p>When using the <strong>AssumeRole API, the user must provide their own security credentials and the ARN of the role they want to assume</strong>. The API then returns temporary security credentials that can be used to access AWS resources associated with the role.</p>
<p>Once the user has obtained temporary security credentials, they can use them to access AWS resources associated with the role until the credentials expire. <strong>The length of time that the credentials are valid can be set in the role's session duration policy. By default, this is set to one hour but can be increased up to 12 hours</strong>.</p>
<h2 id="heading-how-is-an-iam-policy-different-from-an-iam-role">How is an IAM Policy different from an IAM Role?</h2>
<p>An IAM policy and an IAM role are both used to control access to AWS resources. However, they serve different purposes.</p>
<p><strong>An IAM policy is used to define permissions</strong> for a specific AWS resource or set of resources. It is <strong>attached to a user, group, or role</strong> to <strong>grant or deny access</strong> to those resources.</p>
<p>IAM policies <strong>are static and do not change based on the user, group, or role</strong> that is accessing the resources.</p>
<p>In contrast, <strong>an IAM role is a set of permissions that can be assumed by a user, group, or service</strong>.</p>
<p><strong>It is a way to delegate access to AWS resources without the need to share long-term security credentials such as access keys</strong>.</p>
<p>When a <strong>user</strong> (or a service) assumes an IAM role, they inherit the permissions associated with the role. <strong>IAM roles are dynamic</strong> (opposed to policies) and can change based on the user, group, or service that is assuming the role.</p>
<p><strong>IAM roles are useful for scenarios where you need to grant temporary access to a resource</strong>.</p>
<p>For example, you might have a script that needs to access an S3 bucket to upload a file. Instead of embedding AWS credentials in the script, you can create an IAM role that has permission to access the S3 bucket and then assume that role in the script.</p>
<h2 id="heading-examples-of-iam-policies">Examples of IAM Policies</h2>
<p>Here are some examples of simple IAM policies for common use cases:</p>
<h3 id="heading-allow-read-only-access-to-an-s3-bucket">Allow read-only access to an S3 bucket</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"s3:GetObject"</span>,
                <span class="hljs-string">"s3:ListBucket"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: [
                <span class="hljs-string">"arn:aws:s3:::example-bucket"</span>,
                <span class="hljs-string">"arn:aws:s3:::example-bucket/*"</span>
            ]
        }
    ]
}
</code></pre>
<p>This policy allows a user to read objects from the <code>example-bucket</code> S3 bucket and list the contents of the bucket, but does not allow them to upload or modify objects.</p>
<h3 id="heading-allow-full-access-to-an-ec2-instance">Allow full access to an EC2 instance</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"ec2:*"</span>,
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>
        }
    ]
}
</code></pre>
<p>This policy allows a user to perform any action on any EC2 instance in the account.</p>
<h3 id="heading-allow-read-only-access-to-an-rds-instance">Allow read-only access to an RDS instance</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"rds:DescribeDBInstances"</span>,
                <span class="hljs-string">"rds:DescribeDBSnapshots"</span>,
                <span class="hljs-string">"rds:DownloadDBLogFilePortion"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: [
                <span class="hljs-string">"arn:aws:rds:us-west-2:123456789012:db:mysql-db"</span>,
                <span class="hljs-string">"arn:aws:rds:us-west-2:123456789012:snapshot:mysql-db-snapshot"</span>
            ]
        }
    ]
}
</code></pre>
<p>This policy allows a user to view information about the <code>mysql-db</code> RDS instance and download log files, but does not allow them to perform any modifications.</p>
<h3 id="heading-allow-read-only-access-to-an-sqs-queue">Allow read-only access to an SQS queue</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"sqs:GetQueueUrl"</span>,
                <span class="hljs-string">"sqs:ReceiveMessage"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"arn:aws:sqs:us-west-2:123456789012:example-queue"</span>
        }
    ]
}
</code></pre>
<p>This policy allows a user to retrieve the URL of the <code>example-queue</code> SQS queue and receive messages from the queue, but does not allow them to send messages or modify the queue in any way.</p>
<h3 id="heading-allow-read-only-access-to-a-dynamodb-table">Allow read-only access to a DynamoDB table</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"dynamodb:DescribeTable"</span>,
                <span class="hljs-string">"dynamodb:GetItem"</span>,
                <span class="hljs-string">"dynamodb:Query"</span>,
                <span class="hljs-string">"dynamodb:Scan"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"arn:aws:dynamodb:us-west-2:123456789012:table/example-table"</span>
        }
    ]
}
</code></pre>
<p>This policy allows a user to view the schema of the <code>example-table</code> DynamoDB table and read items from the table, but does not allow them to modify the table in any way.</p>
<h2 id="heading-increase-aws-security-posture-with-iam-roles-and-policies">Increase AWS Security Posture with IAM Roles and Policies</h2>
<p>Using a combination of IAM roles and policies is an effective way to <strong>increase the security posture</strong> of an AWS account. Here are some best practices to follow:</p>
<h3 id="heading-use-least-privilege">Use Least Privilege</h3>
<p>When creating IAM policies, it's important to <strong>use the principle of least privilege</strong>. This means granting users and roles <strong>only the permissions they need to perform their job functions and no more</strong>.</p>
<p>For example, if a user only needs read access to an S3 bucket, don't grant them write or delete access.</p>
<h3 id="heading-rotate-credentials">Rotate Credentials</h3>
<p>AWS recommends <strong>regularly rotating access keys and secret access keys for IAM users and roles</strong>. This helps to reduce the risk of unauthorized access to your resources in the event that credentials are compromised.</p>
<h3 id="heading-use-iam-roles-instead-of-access-keys">Use IAM Roles Instead of Access Keys</h3>
<p><strong>IAM roles are a more secure way to grant temporary access to AWS resources than using access keys</strong>.</p>
<p>When a user assumes an IAM role, they get temporary security credentials that expire after a specified amount of time. This minimizes the risk of credentials being compromised and reduces the need to manage long-term access keys.</p>
<h3 id="heading-use-managed-policies">Use Managed Policies</h3>
<p>AWS provides a number of managed policies that can be used to grant permissions to users and roles.</p>
<p><strong>These policies are created and maintained by AWS and are designed to follow best practices for security and compliance</strong>.</p>
<p>By using managed policies, you can be sure that your users and roles have the appropriate permissions without having to create and maintain policies yourself.</p>
<h3 id="heading-use-conditions-in-iam-policies">Use Conditions in IAM Policies</h3>
<p><strong>IAM policies can include conditions that further restrict the permissions granted to users and roles</strong>.</p>
<p>For example, you can create a policy that only allows access to a resource during certain hours of the day or only from certain IP addresses.</p>
<p><strong>Using conditions can help to further reduce the risk of unauthorized access</strong> to your resources.</p>
<h3 id="heading-use-multi-factor-authentication-mfa">Use Multi-Factor Authentication (MFA)</h3>
<p><strong>Enabling multi-factor authentication (MFA) for IAM roles is an effective way to increase the security</strong> of your AWS account.</p>
<p>MFA requires users to provide a second form of authentication, such as a hardware token or a mobile app, in addition to their password.</p>
<p>This makes it much more difficult for an attacker to gain unauthorized access to your resources even if they have obtained the user's password.</p>
<p>By following these best practices, you can significantly increase the security posture of your AWS account and better protect your resources from unauthorized access.</p>
<h2 id="heading-what-have-we-seen">What have we seen</h2>
<p>In this article, we explored the differences and similarities between IAM roles and policies in AWS.</p>
<p>IAM policies define permissions for AWS resources and are used to grant or deny access to specific resources in your AWS account.</p>
<p>IAM roles, on the other hand, are AWS identities with permission policies that determine what the identity can and cannot do in AWS. IAM roles are a way to delegate access to AWS resources without the need to create and manage long-term AWS credentials.</p>
<p>We also discussed the main elements of an IAM policy, including the version, statement, effect, action, resource, and principal. Additionally, we explained how to assume an IAM role in AWS using the AWS Security Token Service (STS) API.</p>
<p>To increase the security posture of an AWS account, we recommended using a combination of IAM roles and policies and following best practices such as using least privilege, rotating credentials, using managed policies, using conditions in IAM policies, and enabling multi-factor authentication (MFA) for IAM roles.</p>
<p>Overall, by understanding the differences between IAM roles and policies and following best practices, you will be better equipped to manage access and identity needs on the AWS platform.</p>
<p>I really hope that this little article has been of help for all of you, and as always, feel free to comment and reach us on our <a target="_blank" href="https://join.slack.com/t/noovolari/shared_invite/zt-opn8q98k-HDZfpJ2_2U3RdTnN~u_B~Q">community slack</a>.</p>
<p>Until next time, stay safe and see you in the next article, in which we’ll discuss about IAM Users and Groups! 😉</p>
]]></content:encoded></item><item><title><![CDATA[Toward IAM Collaboration: Introducing Workspaces]]></title><description><![CDATA[Hey everyone, Nicolò here. I’m excited to announce that Noovolari Leapp is finally taking its final steps toward our long-waited access collaboration platform, and today we are introducing the first building block of our solution: Workspaces.
You may...]]></description><link>https://blog.leapp.cloud/introducing-workspaces</link><guid isPermaLink="true">https://blog.leapp.cloud/introducing-workspaces</guid><category><![CDATA[IAM]]></category><category><![CDATA[Security]]></category><category><![CDATA[Cloud]]></category><dc:creator><![CDATA[Nicolò Marchesi]]></dc:creator><pubDate>Wed, 26 Jul 2023 12:54:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690375842436/7b6c97d2-4641-4a67-873f-c9d89a99b2c8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone, Nicolò here. I’m excited to announce that Noovolari Leapp is finally taking its final steps toward our long-waited access collaboration platform, and today we are introducing the first building block of our solution: <strong>Workspaces</strong>.</p>
<p>You may have seen it in our desktop application, so <em>“What is this?”</em> should have already popped into your mind; if not, you’ll learn about this today… surprise! 😄</p>
<p>Workspaces are, as the name implies, logically separated environments where all Leapp access and configurations live. It contains all the relevant information about your Sessions, your Leapp setup, and your Plugins, so in simple terms, everything that is needed for Leapp to work correctly.</p>
<p>Workspaces are, at their essence, the places where all your configurations are stored and can be both <strong>local</strong> and <strong>remote.</strong></p>
<h3 id="heading-the-default-local-workspace">The default local workspace</h3>
<p>Leapp client is, first and foremost, an open-source project designed to work with secured local data and automate temporary credentials generation. All data needed to generate credentials are stored locally in the Keychain or encrypted configuration files so no one other than the user can access them.</p>
<p>Other than that, we have a plethora of different configurations, such as your preferred terminal or web browser, installed and active plugins, profiles, and a bunch of other things needed for Leapp to work.</p>
<p>It started as a tool for single developers and worked locally, giving us a lot of early feedback until our users began to ask for ways to collaborate and work with their teams, which wasn’t enough.</p>
<h3 id="heading-the-zero-trust-remote-workspace">The zero-trust remote workspace</h3>
<p>Working only locally isn't impossible once you start to tread the path of collaborating on access. All Leapp data that wasn’t tied to the single user needed a place to live since a critical Cloud aspect as access requires reliability and robustness.</p>
<p>So we just created a place for everything to be saved online. Easy peasy lemon squeezy, right? But of course not!</p>
<p>From the start, we had the problem of not being happy with doing server-side encryption. It’s ok, but we weren’t satisfied because we wanted something that even the most critical of us would not have a problem using.</p>
<p>Since we’re <strong>dev-and-privacy-obsessed,</strong> we thought, <em>“What would make our users feel safe storing sensitive data online?”</em>. And the best answer we came up with, together with our users, was to ensure that <strong>we can never-ever-ever access your data, even if you ask us to</strong>. Everything saved in our server is client-side encrypted; only the user possesses the key to decrypt it.</p>
<p>This enables us to manage your access data while never knowing anything about them, and that’s the reason it’s called <strong>zero-knowledge encryption</strong>. We don’t know, and can’t know, anything about the encryption key, but you can be at peace storing everything you need to collaborate online.</p>
<h2 id="heading-the-importance-of-leapp-collaboration">The Importance of Leapp Collaboration</h2>
<p>With persistence sorted out, we are now focusing on the collaborative aspects of Cloud access management. When wielded by an individual, <strong>Leapp is a powerful tool</strong>, but when groups of people collaborate using Leapp, they can achieve real, transformational benefits. We have always known collaboration is essential for managing, accessing, and securing each Cloud environment.</p>
<p>We’re working closely with Leapp's open-source user community, learning from our users working with Leapp in organizations large and small, and it’s common to find a big gap between the builder’s need for focusing on actual work and the controls needed by security and compliance team managing a cloud environment.</p>
<p>We love IAM, but it’s not quite in the spot to be developer-centric. Powerful and of critical importance, but with many rough edges, and as a central pillar of the Cloud, it’s everywhere. Way too many teams struggle to get their access right with reasonable effort when they need to manage their Cloud Operations at scale. And that’s where we’re looking for the months to come, make Identity and Access management simpler and automated:</p>
<ul>
<li><p><strong>Identity-centric Cloud Access</strong>: Seamlessly integrate identities from AWS IAM Identity Center, Okta, Azure AD, Google Workspace, and more.</p>
</li>
<li><p><strong>IAM Automation</strong>: Streamline access management operation tasks and enhance control and visibility over permissions and policies following your organization's workflow and tools.</p>
</li>
<li><p><strong>Dynamic Roles and Policies</strong>: Leverage Leapp's capability to template policies and roles, enabling the effective deployment of different versions based on the environment and context.</p>
</li>
<li><p><strong>Just-in-time Access</strong>: Simplify temporary access management by automating cloud access definition and expiration.</p>
</li>
<li><p><strong>Automated Least Privilege</strong>: Ensure fine-grained permissions and minimize access privileges through Leapp's automation capabilities.</p>
</li>
<li><p><strong>Zero-trust IAM</strong>: Implement a zero-trust approach to identity and access management, enhancing security and reducing risks.</p>
</li>
</ul>
<h2 id="heading-come-to-the-dark-side-of-iam-we-have-cookies-the-good-ones">Come to the dark side of IAM; we have cookies (the good ones)</h2>
<p>All puns are intended.</p>
<p>This overview has provided some insights into the solution we are developing and the principles behind our choices. The underlying principle on which everything was built is the firm belief that the sole practical method for a Cloud organization to achieve and maintain security is by embracing a developer-led approach.</p>
<p>As we envision the future of this project, we are excited about the possibilities that lie ahead. Our team constantly strives to add new features and improve the user experience based on valuable user feedback. Their input is vital to us, as it helps shape the future of our software.</p>
<p>If you are intrigued by our work and want to join our <strong>Closed Beta</strong>, please <a target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSeznt30p3By3isRNcdUrdjjAaCF87q8HP6c1cwAfMcnmqlCNA/viewform?usp=sf_link">fill out this form</a> or reach out to me on our <a target="_blank" href="https://join.slack.com/t/noovolari/shared_invite/zt-opn8q98k-HDZfpJ2_2U3RdTnN~u_B~Q">Slack community</a>. We value the opportunity to collaborate with individuals who share our passion for Identity Access management and security.</p>
<p>Furthermore, we are commencing our <strong>Early Adopter Program</strong>, specifically designed for organizations that desire a more intimate feedback process and the opportunity to influence the software's development actively. This exclusive program comes with distinct advantages and privileges not accessible to other users, and it customizes our solution to cater to your organization's specific use cases. For this, <a target="_blank" href="https://calendly.com/noovolari/meet-nicolo">let’s have a chat</a> or find me on <a target="_blank" href="https://www.linkedin.com/in/nicolomarchesi/">Linkedin</a>!</p>
<p>So, I hope you like what you’re reading, and if you don't want to miss out on this exciting opportunity – reach out to us today! Together we will advance IAM by Leap(p)s and bounds.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690368313948/f80517b7-d9b3-471f-bea7-52b967bbe212.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[AWS STS CLI: a cheatsheet]]></title><description><![CDATA[The AWS CLI is a very useful tool for every developer that wants to work and interact with AWS.
It allows developers to automate the process of managing AWS services and resources using scripts, customizing workflows and integrating with other tools....]]></description><link>https://blog.leapp.cloud/aws-sts-cli-a-cheatsheet</link><guid isPermaLink="true">https://blog.leapp.cloud/aws-sts-cli-a-cheatsheet</guid><category><![CDATA[Aws sts]]></category><category><![CDATA[aws cli]]></category><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Riccardo Rotta]]></dc:creator><pubDate>Fri, 21 Jul 2023 10:12:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1689934053055/4915c4f3-201e-4920-b0e0-a18cc5c313e1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The AWS CLI is a very useful tool for every developer that wants to work and interact with AWS.</p>
<p>It allows developers to automate the process of managing AWS services and resources using scripts, customizing workflows and integrating with other tools.</p>
<p>With the AWS CLI you can also request temporary, limited-privilege credentials for users using <a target="_blank" href="https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html">AWS Security Token Service</a> or STS, in short.</p>
<p>Knowing how to programmatically use STS via the AWS CLI can be a very useful skill for any DevOps, and this article will provide an overall view of the most common commands.</p>
<h2 id="heading-prerequisites-and-tips">Prerequisites and Tips</h2>
<ul>
<li><p>If you haven't installed the AWS CLI yet, start by looking at <a target="_blank" href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html">Installing the AWS CLI Guide from Amazon</a>.</p>
</li>
<li><p>Configure the AWS CLI yourself by following <a target="_blank" href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html">this guide</a>, or just let <a target="_blank" href="https://www.leapp.cloud/">Leapp</a> manage your configuration instead.</p>
</li>
<li><p><strong>Tip</strong>: enable Auto Completion mode for the CLI with <code>$ aws --cli-auto-prompt</code>. This will give you suggestions as you write down your commands. Just remember to exit this mode when you need to run scripts!</p>
</li>
</ul>
<h2 id="heading-aws-cli-filtering-flags">AWS CLI filtering flags</h2>
<p>AWS CLI commands can accept the following flags: <code>--query</code>, <code>--filter</code>, <code>--output</code>. You can use them or a combination of them to extract, filter and format the JSON output of each command so that it is easily readable and can be passed to other commands.</p>
<ul>
<li><p><code>--filter</code> is used for server-side filtering and can improve HTTP response times for large data sets.</p>
</li>
<li><p><code>--query</code> is used for client-side filtering and can be used to do some more powerful filtering.</p>
</li>
<li><p><code>--output</code> is used to format the output, so that it can be transformed into plain text, YAML, etc.</p>
</li>
</ul>
<h2 id="heading-aws-sts-cli-sts-assume-role">AWS STS CLI: STS assume role</h2>
<p>Assuming a role lets you obtain temporary short-lived credentials for that role.</p>
<p><code>aws sts assume-role --role-arn arn:aws:iam::&lt;account_number&gt;:role/my-role --role-session-name test --region eu-central-1</code></p>
<p><strong>Flags</strong>:</p>
<ul>
<li><p><code>--role-arn</code>: the ARN of the role to assume</p>
</li>
<li><p><code>--role-session-name</code>: optional name for the Session</p>
</li>
<li><p><code>--region</code>: the Region in which you want to work in</p>
</li>
</ul>
<p><strong>Output</strong>:</p>
<pre><code class="lang-tsx">{
    "Credentials": {
        "AccessKeyId": "&lt;AccessKeyId&gt;",
        "SecretAccessKey": "&lt;SecretAccessKey&gt;",
        "SessionToken": "&lt;SessionToken&gt;",
        "Expiration": "&lt;ExpirationDate&gt;"
    },
    "AssumedRoleUser": {
        "AssumedRoleId": "&lt;IdOfTheAssumedRole&gt;",
        "Arn": "&lt;ARNofTheAssumedRole&gt;"
    }
}
</code></pre>
<p><strong>Tips:</strong> you can leverage <code>printf</code> to inject credentials directly into <strong>environment variables</strong> without leaking them in the script. Here’s how to do it:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">export</span> $(<span class="hljs-built_in">printf</span> <span class="hljs-string">"AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s"</span> \\
$(aws sts assume-role \\
--role-arn arn:aws:iam::123456789012:role/MyAssumedRole \\
--role-session-name MySessionName \\
--query <span class="hljs-string">"Credentials.[AccessKeyId,SecretAccessKey,SessionToken]"</span> \\
--output text))
</code></pre>
<h2 id="heading-aws-sts-cli-sts-assume-role-with-saml">AWS STS CLI: STS assume role with SAML</h2>
<p>You can obtain temporary credentials based on a SAML Authentication, using the SAML response.</p>
<p><code>aws sts assume-role-with-saml --role-arn arn:aws:iam::&lt;account_number&gt;:role/&lt;iam_role&gt; --principal-arn arn:aws:iam::&lt;account_number&gt;:saml-provider/&lt;SAML-provider&gt; --saml-assertion</code> <a target="_blank"><code>file://samlresponse.txt</code></a></p>
<p><strong>Flags</strong>:</p>
<ul>
<li><p><code>--role-arn</code>: the ARN of the role to assume</p>
</li>
<li><p><code>--principal-arn</code>: the ARN of the SAML Provider configured in AWS IAM</p>
</li>
<li><p><code>--saml-assertion</code>: the SAML assertion contained in a text file</p>
</li>
<li><p><code>--duration-seconds</code>: <em>(optional)</em> the duration, in seconds, of the role session. The default value is <strong>3600 seconds</strong>. Valid values are from <strong>900 seconds</strong> (15 minutes) up to the maximum session duration setting for the role (from 1 to 12 hours).</p>
</li>
</ul>
<p><strong>Outputs</strong>:</p>
<pre><code class="lang-tsx">{
    "Issuer": "&lt;https://integ.example.com/idp/shibboleth&gt;&lt;/Issuer",
    "AssumedRoleUser": {
        "Arn": "arn:aws:sts::123456789012:assumed-role/TestSaml",
        "AssumedRoleId": "123456EXAMPLE789:TestSaml"
    },
    "Credentials": {
        "AccessKeyId": "&lt;AccessKeyId&gt;",
        "SecretAccessKey": "&lt;SecretAccessKey&gt;",
        "SessionToken": "&lt;SessionToken&gt;",
        "Expiration": "&lt;ExpirationDate&gt;"
    },
    "Audience": "&lt;https://signin.aws.amazon.com/saml&gt;",
    "SubjectType": "transient",
    "PackedPolicySize": "6",
    "NameQualifier": "&lt;NameQualifier&gt;",
    "Subject": "SamlExample"
}
</code></pre>
<p><strong>Tips:</strong> here’s an <a target="_blank" href="https://repost.aws/knowledge-center/aws-cli-call-store-saml-credentials">example</a> from AWS using <code>awk</code> to store the result of this command in the credential file <code>./aws/credentials</code>:</p>
<pre><code class="lang-bash">awk -F:  <span class="hljs-string">'
              BEGIN { RS = "[,{}]" ; print "[PROFILENAME]"}
              /:/{ gsub(/"/, "", $2) }
              /AccessKeyId/{ print "aws_access_key_id = " $2 }
              /SecretAccessKey/{ print "aws_secret_access_key = " $2 }
              /SessionToken/{ print "aws_session_token = " $2 }
'</span> &gt;&gt; ~/.aws/credentials
</code></pre>
<h2 id="heading-aws-sts-cli-sts-assume-role-with-web-identity">AWS STS CLI: STS assume role with Web Identity</h2>
<p>You can obtain temporary credentials for users who have been authenticated in a mobile or web application with a web identity provider.</p>
<p><code>aws sts assume-role-with-web-identity --role-arn arn:aws:iam::123456789012:role/FederatedWebIdentityRole --role-session-name ExampleSession --web-identity-token &lt;token&gt;</code></p>
<p><strong>Flags</strong>:</p>
<ul>
<li><p><code>--role-arn</code>: the ARN of the role to assume</p>
</li>
<li><p><code>--role-session-name</code>: the session name</p>
</li>
<li><p><code>--web-identity-token</code>: the <strong>web identity token</strong> obtained from <a target="_blank" href="https://www.rfc-editor.org/rfc/rfc7519">JWT bearer tokens</a> issued by <a target="_blank" href="https://openid.net/connect/">OIDC</a>-compatible identity providers (IdPs)</p>
</li>
</ul>
<p>You must have a valid OAuth 2.0 access token, an OpenID Connect token, and an IAM role that trusts the IdP.</p>
<p><strong>Output</strong>:</p>
<pre><code class="lang-tsx">{
    "SubjectFromWebIdentityToken": "amzn1.account..."
    "Audience": "client.1234567890@apps.example.com",
    "AssumedRoleUser": {
        "Arn": "arn:aws:sts::123456789012:assumed-role/FederatedWebIdentityRole/ExampleSession",
        "AssumedRoleId": "...:ExampleSession"
    }
    "Credentials": {
        "AccessKeyId": "&lt;AccessKeyId&gt;",
        "SecretAccessKey": "&lt;SecretAccessKey&gt;",
        "SessionToken": "&lt;SessionToken&gt;",
        "Expiration": "&lt;ExpirationDate&gt;"
    },
    "Provider": "www.amazon.com"
}
</code></pre>
<h2 id="heading-aws-sts-cli-sts-get-session-token">AWS STS CLI: STS get session token</h2>
<p>You can obtain temporary credentials for an AWS account or IAM user. The credentials consist of an access key ID, a secret access key, and a security token. Can be used with MFA-enabled IAM users.</p>
<p><code>aws sts get-session-token</code></p>
<p><strong>Flags</strong>:</p>
<ul>
<li><p><code>--duration-seconds</code>: <em>(optional)</em> the duration, in seconds, of the role session. The default value is <strong>3600 seconds</strong>.</p>
</li>
<li><p><code>--serial-number</code>: <em>(optional)</em> the ID of the MFA device, either a serial number for a hardware device or an ARN for a virtual device</p>
</li>
<li><p><code>--token-code</code>: <em>(optional)</em> the value provided by the MFA device</p>
</li>
</ul>
<p><strong>Output</strong>:</p>
<pre><code class="lang-tsx">{
   "Credentials": {
        "AccessKeyId": "&lt;AccessKeyId&gt;",
        "SecretAccessKey": "&lt;SecretAccessKey&gt;",
        "SessionToken": "&lt;SessionToken&gt;",
        "Expiration": "&lt;ExpirationDate&gt;"
   }
}
</code></pre>
<h2 id="heading-aws-sts-cli-sts-get-federation-token">AWS STS CLI: STS get federation token</h2>
<p>You can obtain temporary security credentials for a user. Can be used to get temporary security credentials on behalf of distributed applications inside a corporate network.</p>
<p><code>aws sts get-federation-token --name Bob</code></p>
<p><strong>Flags</strong>:</p>
<ul>
<li><code>--name</code>: the name of the federated user. The name is used as an identifier for the temporary security credentials (such as <strong>Bob</strong>)</li>
</ul>
<p><strong>Output</strong>:</p>
<pre><code class="lang-tsx">{
  "Credentials": {
        "AccessKeyId": "&lt;AccessKeyId&gt;",
        "SecretAccessKey": "&lt;SecretAccessKey&gt;",
        "SessionToken": "&lt;SessionToken&gt;",
        "Expiration": "&lt;ExpirationDate&gt;"
  },
  "FederatedUser": {
    "Arn": "arn:aws:sts::123456789012:federated-user/Bob",
    "FederatedUserId": "123456789012:Bob"
  },
  "PackedPolicySize": 6
}
</code></pre>
<p><strong>Tips</strong>:</p>
<p>If you want to <strong>compare all AWS STS methods of generating temporary credentials</strong>, <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">this table</a> from the AWS documentation can be very useful.</p>
<h2 id="heading-aws-sts-cli-sts-get-caller-identity">AWS STS CLI: STS get caller identity</h2>
<p>You can use this command to see who the credentials set belongs to.</p>
<p><code>aws sts get-caller-identity</code></p>
<p><strong>Flags</strong>:</p>
<ul>
<li><code>--profile</code>: <em>(optional)</em> the named profile, specified in the <code>.aws/credentials</code> file, for the credentials set you want.</li>
</ul>
<p><strong>Output</strong>:</p>
<pre><code class="lang-tsx">{
    "UserId": "&lt;UserId&gt;",
    "Account": "123456789012",
    "Arn": "arn:aws:sts::123456789012:assumed-role/..."
}
</code></pre>
<p>If this command returns <code>"Unable to locate credentials"</code>, make sure you have a [default] named profile in the <code>.aws/credentials</code> file! Otherwise, use the <code>--profile</code> flag.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1689934091581/c5b44f37-ac1a-4cea-b774-5bbda5401c7b.png" alt class="image--center mx-auto" /></p>
<p><strong>Tips</strong>:</p>
<p>You can use this command to quickly find your account ID.</p>
<p><code>aws sts get-caller-identity --query Account --output text</code></p>
<h2 id="heading-conclusions">Conclusions</h2>
<p>This article continued exploring how the AWS CLI can be used to automate operations on AWS services, in particular with STS.</p>
<p>We explored all the different commands that we have at our disposal and how to generate temporary credentials for accessing our AWS resources.</p>
<p>We also introduced and explained some useful flags to give some extra spice to our output format and filter out all the unwanted information.</p>
<p>Thank you for sticking with us until the end of this short cheat sheet, hopefully, you learned something new!</p>
<p>As always, if you have any questions, need clarification, or just want to share your opinion, feel free to join our <a target="_blank" href="https://join.slack.com/t/noovolari/shared_invite/zt-opn8q98k-HDZfpJ2_2U3RdTnN~u_B~Q"><strong>Top of the Ops community</strong></a>.</p>
<p>See you in the Cloud!</p>
]]></content:encoded></item><item><title><![CDATA[No Gateway Needed: How to RDP to AWS Private Windows Instance]]></title><description><![CDATA[Under the AWS “Systems Manager” service umbrella, you can find many managed services and features; sometimes, there are hidden gems, like Distributor (to install software packages automatically) or Session Manager.
Session Manager lets you connect to...]]></description><link>https://blog.leapp.cloud/no-gateway-needed-how-to-rdp-to-aws-private-windows-instance</link><guid isPermaLink="true">https://blog.leapp.cloud/no-gateway-needed-how-to-rdp-to-aws-private-windows-instance</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Damiano Giorgi]]></dc:creator><pubDate>Thu, 06 Jul 2023 14:00:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688545716468/c4b8b02f-6e62-4430-9b78-231230d222cd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Under the AWS “Systems Manager” service umbrella, you can find many managed services and features; sometimes, there are hidden gems, like Distributor (to install software packages automatically) or Session Manager.</p>
<p>Session Manager lets you connect to different types of EC2 instances using a browser or the AWS CLI, like a cross-platform SSH connection, but managed by AWS without needing a public IP address.</p>
<p>When you use Linux instances, AWS SSM Session Manager helps to ssh into private EC2 instances, but what about Windows instances?</p>
<p>If you start Session Manager, you’ll get only a PowerShell prompt, and, as much as we love command lines, sometimes we are more familiar with a GUI.</p>
<h2 id="heading-why-a-bastion-host-or-a-remote-desktop-gateway-is-not-a-good-idea">Why a bastion host or a remote desktop gateway is not a good idea</h2>
<p>When you use a private instance, you want to restrict its connectivity from the internet as much as possible.</p>
<p>If you use a bastion host for port forwarding or a remote desktop gateway server, issues can arise in the future because you will need to maintain a service exposed on the Internet.</p>
<h2 id="heading-aws-fleet-manager-rdp-the-missing-feature">AWS Fleet Manager RDP: the missing feature</h2>
<p>If you want to use RDP without giving additional connectivity to the internet, you can use AWS Fleet Manager, so you will have a web client to use the GUI. Sooner or later, you will discover a missing feature: <strong>you cannot copy files from and to your instance.</strong> Luckily for you, we have already investigated a solution!</p>
<h3 id="heading-aws-system-manager-port-forwarding-to-the-rescue">AWS System Manager Port Forwarding to the rescue</h3>
<p>Lucky for us, System Manager has a very useful Managed Document we can use to achieve our goal: <code>AWS-StartPortForwardingSession</code></p>
<p>This document allows us to create a tunnel from our PC to an EC2 instance, even if it is in a private subnet. The only requirement is to have the SSM Agent installed and to have connectivity to the SSM service API; you can also deploy a private endpoint if there is no internet connectivity.</p>
<p>From our local environment, we can launch:</p>
<pre><code class="lang-bash">aws ssm start-session \
--target instance-id \
--document-name AWS-StartPortForwardingSession \
--parameters <span class="hljs-string">'{"portNumber":["3389"], "localPortNumber":["56789"]}'</span>
</code></pre>
<p>Then we can connect to <code>[</code><a target="_blank" href="&lt;`[`http://localhost:56789`](http://localhost:56789)`&gt;"><code>localhost:56789</code>](http://localhost:56789)`</a>` using our favorite RDP client, and we can use all the features of the RDP protocol, such as clipboard sharing, copying files, drive mapping, remote audio, and so on. Systems Manager will do the magic of forwarding everything inside a secure channel.</p>
<p>We also have another trick up our sleeves: another SSM Document (<code>AWS-StartPortForwardingSessionToRemoteHost</code>) can allow us to do remote port forwarding to access other private services, such as an RDS database.</p>
<pre><code class="lang-bash">aws ssm start-session \
    --target instance-id \
    --document-name AWS-StartPortForwardingSessionToRemoteHost \
    --parameters <span class="hljs-string">'{"host":["mydb.example.us-east-2.rds.amazonaws.com"],"portNumber":["3306"], "localPortNumber":["3306"]}'</span>
</code></pre>
<p>With this command, we are using the private instance to forward traffic to an RDS Instance (ensure that traffic is allowed by the security group; otherwise, the connection will fail).</p>
<h2 id="heading-leapp-to-the-rescue">Leapp to the rescue!</h2>
<p>I love using the command line, but I’m not tidy enough to make scripts and aliases to organize all my connections (and if I make an alias, I often forget my alias name).</p>
<p>Luckily, Christian made a plugin that has become my all-time favorite: <strong>LEAPP-SSM-TUNNELS-PLUGIN</strong></p>
<p>This plugin uses only AWS-StartPortForwardingSessionToRemoteHost Document, but we can use “<a target="_blank" href="http://localhost"><code>localhost</code></a>” as the remote host, so it will behave like AWS-StartPortForwardingSession</p>
<p>You can download it from <a target="_blank" href="https://www.leapp.cloud/plugins">Leapp Plugins</a> and once activated, you need to configure it using a JSON file (ssm-conf.json in the Leapp configuration directory). You can find the documentation in the official repository:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/christian-calabrese/leapp-ssm-tunnels-plugin">https://github.com/christian-calabrese/leapp-ssm-tunnels-plugin</a></div>
<p> </p>
<p>Here’s an example of forwarding port 3389 to an instance named “test-instance”</p>
<pre><code class="lang-json">[
  {
    <span class="hljs-attr">"sessionName"</span>: <span class="hljs-string">"leapp-account1-demo-session"</span>,
    <span class="hljs-attr">"configs"</span>: [
      {
        <span class="hljs-attr">"targetTagKey"</span>: <span class="hljs-string">"Name"</span>,
        <span class="hljs-attr">"targetTagValue"</span>: <span class="hljs-string">"test-instance"</span>,
        <span class="hljs-attr">"host"</span>: <span class="hljs-string">"localhost"</span>,
        <span class="hljs-attr">"portNumber"</span>: <span class="hljs-string">"3389"</span>,
        <span class="hljs-attr">"localPortNumber"</span>: <span class="hljs-string">"5678"</span>
      }
    ] 
  }
]
</code></pre>
<p>You can add as many entries for Leapp sessions and configs as you want. Remember to change the localPortNumber parameter to avoid conflicts.</p>
<p>Here’s an example with three instances in two different AWS accounts:</p>
<pre><code class="lang-json">[
  {
    <span class="hljs-attr">"sessionName"</span>: <span class="hljs-string">"leapp-account1-demo-session"</span>,
    <span class="hljs-attr">"configs"</span>: [
      {
        <span class="hljs-attr">"targetTagKey"</span>: <span class="hljs-string">"Name"</span>,
        <span class="hljs-attr">"targetTagValue"</span>: <span class="hljs-string">"test-instance"</span>,
        <span class="hljs-attr">"host"</span>: <span class="hljs-string">"localhost"</span>,
        <span class="hljs-attr">"portNumber"</span>: <span class="hljs-string">"3389"</span>,
        <span class="hljs-attr">"localPortNumber"</span>: <span class="hljs-string">"5678"</span>
      },
      {
        <span class="hljs-attr">"targetTagKey"</span>: <span class="hljs-string">"Name"</span>,
        <span class="hljs-attr">"targetTagValue"</span>: <span class="hljs-string">"anothertest-instance"</span>,
        <span class="hljs-attr">"host"</span>: <span class="hljs-string">"localhost"</span>,
        <span class="hljs-attr">"portNumber"</span>: <span class="hljs-string">"3389"</span>,
        <span class="hljs-attr">"localPortNumber"</span>: <span class="hljs-string">"8901"</span>
      }
    ] 
  },
 {
    <span class="hljs-attr">"sessionName"</span>: <span class="hljs-string">"leapp-account2-demo-session"</span>,
    <span class="hljs-attr">"configs"</span>: [
      {
        <span class="hljs-attr">"targetTagKey"</span>: <span class="hljs-string">"Name"</span>,
        <span class="hljs-attr">"targetTagValue"</span>: <span class="hljs-string">"test-instance-another-account"</span>,
        <span class="hljs-attr">"host"</span>: <span class="hljs-string">"localhost"</span>,
        <span class="hljs-attr">"portNumber"</span>: <span class="hljs-string">"3389"</span>,
        <span class="hljs-attr">"localPortNumber"</span>: <span class="hljs-string">"1234"</span>
      }
]
</code></pre>
<p>Once you configure the plugin, you can use the context menu on an account to start all the remote port forwarding sessions. Leapp will take care of the authentication and SSM Document interaction.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688546071481/14553f0d-1800-4f69-9463-4d0dbfda1e94.png" alt class="image--center mx-auto" /></p>
<p>That’s it! No command lines to search through the shell history and no aliases to remember.</p>
<h2 id="heading-a-new-service-ec2-instance-connect-endpoint">A new service: <strong>EC2 Instance Connect Endpoint</strong></h2>
<p>While writing this article, a new announcement was made at the re:Inforce event in Los Angeles: you can deploy an endpoint in your VPC to avoid bastion hosts entirely.</p>
<p>This is a good addition, and it works fine, but there are some things that you have to take into consideration:</p>
<ul>
<li><p>You have to configure your security groups to allow connections</p>
</li>
<li><p>It only works for RDP or SSH</p>
</li>
<li><p>You have to pay for the endpoint</p>
</li>
</ul>
<p>There’s also an additional problem: this service is not organization-wide and cross-account at the time of writing. I would have preferred a more comprehensive solution with large organizations in mind.</p>
<p>On the other hand, it’s a fully managed service, and it’s brand new, so expect new features to be added!</p>
<h1 id="heading-conclusions">Conclusions</h1>
<p>Connecting to private EC2 instances has always been time-consuming because you must maintain additional infrastructure components.</p>
<p>Now with SSM, Leapp, or EC2 Instance Connect, there are easier ways; which solution to use is up to your taste.</p>
<p>Do you use other methods to manage private instances? Let us know in the comments.</p>
<p>A special thank you to Christian Calabrese for the Leapp plugin: I owe you a beer! :)</p>
<div class="hn-embed-widget" id="star-leapp"></div>]]></content:encoded></item><item><title><![CDATA[AWS IAM CLI: a cheatsheet]]></title><description><![CDATA[AWS CLI stands for Amazon Web Services Command Line Interface.
It is an open-source tool, and knowing how to use it to interact with AWS Services is crucial, especially for Developers. 
It allows to centralize control of all existing services from a ...]]></description><link>https://blog.leapp.cloud/aws-iam-cli-a-cheatsheet</link><guid isPermaLink="true">https://blog.leapp.cloud/aws-iam-cli-a-cheatsheet</guid><category><![CDATA[AWS]]></category><category><![CDATA[IAM]]></category><category><![CDATA[aws cli]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Alessandro Gaggia]]></dc:creator><pubDate>Wed, 21 Jun 2023 14:31:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1687357448791/bca17862-cd8b-4bf1-bad1-60042240df70.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://aws.amazon.com/cli/">AWS CLI</a> stands for Amazon Web Services Command Line Interface.</p>
<p>It is an open-source tool, and knowing how to use it to interact with AWS Services is crucial, especially for Developers. </p>
<p>It allows to centralize control of all existing services from a single tool, and moreover, to make automated scripts.</p>
<p><a target="_blank" href="https://aws.amazon.com/iam/">AWS Identity &amp; Access Management</a>, IAM in short, provides fine-grained access control across AWS services. </p>
<p>This article will show how to use the <a target="_blank" href="https://aws.amazon.com/cli/">AWS CLI</a> to perform all the most common IAM operations.</p>
<p><a></a></p>
<h2 id="heading-prerequisites-and-tips">Prerequisites and Tips</h2>
<ul>
<li>If you haven't installed the AWS CLI yet, start by looking at <a target="_blank" href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html">Installing the AWS CLI Guide from Amazon</a>.</li>
<li><a target="_blank" href="https://jqlang.github.io/jq/">Download</a> <strong>jq,</strong> a lightweight and flexible <strong>JSON processor</strong> for your terminal. 
Highly recommend  for <strong>automated script with the AWS CLI.</strong> Look at the <a target="_blank" href="https://jqlang.github.io/jq/">site</a> for more information.</li>
<li>Get the AWS CLI version: <code>$ aws --version</code>.</li>
</ul>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1x1o1qz9r90b5508oiom.png" alt="AWS Version" /></p>
<ul>
<li>Get the AWS CLI installation path: <code>$ which aws</code>.</li>
</ul>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dds7jozwrefdj3709tx9.png" alt="AWS CLI Path" /></p>
<ul>
<li>Configure the AWS CLI for the first time: follow our <a target="_blank" href="https://blog.leapp.cloud/how-to-use-aws-named-profiles">previous article</a>.</li>
<li><code>$ aws --cli-auto-prompt</code>: enable Auto Completion mode for the CLI, giving you suggestions as you write down your commands. Just remember to exit this mode when you need to run scripts!</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-cli-versions">AWS CLI: Versions</h2>
<ul>
<li><strong>Version 2.x —</strong> <strong>Used primarily for production environments</strong>.</li>
<li><strong>Version 1.x —</strong> Now available only for <strong>backward compatibility</strong>.</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-cli-command-anatomy">AWS CLI: command anatomy</h2>
<p>Users can create commands in <strong>single</strong> or <strong>multiple</strong> lines. The <code>\</code> character splits a command into <strong>multiple lines for better readability</strong>.</p>
<p>In general, a command is structured in this way:</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bfr7pszz2d6ezfs7055i.png" alt="AWS CLI Command description" /></p>
<p>You have the <strong>CLI invocation</strong>, and then you <strong>apply a command to a specific service</strong>. You can also add many different <strong>optional parameters</strong>.</p>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-table-of-content"><strong>AWS IAM CLI: table of content</strong></h2>
<p>There are many different commands that you can exploit using the AWS CLI, but this article will focus only on those related to <strong>IAM</strong> and <strong>STS</strong> (AWS <strong>S</strong>ecurity <strong>T</strong>oken <strong>S</strong>ervice). </p>
<p>Because commands can have many optional parameters, we recommend opening this <a target="_blank" href="https://docs.aws.amazon.com/cli/latest/reference/">link</a> in your browser for further reference information.</p>
<p>Note: you can use the TOC feature to jump to your desired command.</p>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-create-user">AWS IAM CLI: <strong>create user</strong></h2>
<p>Create a new IAM user.</p>
<p><code>aws iam create-user --user-name AlessandroArticle</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>create-user</code>: Command</li>
<li><code>--user-name</code>: Name of the user</li>
</ul>
<p>Output:</p>
<pre><code>{
    <span class="hljs-string">"User"</span>: {
        <span class="hljs-string">"Path"</span>: <span class="hljs-string">"/"</span>,
        <span class="hljs-string">"UserName"</span>: <span class="hljs-string">"AlessandroArticle"</span>,
        <span class="hljs-string">"UserId"</span>: <span class="hljs-string">"&lt;user_id&gt;"</span>,
        <span class="hljs-string">"Arn"</span>: <span class="hljs-string">"arn:aws:iam::&lt;account_number&gt;:user/AlessandroArticle"</span>,
        <span class="hljs-string">"CreateDate"</span>: <span class="hljs-string">"&lt;creation_date&gt;"</span>
    }
}
</code></pre><p><a></a></p>
<h2 id="heading-aws-iam-cli-list-users">AWS IAM CLI: <strong>list users</strong></h2>
<p>Lists all users in the credentials’ set account.</p>
<p><code>aws iam list-users</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>list-users</code>: Command</li>
</ul>
<p>Output:</p>
<pre><code>{
    <span class="hljs-string">"Users"</span>: [
        {
            <span class="hljs-string">"Path"</span>: <span class="hljs-string">"/"</span>,
                <span class="hljs-string">"UserName"</span>: <span class="hljs-string">"AlessandroArticle"</span>,
                <span class="hljs-string">"UserId"</span>: <span class="hljs-string">"&lt;user_id&gt;"</span>,
                <span class="hljs-string">"Arn"</span>: <span class="hljs-string">"arn:aws:iam::&lt;account_number&gt;:user/AlessandroArticle"</span>,
                <span class="hljs-string">"CreateDate"</span>: <span class="hljs-string">"&lt;creation_date&gt;"</span>
        }
        ]
}
</code></pre><p><a></a></p>
<h2 id="heading-aws-iam-cli-update-user">AWS IAM CLI: <strong>update user</strong></h2>
<p>Updates an IAM user. We can update the name of a user using the <code>update-user</code> command.</p>
<p><code>aws iam update-user --user-name AlessandroArticle --new-user-name AlessandroArticleNew</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>update-user</code>: Command</li>
<li><code>—-user-name</code>: The old name</li>
<li><code>—-new-user-name</code>: The new name</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-delete-user">AWS IAM CLI: <strong>delete user</strong></h2>
<p>Deletes the specified IAM user. </p>
<p><code>aws iam delete-user —user-name AlessandroArticle</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>update-user</code>: Command</li>
<li><code>—-user-name</code>: The name of the user to remove</li>
</ul>
<p>Note: you must delete the items attached to the user before attempting to delete a user, otherwise the command will fail (as per <a target="_blank" href="https://docs.aws.amazon.com/cli/latest/reference/iam/delete-user.html">AWS documentation</a>):</p>
<ul>
<li>Password ( DeleteLoginProfile )</li>
<li>Access keys ( DeleteAccessKey )</li>
<li>Signing certificate ( DeleteSigningCertificate )</li>
<li>SSH public key ( DeleteSSHPublicKey )</li>
<li>Git credentials ( DeleteServiceSpecificCredential )</li>
<li>Multi-factor authentication (MFA) device ( DeactivateMFADevice , DeleteVirtualMFADevice )</li>
<li>Inline policies ( DeleteUserPolicy )</li>
<li>Attached managed policies ( DetachUserPolicy )</li>
<li>Group memberships ( RemoveUserFromGroup )</li>
</ul>
<p><strong>Pro tips:</strong></p>
<p><strong>List userId and UserName</strong></p>
<pre><code>aws iam list-users | jq -r ‘.Users[ ]|.UserId+” “+.UserName’
</code></pre><p><strong>Get single user</strong></p>
<pre><code>aws iam get-user --user-name (username)
</code></pre><p><strong>Add user</strong></p>
<pre><code>aws iam create-user --user-name (username)
</code></pre><p><strong>Delete user</strong></p>
<pre><code>aws iam <span class="hljs-keyword">delete</span>-user --user-name (username)
</code></pre><p><strong>List access keys for user</strong></p>
<pre><code>aws iam list-access-keys --user-name (username) | jq -r .AccessKeyMetadata[ ].AccessKeyId
</code></pre><p><strong>Delete access key for user</strong></p>
<pre><code>aws iam <span class="hljs-keyword">delete</span>-access-key --user-name (username) --access-key-id (accessKeyID)
</code></pre><p><strong>Activate/deactivate access key for user</strong></p>
<pre><code>aws iam update-access-key --status Active --user-name (username) --access-key-id (access key)
</code></pre><pre><code>aws iam update-access-key --status Inactive --user-name (username) --access-key-id (access key)
</code></pre><p><strong>Generate new access key for user</strong></p>
<pre><code>aws iam create-access-key --user-name (username) | jq -r ‘.AccessKey | .AccessKeyId+” “+.SecretAccessKey’
</code></pre><p><a></a></p>
<h2 id="heading-aws-iam-cli-create-iam-policy">AWS IAM CLI: <strong>create IAM policy</strong></h2>
<p>Creates a new <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html">IAM policy</a>.</p>
<p><code>aws iam create-policy --policy-name example-policy --policy-document file://example-policy.json</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>create-policy</code>: Command</li>
<li><code>--policy-name</code>: Name of the IAM policy</li>
<li><code>--policy-document</code>: Policy document in JSON format (useful because the policies are structured files)</li>
</ul>
<p>An example policy document:</p>
<pre><code>{
    <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-string">"Statement"</span>: [
        {
              <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
              <span class="hljs-string">"Action"</span>: [
                <span class="hljs-string">"s3:GetBucketLocation"</span>,
                <span class="hljs-string">"s3:ListBucket"</span>,
                <span class="hljs-string">"s3:ListBucketMultipartUploads"</span>
              ],
              <span class="hljs-string">"Resource"</span>: [
                <span class="hljs-string">"arn:aws:s3:::&lt;my_bucket&gt;"</span>
              ]
            }
    ]
}
</code></pre><p>Output:</p>
<pre><code class="lang-idris">{
   "Policy": {
      "PolicyName":"example-policy",
      "PolicyId":"&lt;policy_id&gt;",
      "Arn":"arn:aws:iam::&lt;account_number&gt;:policy/example-policy",
      "Path":"/",
      "DefaultVersionId":"v1",
      "AttachmentCount":0,
      "PermissionsBoundaryUsageCount":0,
      "IsAttachable":true,
      "CreateDate":"&lt;creation_date&gt;",
      "UpdateDate":"&lt;update_date&gt;"
   }
}
</code></pre>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-list-iam-policies">AWS IAM CLI: <strong>list IAM policies</strong></h2>
<p>Lists IAM policies in the account.</p>
<p><code>aws iam list-policies --scopes All</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>list-policies</code>: Command</li>
<li><code>--scopes</code>: Policies scope. Possible values: <code>All</code>, <code>AWS</code>, <code>Local</code>. <strong>AWS</strong> is for managed policies, while <strong>Local</strong> for custom policies.</li>
</ul>
<p>Output</p>
<pre><code>{
    <span class="hljs-string">"Policies"</span>: [
        {
           <span class="hljs-string">"Policy"</span>: {
              <span class="hljs-string">"PolicyName"</span>:<span class="hljs-string">"example-policy"</span>,
              <span class="hljs-string">"PolicyId"</span>:<span class="hljs-string">"&lt;policy_id&gt;"</span>,
              <span class="hljs-string">"Arn"</span>:<span class="hljs-string">"arn:aws:iam::&lt;account_number&gt;:policy/example-policy"</span>,
              <span class="hljs-string">"Path"</span>:<span class="hljs-string">"/"</span>,
              <span class="hljs-string">"DefaultVersionId"</span>:<span class="hljs-string">"v1"</span>,
              <span class="hljs-string">"AttachmentCount"</span>:<span class="hljs-number">0</span>,
              <span class="hljs-string">"PermissionsBoundaryUsageCount"</span>:<span class="hljs-number">0</span>,
              <span class="hljs-string">"IsAttachable"</span>:<span class="hljs-literal">true</span>,
              <span class="hljs-string">"CreateDate"</span>:<span class="hljs-string">"&lt;creation_date&gt;"</span>,
              <span class="hljs-string">"UpdateDate"</span>:<span class="hljs-string">"&lt;update_date&gt;"</span>
           }
        }
    ]
}
</code></pre><p><a></a></p>
<h2 id="heading-aws-iam-cli-update-iam-policy">AWS IAM CLI: <strong>update IAM policy</strong></h2>
<p>Edit an IAM policy and set it as default.</p>
<pre><code>aws iam create-policy-version \
 --policy-arn arn:aws:iam::<span class="hljs-number">123456789012</span>:policy/my-policy \
 --policy-<span class="hljs-built_in">document</span> file:<span class="hljs-comment">//NewPolicyVersion.json --set-as-default</span>
</code></pre><ul>
<li><code>iam</code>: Service</li>
<li><code>create-policy-version</code>: Command</li>
<li><code>--policy-arn</code>: ARN of the policy</li>
<li><code>--policy-document</code>: Updated policy file</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-delete-iam-policy">AWS IAM CLI: <strong>delete IAM policy</strong></h2>
<p>Delete a policy given the ARN.</p>
<p><code>aws iam delete-policy --policy-arn arn**:**aws**:**iam**::**123456789012**:**policy/my-policy</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>delete-policy</code>: Command</li>
<li><code>--policy-arn</code>: ARN of the policy</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-create-iam-role">AWS IAM CLI: <strong>create IAM role</strong></h2>
<p>Creates a new IAM role. The arguments for this command are:</p>
<p><code>aws iam create-role --role-name example-role --assume-role-policy-document file://assume-policy.json</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>create-role</code>: Command</li>
<li><code>--role-name</code>: Name of the IAM role</li>
<li><code>--assume-role-policy-document</code>: Trust relationship policy document that grants an entity permission to assume the role</li>
</ul>
<p>In this example, we will create an IAM role that grants AWS Glue permission to assume the role (as <a target="_blank" href="https://blog.leapp.cloud/what-is-an-iam-principal">principal</a>).</p>
<pre><code>{
    <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-string">"Statement"</span>: [
        {
        <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
        <span class="hljs-string">"Principal"</span>: {
        <span class="hljs-string">"Service"</span>: <span class="hljs-string">"glue.amazonaws.com"</span>
        },
        <span class="hljs-string">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>
        }
    ]
}
</code></pre><p>Output:</p>
<pre><code>{
    <span class="hljs-string">"Role"</span>: {
        <span class="hljs-string">"Path"</span>: <span class="hljs-string">"/"</span>,
        <span class="hljs-string">"RoleName"</span>: <span class="hljs-string">"example-role"</span>,
        <span class="hljs-string">"RoleId"</span>: <span class="hljs-string">"&lt;role_id&gt;"</span>,
        <span class="hljs-string">"Arn"</span>: <span class="hljs-string">"arn:aws:iam::&lt;account_number&gt;:role/example-role"</span>,
        <span class="hljs-string">"CreateDate"</span>: <span class="hljs-string">"&lt;creation_date&gt;"</span>,
        <span class="hljs-string">"AssumeRolePolicyDocument"</span>: {
            <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
            <span class="hljs-string">"Statement"</span>: [
                {
                    <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
                    <span class="hljs-string">"Principal"</span>: {
                        <span class="hljs-string">"Service"</span>: <span class="hljs-string">"glue.amazonaws.com"</span>
                    },
                    <span class="hljs-string">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>
                }
            ]
        }
    }
}
</code></pre><p><a></a></p>
<h2 id="heading-aws-iam-cli-delete-a-role">AWS IAM CLI: <strong>delete a Role</strong></h2>
<p>Deletes an IAM Role.</p>
<p><code>aws iam delete-role --role-name Test-Role</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>delete-role</code>: Command</li>
<li><code>--role-name</code>: Name of the IAM Role to remove</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-attach-policy-to-a-user">AWS IAM CLI: <strong>attach policy to a User</strong></h2>
<p>To allow a User to do some actions, apply a policy to it.</p>
<p><code>aws iam attach-user-policy --user-name AlessandroArticle --policy-arn arn:aws:iam::&lt;policy_id&gt;:policy/my-policy</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>attach-user-policy</code>: Command</li>
<li><code>--user-name</code>: Name of the IAM user</li>
<li><code>--policy-arn</code>: ARN of the IAM policy to attach</li>
</ul>
<p>In this example, we will attach the IAM policy we created earlier to an example IAM.</p>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-attach-policy-to-an-iam-role">AWS IAM CLI: <strong>attach policy to an IAM role</strong></h2>
<p>We can also attach a policy to a IAM role.</p>
<p><code>aws iam attach-role-policy --role-name example-role --policy-arn arn:aws:iam::&lt;policy_id&gt;:policy/my-policy</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>attach-role-policy</code>: Command</li>
<li><code>--role-name</code>: Name of the IAM role</li>
<li><code>--policy-arn</code>: ARN of the IAM policy you want to attach</li>
</ul>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-list-all-policies-attached-to-a-user">AWS IAM CLI: <strong>list all policies attached to a user</strong></h2>
<p>We can list all policies attached to an IAM User.</p>
<p><code>aws iam list-attached-user-policies --user-name AlessandroArticle</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>list-attached-user-policies</code>: Command</li>
<li><code>--user-name</code>: The User to whom the policies are attached to</li>
</ul>
<p>Output</p>
<pre><code class="lang-idris">{
    "AttachedPolicies": [
        {
            "PolicyName": "my-policy",
            "PolicyArn": "arn:aws:iam::&lt;account_number&gt;:policy/learnaws-dynamo-policy"
        }
    ]
}
</code></pre>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-list-all-policies-attached-to-a-role">AWS IAM CLI: <strong>list all policies attached to a role</strong></h2>
<p>List all policies attached to an IAM Role.</p>
<p><code>aws iam list-attached-role-policies --role-name example-role</code></p>
<ul>
<li><code>iam</code>: Service</li>
<li><code>list-attached-role-policies</code>: Command</li>
<li><code>--role-name</code>: The Role to whom the policies are attached to</li>
</ul>
<p>Output</p>
<pre><code class="lang-idris">{
    "AttachedPolicies": [
        {
            "PolicyName": "my-policy",
            "PolicyArn": "arn:aws:iam::&lt;account_number&gt;:policy/example-policy"
        }
    ]
}
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">{
    <span class="hljs-string">"UserId"</span>: <span class="hljs-string">"AROAJQ3ISEWFFR6GXAW:&lt;user_name&gt;"</span>,
    <span class="hljs-string">"Account"</span>: <span class="hljs-string">"637004329899"</span>,
    <span class="hljs-string">"Arn"</span>: <span class="hljs-string">"arn:aws:sts::637004329899:assumed-role/&lt;role-name&gt;/&lt;user_name&gt;"</span>
}
</code></pre>
<p><a></a></p>
<h2 id="heading-aws-iam-cli-jq-snippets">AWS IAM CLI: <strong>jq snippets</strong></h2>
<p>Finally, thanks to the excellent <a target="_blank" href="https://www.bluematador.com/learn/aws-cli-cheatsheet">tutorial from BlueMatador</a>, here we present some fast snippets that integrate the <strong><strong>jq</strong></strong> tool to extrapolate useful info for different use-cases. Kudos to them 🙂.</p>
<p><strong>List groups</strong></p>
<pre><code>aws iam list-groups | jq -r .Groups[ ].GroupName
</code></pre><p><strong>Add/Delete groups</strong></p>
<pre><code>aws iam create-group --group-name (groupName)
</code></pre><p><strong>List policies and ARNs</strong></p>
<pre><code>aws iam list-policies | jq -r ‘.Policies[ ]|.PolicyName+” “+.Arn’
</code></pre><pre><code>aws iam list-policies --scope AWS | jq -r ‘.Policies[ ]|.PolicyName+” “+.Arn’
</code></pre><pre><code>aws iam list-policies --scope Local | jq -r ‘.Policies[ ]|.PolicyName+” “+.Arn’
</code></pre><p><strong>List user/group/roles for a policy</strong></p>
<pre><code>aws iam list-entities-<span class="hljs-keyword">for</span>-policy --policy-arn arn:aws:iam:<span class="hljs-number">2308345</span>:policy/example-ReadOnly
</code></pre><p><strong>List policies for a group</strong></p>
<pre><code>aws iam list-attached-group-policies --group-name (groupname)
</code></pre><p><strong>Add policy to a group</strong></p>
<pre><code>aws iam attach-group-policy --group-name (groupname) --policy-arn arn:aws:iam::aws:policy/exampleReadOnlyAccess
</code></pre><p><strong>Add user to a group</strong></p>
<pre><code>aws iam add-user-to-group --group-name (groupname) --user-name (username)
</code></pre><p><strong>Remove user from a group</strong></p>
<pre><code>aws iam remove-user-<span class="hljs-keyword">from</span>-group --group-name (groupname) --user-name (username)
</code></pre><p><strong>List users in a group</strong></p>
<pre><code>aws iam get-group --group-name (groupname)
</code></pre><p><strong>List groups for a user</strong></p>
<pre><code>aws iam list-groups-<span class="hljs-keyword">for</span>-user --user-name (username)
</code></pre><p><strong>Attach/detach policy to a group</strong></p>
<pre><code>aws iam attach-group-policy --group-name (groupname) --policy-arn arn:aws:iam::aws:policy/DynamoDBFullAccess
</code></pre><pre><code>aws iam detach-group-policy --group-name (groupname) --policy-arn arn:aws:iam::aws:policy/DynamoDBFullAccess
</code></pre><p><a></a></p>
<h2 id="heading-conclusions">Conclusions</h2>
<p>This article shows that AWS CLI is a powerful tool for automatic operations on AWS services. </p>
<p>In particular, we have used IAM and STS services to explore all the different commands that we can leverage for Access Management and Identity governance.</p>
<p>We have demonstrated that AWS CLI commands can be chained with other terminal tools to push even further your automation scripts.</p>
<p>Finally, we have seen how <strong>jq</strong> can be a perfect companion for the CLI to obtain properties out of JSON-formatted files or command results.</p>
<p>If this article interested you, next week we will continue with a new cheatsheet correlated to STS and how it is tied closely to our open-source tool <a target="_blank" href="https://leapp.cloud/">Leapp</a>. Don’t miss it out!</p>
<p>Thank you everyone, for coming this far. We hope that you enjoyed this little “cheatsheet”. </p>
<p>As always, if you have questions, clarifications, or just want to share your opinions, feel free to join our <strong><a target="_blank" href="https://join.slack.com/t/noovolari/shared_invite/zt-opn8q98k-HDZfpJ2_2U3RdTnN~u_B~Q">Top of the Ops community</a></strong>.</p>
<p>Until next time, stay safe 🙂!</p>
]]></content:encoded></item><item><title><![CDATA[Identity and Access Management in Multi-Cloud Environments]]></title><description><![CDATA[IAM (Identity and Access Management) is a crucial part of any cloud environment.
As organizations evolve, they may look at multi-cloud as a solution to consume cloud services in different cloud providers' technologies (such as AI/ML, data analytics, ...]]></description><link>https://blog.leapp.cloud/identity-and-access-management-in-multi-cloud-environments</link><guid isPermaLink="true">https://blog.leapp.cloud/identity-and-access-management-in-multi-cloud-environments</guid><category><![CDATA[IAM]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Azure]]></category><category><![CDATA[GCP]]></category><dc:creator><![CDATA[Eyal Estrin]]></dc:creator><pubDate>Fri, 16 Jun 2023 13:30:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685636223086/853619e2-ff44-41c6-b433-9426b02acd78.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>IAM (Identity and Access Management) is a crucial part of any cloud environment.</p>
<p>As organizations evolve, they may look at multi-cloud as a solution to consume cloud services in different cloud providers' technologies (such as AI/ML, data analytics, and more), to have the benefit of using different pricing models, or to decrease the risk of vendor lock-in.</p>
<p>Before we begin the discussion about IAM, we need to understand the following fundamental concepts:</p>
<ul>
<li><p>Identity – An account represents a persona (human) or service (non-interactive account)</p>
</li>
<li><p>Authentication – The act where an identity proves himself against a system (such as providing username and password, certificate, API key, and more)</p>
</li>
<li><p>Authorization – The act of validating granting an identity’s privileges to take actions on a system (such as view configuration, read database content, upload a file to object storage, and more)</p>
</li>
<li><p>Access Management – The entire lifecycle of IAM – from account provisioning, granting access, and validating privileges until account or privilege revocation</p>
</li>
</ul>
<h2 id="heading-identity-and-access-management-terminology">Identity and Access Management Terminology</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685969517515/e6bed806-4d30-4747-9527-43b8f9ad084a.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-authorization-in-the-cloud">Authorization in the Cloud</h2>
<p>Although all cloud providers have the same concept of identities, when we deep dive into the concept of authorization or access management to resources/services, we need to understand the differences between cloud providers.</p>
<h3 id="heading-authorization-in-aws">Authorization in AWS</h3>
<p>AWS has two concepts for managing permissions to resources:</p>
<ul>
<li><p>IAM Role – Permissions assigned to an identity temporarily.</p>
</li>
<li><p>IAM Policy – A document defines a set of permissions assigned to an IAM role.</p>
</li>
</ul>
<p>Permissions in AWS can be assigned to:</p>
<ul>
<li><p>Identity – A policy attached to a user, group, or role.</p>
</li>
<li><p>Resource – A policy attached to a resource (such as Amazon S3 bucket).</p>
</li>
</ul>
<h3 id="heading-authorization-in-azure">Authorization in Azure</h3>
<p>Permissions in Azure AD are controlled by roles.</p>
<p>A role defines the permissions an identity has over an Azure resource.</p>
<p>Within Azure AD, you control permissions using RBAC (Role-based access control).</p>
<p>Azure AD supports the following types of roles:</p>
<ul>
<li><p>Built-in roles – A pre-defined role according to job function (as you can read on the <a target="_blank" href="https://learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference">link</a>).</p>
</li>
<li><p>Custom roles – A role that we create ourselves to match the principle of least privilege.</p>
</li>
</ul>
<h3 id="heading-authorization-in-google-cloud">Authorization in Google Cloud</h3>
<p>Permissions in Google Cloud IAM are controlled by IAM roles.</p>
<p>Google Cloud IAM supports the following types of IAM roles:</p>
<ul>
<li><p>Basic roles – The most permissive type of roles (Owner, Editor, and Viewer).</p>
</li>
<li><p>Predefined roles – Roles managed by Google, which provides granular access to specific services (as you can read on the <a target="_blank" href="https://cloud.google.com/iam/docs/understanding-roles#predefined">link</a>).</p>
</li>
<li><p>Custom roles – User-specific roles, which provide the most granular access to resources.</p>
</li>
</ul>
<h3 id="heading-authorization-default-behavior">Authorization – Default behavior</h3>
<p>As we can see below each cloud provider takes a different approach to default permissions:</p>
<ul>
<li><p><a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html#id_users_perms">AWS</a> – By default, new IAM users have no permission to access any resource in AWS.<br />  To allow access to resources or take actions, manually assign the user an IAM role.</p>
</li>
<li><p><a target="_blank" href="https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/users-default-permissions">Azure</a> – By default, all Azure AD users are granted a set of default permissions (such as listing all users, reading all properties of users and groups, registering new applications, and more).</p>
</li>
<li><p><a target="_blank" href="https://cloud.google.com/iam/docs/service-account-types#default">Google Cloud</a> – By default, a new service account is granted the Editor role on the project level.</p>
</li>
</ul>
<h2 id="heading-identity-federation">Identity Federation</h2>
<p>When we are talking about identity federation, there are two concepts:</p>
<ul>
<li><p>Service Provider (SP) – Provide access to resources</p>
</li>
<li><p>Identity Provider (IdP) – Authenticate the identities</p>
</li>
</ul>
<p>Identities (user accounts, service accounts, groups, etc.) are managed by an Identity Provider (IdP).</p>
<p>An IdP can exist in the local data center (such as Microsoft Active Directory) or the public cloud (such as AWS IAM, Azure AD, Google Cloud IAM, etc.)</p>
<p>Federation is the act of creating trust between separate IdP’s.</p>
<p>Federation allows us to keep identity in one repository (i.e., Identity Provider).</p>
<p>Once we set up an identity federation, we can grant an identity privilege to consume resources in a remote repository.</p>
<p>Example: a worker with an account in Microsoft Active Directory, reading a file from object storage in Azure, once a federation trust was established between Microsoft Active Directory and Azure Active Directory.</p>
<p>When federating between the on-premise and cloud environments, we need to recall the use of different protocols.</p>
<p>On-premise environments are using legacy authentication protocols such as Kerberos or LDAP.</p>
<p>In the public cloud, the common authentication protocols are <a target="_blank" href="https://en.wikipedia.org/wiki/SAML_2.0">SAML 2.0</a>, <a target="_blank" href="https://openid.net/connect/">Open ID Connect (OIDC)</a>, and <a target="_blank" href="https://oauth.net/2/">OAuth 2.0</a></p>
<p>Each cloud provider has a list of supported external third-party identity providers to federate with, as you can read in the list below:</p>
<ul>
<li><p><a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml_3rd-party.html">Integrating third-party SAML solution providers with AWS</a></p>
</li>
<li><p><a target="_blank" href="https://www.microsoft.com/en-us/download/details.aspx?id=56843">Azure AD Identity Provider Compatibility Docs</a></p>
</li>
<li><p><a target="_blank" href="https://cloud.google.com/iam/docs/configuring-workforce-identity-federation">Google Cloud IAM - Configure workforce identity federation</a></p>
</li>
</ul>
<h2 id="heading-single-sign-on">Single Sign-On</h2>
<p>The concept behind SSO is to allow identities (usually end-users) access to resources in the cloud while having to sign (to an identity provider) once.</p>
<p>Over the past couple of years, the concept of SSO was extended and now it is possible to allow a single identity (who authenticated to a specific identity provider), access to resources over federated login to an external (mostly SAML) identity provider.</p>
<p>Each cloud provider has its own SSO service, supporting federation with external identity providers:</p>
<ul>
<li><p><a target="_blank" href="https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html">AWS IAM Identity Center</a></p>
</li>
<li><p><a target="_blank" href="https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/what-is-single-sign-on">Azure Active Directory single sign-on</a></p>
</li>
<li><p><a target="_blank" href="https://cloud.google.com/iam/docs/workload-identity-federation">Google Cloud Workload identity federation</a></p>
</li>
</ul>
<h2 id="heading-steps-for-creating-a-federation-between-cloud-providers">Steps for creating a federation between cloud providers</h2>
<p>The process below explains (at a high level) the steps require to set up identity federation between different cloud providers:</p>
<ol>
<li><p>Choose an IdP (where identities will be created and authenticated to).</p>
</li>
<li><p>Create a SAML identity provider.</p>
</li>
<li><p>Configure roles for your third-party identity provider.</p>
</li>
<li><p>Assign roles to the target users.</p>
</li>
<li><p>Create trust between SP and IdP.</p>
</li>
<li><p>Test the ability to authenticate and identify (user) to a resource in a remote/external cloud provider.</p>
</li>
</ol>
<h3 id="heading-additional-references">Additional References:</h3>
<ul>
<li><p><a target="_blank" href="https://docs.aws.amazon.com/singlesignon/latest/userguide/azure-ad-idp.html">AWS IAM Identity Center and Azure AD as IdP</a></p>
</li>
<li><p><a target="_blank" href="https://aws.amazon.com/blogs/security/how-to-set-up-federated-single-sign-on-to-aws-using-google-workspace/">How to set up IAM federation using Google Workspace</a></p>
</li>
<li><p><a target="_blank" href="https://learn.microsoft.com/en-us/azure/active-directory/saas-apps/aws-single-sign-on-tutorial">Azure AD SSO integration with AWS IAM Identity Center</a></p>
</li>
<li><p><a target="_blank" href="https://learn.microsoft.com/en-us/azure/active-directory/saas-apps/google-apps-tutorial">Azure AD SSO integration with Google Cloud / G Suite Connector by Microsoft</a></p>
</li>
<li><p><a target="_blank" href="https://cloud.google.com/architecture/identity/federating-gcp-with-azure-active-directory">Federating Google Cloud with Azure Active Directory</a></p>
</li>
<li><p><a target="_blank" href="https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds">Configure Google workload identity federation with AWS or Azure</a></p>
</li>
</ul>
<h2 id="heading-summary">Summary</h2>
<p>In this blog post, we deeply explored identity and access management in the cloud, comparing different aspects of IAM in AWS, Azure, and GCP.</p>
<p>After we have reviewed how authentication and authorization work for each of the three cloud providers, we have explained how federation and SSO work in a multi-cloud environment.</p>
<p>Important to keep in mind:</p>
<p>When we are building systems in the cloud, whether they are publicly exposed or even internal, we need to follow some basic rules:</p>
<ul>
<li><p>All-access to resources/systems/applications must be authenticated</p>
</li>
<li><p>Permissions must follow the principle of least privileged and business requirements</p>
</li>
<li><p>All access must be audited (for future analysis, investigation purposes, etc.)</p>
</li>
</ul>
<h3 id="heading-about-the-author">About the Author</h3>
<p>Eyal Estrin is a cloud and information security architect, the owner of the blog <a target="_blank" href="https://security-24-7.com/">Security &amp; Cloud 24/7</a>, and the author of the book <a target="_blank" href="https://amzn.to/3xMI4Ak">Cloud Security Handbook</a>, with over 20 years in the IT industry.<br />Eyal is an <a target="_blank" href="https://aws.amazon.com/developer/community/community-builders/">AWS Community Builder</a> since 2020.<br />You can connect with him on <a target="_blank" href="https://twitter.com/eyalestrin">Twitter</a> and <a target="_blank" href="https://www.linkedin.com/in/eyalestrin/">LinkedIn</a>.</p>
]]></content:encoded></item><item><title><![CDATA[What is an IAM Principal?]]></title><description><![CDATA[Whenever you find yourself working with the AWS access model, being a newbie or an experienced DevOps, there is a lot of terminology to digest and learn.
Users, Roles and Policies are terms that we learn pretty early in our career, however, there is ...]]></description><link>https://blog.leapp.cloud/what-is-an-iam-principal</link><guid isPermaLink="true">https://blog.leapp.cloud/what-is-an-iam-principal</guid><category><![CDATA[IAM]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Security]]></category><category><![CDATA[Governance]]></category><dc:creator><![CDATA[Alessandro Gaggia]]></dc:creator><pubDate>Wed, 07 Jun 2023 12:56:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1686142177046/d66f0d45-cb88-4aff-83ea-d963a9fa024b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Whenever you find yourself working with the AWS access model, being a newbie or an experienced DevOps, there is a lot of terminology to digest and learn.</p>
<p>Users, Roles and Policies are terms that we learn pretty early in our career, however, there is one concept that has a lot of meaning behind it and, in my opinion, deserves a little more explanation: <strong>IAM Principal</strong>!</p>
<h2 id="heading-iam-principal-definition">IAM Principal: definition</h2>
<p>Let’s start by giving a standard definition: <em>a principal is a human user or workload that can make a request for an action or operation on an AWS resource.</em></p>
<p>Moreover, a principal is anything, AWS related, that can <em>send a request to AWS, via the</em> <strong>Management Console</strong>, <strong>the AWS API</strong>, or <strong>the AWS CLI.</strong></p>
<h2 id="heading-iam-principal-actors">IAM Principal: actors</h2>
<p>In AWS <strong>What</strong> or <strong>Who</strong> are the “actors” that can be referred as Principals?</p>
<ul>
<li><p>Root User</p>
</li>
<li><p>IAM Users</p>
</li>
<li><p>IAM Roles/Temporary Security Tokens</p>
</li>
</ul>
<p>The main differences among them are <strong>Who can impersonate them</strong>, and <strong>What credentials they are granted</strong>.</p>
<p><strong>Users</strong> are impersonated by human users while <strong>Roles</strong> by services, or workloads in general.</p>
<p>Also, while the first actors are granted <strong>long-lived credentials</strong>, Roles use <strong>temporary credentials</strong>.</p>
<p><strong>Root user</strong></p>
<p>The Root user is the owner of the AWS main Account, and it should be protected by <strong>MFA</strong> and a <strong>strong password</strong> right after registering. We <strong>should avoid using the Root user as a Principal</strong>, for security reasons, and instead use IAM Users and Roles.</p>
<p>He accesses AWS with email and password: that is why we must avoid using it for operation work!</p>
<hr />
<p><strong>IAM Users</strong></p>
<p>an IAM user is a <strong>persistent</strong> entity that is given a set of credentials to manage services on AWS. The IAM User can be associated with both long or short-lived credentials (tough short-lived ones are <strong>much preferred</strong>).</p>
<p>An IAM User can be authorized to perform actions directly via an AWS Policy attached to it, or via a Group Policy.</p>
<p>An IAM User is created through:</p>
<ul>
<li><p>AWS Management Console</p>
</li>
<li><p>CLI</p>
</li>
<li><p>SDKs</p>
</li>
</ul>
<hr />
<p><strong>IAM Role</strong></p>
<p>an IAM Role is a Principal <strong>associated directly with AWS Resources</strong> or assumed by an IAM User, the AWS CLI, or one of the AWS SDKs available. It has <strong>permissions granted via temporary credentials</strong>. It has one or more Policies attached to it.</p>
<p>Some use cases related to IAM Roles involve:</p>
<ul>
<li><p><strong>Amazon EC2 Roles</strong>: grant permissions to <strong>applications running on an Amazon EC2 instance</strong>.</p>
</li>
<li><p><strong>Cross-Account Access</strong>: grant permissions to <strong>users from other AWS accounts</strong>, whether in control of those accounts or not.</p>
</li>
</ul>
<p><strong>Temporary Security Tokens:</strong></p>
<p>Temporary Security Tokens are obtained from the AWS Security Token Service (STS).</p>
<p>They always have an expiration date and time, and have a lifespan between <strong>15 minutes</strong> and <strong>up to 36 hours</strong>.</p>
<p>These tokens are usually obtained through a <strong>Federation Process</strong>, which involves granting permissions to users <strong>authenticated by a trusted external system</strong>.</p>
<p>Here is a summary from AWS showing some types of Roles/Temporary Security Tokens and from what they are obtained:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Principal</td><td>Type</td><td>Docs &amp; Links</td></tr>
</thead>
<tbody>
<tr>
<td>Federated User (Login via custom proxy architecture)</td><td>FederatedUser</td><td></td></tr>
<tr>
<td>Web Federated User (Login with Amazon, Amazon Cognito, Facebook, Google)</td><td>AssumedRole</td><td><a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_user-id.html">https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_user-id.html</a></td></tr>
<tr>
<td>SAML 2.0 Federated User</td><td>AssumedRole</td><td><a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html#CreatingSAML-userid">https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html#CreatingSAML-userid</a></td></tr>
<tr>
<td>AWS SSO User</td><td>AssumedRole</td><td><a target="_blank" href="https://dev.to/aws-heroes/adding-aws-sso-and-controlling-permissions-56ga">https://dev.to/aws-heroes/adding-aws-sso-and-controlling-permissions-56ga</a></td></tr>
</tbody>
</table>
</div><p>A special mention goes to <strong>AWS SSO Users</strong> that are <strong>configured via IAM Identity Center permission sets</strong> to access different <strong>accounts with different roles</strong>. When a user lands on an account <strong>a role is given transparently</strong> to access services and resources according to the policies set up by the administrator.</p>
<p>IAM Roles, AWS SSO, and Temporary Security Tokens are meant for advanced AWS IAM usage and have always a <strong>limited set duration of time</strong>.</p>
<p>Because these Principals are <strong>extremely important and versatile</strong>, I strongly advise reading more on the argument, starting from <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html">this article</a> and also this <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">one</a>, concluding with this <a target="_blank" href="https://dev.to/aws-heroes/adding-aws-sso-and-controlling-permissions-56ga">one</a> from AWS Hero <a target="_blank" href="https://aws.amazon.com/it/developer/community/heroes/matt-lewis/"><strong>Matt Lewis</strong></a>.</p>
<h2 id="heading-iam-principal-authentication-requests-and-authorization">IAM Principal: authentication, requests, and authorization</h2>
<p>When working with Principals we must understand the two actions that must be taken to finally obtain a set of valid Credentials.</p>
<p>First <strong>Authentication</strong> of the subject against AWS or a valid Identity Provider, and then <strong>Authorization</strong> to be able to perform actions and access specific resources.</p>
<h3 id="heading-iam-principal-authentication">IAM Principal: Authentication</h3>
<p>A Principal must always authenticate to send AWS requests.</p>
<p>Only Amazon S3, SQS, SNS, and AWS STS allow limited (and specific) requests from anonymous users, <strong>but they're the exception</strong>.</p>
<p>To log in as a <strong>Root User on the console</strong>, use your <strong>email and password</strong>.</p>
<p>As a <strong>Federated User</strong>, you can access AWS resources through <strong>IAM roles granted by your identity provider's authentication</strong>.</p>
<p>Enter your Access Key ID and Secret Access Key to authenticate as an <strong>IAM user</strong>.</p>
<p>To authenticate workloads, use <strong>temporary</strong> or long-term credentials (always preferring the first).</p>
<p>DevOps’ best practices recommend using MFA and temporary credentials to keep your account secure.</p>
<h3 id="heading-iam-principal-request">IAM Principal: Request</h3>
<p>When a principal tries to do something with AWS using the AWS Management Console, an SDK, or the CLI, it sends a <em>request</em> to AWS with the following information:</p>
<ul>
<li><p><strong>Actions or operations:</strong> the actions to perform.</p>
</li>
<li><p><strong>Resources:</strong> the AWS services or objects to manipulate.</p>
</li>
<li><p><strong>Principal:</strong> and now we know what they can be 😀!</p>
</li>
<li><p><strong>Environment data:</strong> various metadata, like IP address, User agent, etc.</p>
</li>
<li><p><strong>Resource data:</strong> metadata depending on the specific AWS resource.</p>
</li>
</ul>
<p>AWS puts all of these in a <em>request context</em>, which is used to evaluate and authorize the request.</p>
<h3 id="heading-iam-principal-authorization">IAM Principal: Authorization</h3>
<p>After Authentication, you must also be authorized to complete your request.</p>
<p>During the authorization process, AWS uses the <em>request context</em> to check for <strong>policies that conform to the request</strong>.</p>
<p>It then <strong>parses the policies to determine whether to allow or deny the request</strong>.</p>
<p>Most policies are stored in AWS as <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json">JSON documents</a> and specify the permissions for principal entities. There are <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html">several types of policies</a> that can affect the outcome of the request.</p>
<p>If a single permissions policy <strong>includes a denied action</strong>, <strong>AWS denies the entire request and stops evaluating</strong>.</p>
<p>Because requests are <em>denied by default</em>, they can complete only if every part of the request is allowed by the permissions policies.</p>
<p>The general rules to understand how the authorization works are the following:</p>
<ul>
<li><p><strong>By default, all requests are denied</strong>.</p>
</li>
<li><p><strong>An explicit allow</strong> (identity-based or resource-based) <strong>overrides the default deny</strong>.</p>
</li>
<li><p><strong>Organizations' SCPs, IAM permissions boundaries, or session policies override the allow</strong>. But <strong>if there is more than one of these policies, they all need to allow the request</strong>.</p>
</li>
<li><p>An <strong>explicit denial in any policy overrides any allows</strong>.</p>
</li>
</ul>
<p>To learn more about how this process is evaluated, see <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html">Policy evaluation logic</a>.</p>
<h2 id="heading-iam-principal-credentials">IAM Principal: Credentials</h2>
<p>As we have seen there are two types of credentials granted to a Principal: <strong>long-lived</strong> and <strong>temporary short-lived</strong>.</p>
<p>Long-lived credentials last until an administrator <strong>explicitly removes them</strong> from a Principals and usually, are applied to <strong>Root Users</strong> and <strong>IAM Users/Groups</strong>.</p>
<p><strong>Short-lived credentials are temporary</strong>, and have an explicit expiration date and time.</p>
<p><strong>They are generated through AWS STS Service</strong> and a<strong>re associated with IAM Roles, Assumed Roles</strong>, or even <strong>Federated Identities</strong> (AWS SSO, Web, SAML, OIDC, OAuth, Cognito, Azure AD, etc.)</p>
<h2 id="heading-iam-principal-best-practices">IAM Principal: Best Practices</h2>
<p>As short-lived credentials can also be applied to a Group or a User thanks to the Assume Role action, I <strong>strongly recommend adhering to DevOps best practices and always using short-lived credentials whenever possible.</strong></p>
<p>It is preferable to use temporary credentials <strong>because they reduce the potential damage done by an attacker stealing them</strong> (they are limited in time).</p>
<p>It is also savvy to <strong>narrow down policies associated with users and roles to the bare minimum set of resources</strong> that you need for your work. Always take advantage of the Deny First rules!</p>
<p>With the Introduction of <strong>IAM Identity Center is always preferable for administrators to use it for creating new Users</strong> as they will also benefit from a landing panel to choose the account and role from.</p>
<h2 id="heading-sum-up">Sum Up</h2>
<p>In this short article, we learned about AWS IAM Principals, how they are categorized, and what they stand for.</p>
<p>We have learned that IAM Principals have to deal with both an Authentication and an Authorization process to be able to operate successfully on AWS.</p>
<p>We have seen what a request, made to AWS by a Principal, contains.</p>
<p>We have seen what a Root account and an IAM User are, how they differ from IAM Roles, and moreover from Temporary Security Tokens.</p>
<p>We have analyzed the differences between Long and Short-lived Credentials, and why the latter are preferable and more secure.</p>
<p>We have proposed some basic best practices to follow to better use your AWS Principals.</p>
<p>So, thank you all for reaching the end of the article!</p>
<p>As always, if you have suggestions or questions, feel free to come and have a chat with us on our <a target="_blank" href="https://join.slack.com/t/noovolari/shared_invite/zt-opn8q98k-HDZfpJ2_2U3RdTnN~u_B~Q">Slack</a> community.</p>
<p>Until next time, see ya and stay safe! 🙂</p>
]]></content:encoded></item><item><title><![CDATA[Who am I in AWS?]]></title><description><![CDATA[Have you ever been in a situation in which you were about to forward a critical API request to AWS but you were not sure what was the target of your request?
It’s always a best practice to check if the API request target is the one that you expect, e...]]></description><link>https://blog.leapp.cloud/who-am-i-in-aws</link><guid isPermaLink="true">https://blog.leapp.cloud/who-am-i-in-aws</guid><category><![CDATA[AWS]]></category><category><![CDATA[IAM]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Eric Villa]]></dc:creator><pubDate>Thu, 01 Jun 2023 15:10:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685631815462/43ae958c-6e96-45e6-91da-b8cb47967150.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Have you ever been in a situation in which you were about to forward a critical API request to AWS but you were not sure what was the target of your request?</p>
<p>It’s always a best practice to check if the API request target is the one that you expect, especially if the operations that are about to be performed may have major repercussions on your AWS accounts.</p>
<h2 id="heading-who-am-i-in-the-context-of-aws">Who am I in the context of AWS?</h2>
<p>When it comes generate temporary credentials and get information about them, AWS Security Token Service (AWS STS) comes to the rescue.</p>
<p>“Who am I in the context of AWS” is exactly the question the AWS STS GetCallerIdentity API provides an answer to. The answer tells you what is the account affected by the next API call if credentials are not going to change in the meanwhile.</p>
<p>Yes, I mentioned AWS STS. Indeed, this is the service that I should call upon to get that information. To interface with the GetCallerIdentity API, two requirements must be fulfilled:</p>
<ul>
<li><p>network connectivity;</p>
</li>
<li><p>a valid set of AWS Credentials, placed in one of the locations the client that you’re using expects them to be (environment variables, shared configuration files, etcetera). As you can see on <a target="_blank" href="https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html">this</a> documentation page, authentication information is added to the request via the Authorization Header.</p>
</li>
</ul>
<p>The reference client used in this article is the AWS CLI (Command Line Interface). The AWS CLI command that you should issue to get this information is the following:</p>
<pre><code class="lang-bash">aws sts get-caller-identity
</code></pre>
<h2 id="heading-aws-sts-get-caller-identity-response-structure">aws sts get-caller-identity response structure</h2>
<p>Regardless of the IAM identity used to authenticate the request, the API response always contains three fields:</p>
<ul>
<li><p>UserId - the unique identifier of the calling entity;</p>
</li>
<li><p>Account - the AWS Account ID number of the account that owns or contains the calling entity;</p>
</li>
<li><p>Arn - the Amazon Resource Name associated with the calling identity.</p>
</li>
</ul>
<p>While the Account field is always a 12-digits number, Arn and UserId depend on the principal that initiated the request.</p>
<p>In this blog post, we’ll focus on two categories of principals: User and AssumedRole.</p>
<p>The User category simply corresponds to the IAM User principal.</p>
<p>The AssumedRole category covers more principals, but we’ll focus on SAML federated user (assumed via AssumeRoleWithSAML API), assumed role (assumed via AssumeRole API), and role assigned to an Amazon EC2 instance.</p>
<p>For a complete overview of principals, please refer to the <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">documentation</a>.</p>
<p>Now, let’s deepen the UserId and Arn fields for each of the previously cited principals.</p>
<h3 id="heading-iam-user">IAM User</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"UserId"</span>: <span class="hljs-string">"AIDACKCEVSQ6C2EXAMPLE"</span>,
    <span class="hljs-attr">"Account"</span>: <span class="hljs-string">"123456789012"</span>,
    <span class="hljs-attr">"Arn"</span>: <span class="hljs-string">"arn:aws:iam::123456789012:user/JohnDoe"</span>
}
</code></pre>
<p>The UserId corresponds to the <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids">unique ID</a> of the IAM User.</p>
<p>The Arn field adheres to the following template: <em>arn:aws:iam::&lt;account-id&gt;:user/&lt;user-name-with-path&gt;</em>.</p>
<h3 id="heading-saml-federated-user">SAML federated user</h3>
<pre><code class="lang-json">{
    <span class="hljs-attr">"UserId"</span>: <span class="hljs-string">"AROACKCEVSQ6C2EXAMPLE:johndoe@example.com"</span>,
    <span class="hljs-attr">"Account"</span>: <span class="hljs-string">"123456789012"</span>,
    <span class="hljs-attr">"Arn"</span>: <span class="hljs-string">"arn:aws:sts::123456789012:assumed-role/john.doe/johndoe@example.com"</span>
}
</code></pre>
<p>The UserId consists of the unique ID of the role (AROACKCEVSQ6C2EXAMPLE) and the caller specified role name (johndoe@example.com).</p>
<p>The caller specified role name corresponds to the RoleSessionName attribute that is part of the SAML assertion.</p>
<p>The SAML assertion is an authentication response forwarded by the external IdP to the https://region-code.signin.aws.amazon.com/saml endpoint. The SAML assertion contains a set of claims; the RoleSessionName is one of them.</p>
<p>Typically, the value of the RoleSessionName attribute is a user ID or an email address. As explained in <a target="_blank" href="https://blog.leapp.cloud/how-to-saml-federate-your-aws-account-with-g-suite">this</a> blog post by my fellow colleague <a target="_blank" href="https://twitter.com/NicoloMarchesi">Nicolò Marchesi</a>, when it comes to federating a G Suite IdP to an AWS account, the RoleSessionName SAML attribute is mapped to the G Suite user’s Primary Email.</p>
<p>The Arn field adheres to the following template: <em>arn:aws:iam::&lt;account-id&gt;:assumed-role/&lt;role-name&gt;/&lt;role-session-name&gt;</em>. The Principal Type is not a <em>user</em> - as for the IAM User - but an <em>assumed-role</em>. Indeed, the SAML-based federation allows a user - managed by the external IdP - to assume an AWS Role via the STS assumeRoleWithSAML API.</p>
<h3 id="heading-assumed-role">Assumed role</h3>
<p>This principal corresponds to an IAM Role assumed via the AssumeRole API. Using this API, an IAM Role can be assumed by either an IAM User, an AWS IAM Identity Center user, or another IAM Role (the last configuration is called role chaining).</p>
<p>All these configurations provide the same GetCallerIdentity API response structure.</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"UserId"</span>: <span class="hljs-string">"AROACKCEVSQ6C2EXAMPLE:FakeRoleSessionName"</span>,
    <span class="hljs-attr">"Account"</span>: <span class="hljs-string">"123456789012"</span>,
    <span class="hljs-attr">"Arn"</span>: <span class="hljs-string">"arn:aws:sts::123456789012:assumed-role/FakeRoleName/FakeRoleSessionName"</span>
}
</code></pre>
<p>As for the SAML federated user scenario, the Arn field adheres to the following template: <em>arn:aws:iam::&lt;account-id&gt;:assumed-role/&lt;role-name&gt;/&lt;role-session-name&gt;</em>.</p>
<p>The UserId field is composed of the unique id of the role and the caller specified role name that is specified by the RoleSessionName parameter passed to the AssumeRole request.</p>
<h3 id="heading-role-assigned-to-an-amazon-ec2-instance">Role assigned to an Amazon EC2 instance</h3>
<p>When you launch an Amazon EC2 instance, you specify an IAM role to associate with the instance. Applications that run on the instance can then use the role-supplied temporary credentials to sign API requests. To be precise, the IAM Role is encapsulated in an Instance Profile which can provide the role’s temporary credentials to an application that runs on the instance.</p>
<p>When you call the AWS STS GetCallerIdentity API, the request is signed using the temporary credentials supplied via the Instance Profile. The following is an example response.</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Account"</span>: <span class="hljs-string">"123456789012"</span>,
    <span class="hljs-attr">"UserId"</span>: <span class="hljs-string">"AROACKCEVSQ6C2EXAMPLE:i-1234567890abcdef0"</span>,
    <span class="hljs-attr">"Arn"</span>: <span class="hljs-string">"arn:aws:sts::123456789012:assumed-role/iam-role-name/i-1234567890abcdef0"</span>
}
</code></pre>
<p>The UserId field is composed of the unique id of the role (AROACKCEVSQ6C2EXAMPLE) and the unique identifier of the EC2 instance (i-1234567890abcdef0).</p>
<p>The Arn field adheres to the following template: <em>arn:aws:iam::&lt;account-id&gt;:assumed-role/&lt;role-name&gt;/&lt;role-session-name&gt;</em>. The <em>&lt;role-name&gt;</em> corresponds to iam-role-name while the <em>&lt;role-session-name&gt;</em> corresponds to the unique identifier of the EC2 instance.</p>
<h2 id="heading-thats-all-folks">That’s all Folks!</h2>
<p>In this blog post, I’ve provided you with a description of the API that you can consume to answer the question “Who am I in the context of AWS?”. The answer to that question can vary, depending on the Principal associated with the IAM Credentials used to sign the GetCallerIdentity API.</p>
<p>Reach out to <a target="_blank" href="https://twitter.com/herr_villa">me</a>, if you want to enrich the list of most common scenarios where you can find yourself in.</p>
<p>Stay tuned for new publications!</p>
]]></content:encoded></item><item><title><![CDATA[AWS IAM Fundamentals: All You Need to Know Before Starting Out]]></title><description><![CDATA[Identity and Access Management (IAM) may be the most critical AWS service. It is used to control access to all AWS services. It enables organizations to create and manage AWS users and groups and assign them permissions.
In this article, we will expl...]]></description><link>https://blog.leapp.cloud/aws-iam-fundamentals</link><guid isPermaLink="true">https://blog.leapp.cloud/aws-iam-fundamentals</guid><category><![CDATA[AWS]]></category><category><![CDATA[Cloud Computing]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[IAM]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Tobias Schmidt]]></dc:creator><pubDate>Tue, 02 May 2023 12:59:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1681662881479/f0f3fa47-f216-4bb2-b8b7-b51e493417d5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Identity and Access Management (IAM) may be the most critical AWS service. It is used to control access to all AWS services. It enables organizations to create and manage AWS users and groups and assign them permissions.</p>
<p>In this article, we will explore the fundamentals of AWS IAM, including its key concepts, best practices, and how to work with IAM to manage an organization.</p>
<p>Whether you are new to AWS or an experienced developer, this article will provide you with the knowledge you need to get started with AWS IAM.</p>
<h2 id="heading-introduction-to-iam">Introduction to IAM</h2>
<p>IAM is one of the services that is straightforward to start, but hard to master, as the power lies in the wide range of features.</p>
<h3 id="heading-what-is-aws-iam">What is AWS IAM?</h3>
<p>With AWS Identity and Access Management (IAM), you can securely manage access to AWS services and resources. You won't have to juggle multiple credentials anymore - instead, you can use roles and policies to grant precise permissions. These permissions can be assigned not only to users but also to resources, for ultimate control.</p>
<h3 id="heading-why-is-iam-important">Why is IAM Important?</h3>
<p>AWS IAM plays a crucial role in ensuring the security of AWS, as it guarantees that only authorized individuals can access your resources. Acquiring a thorough understanding of it from the outset is essential to avoid creating environments with significant security vulnerabilities that are difficult to rectify later on.</p>
<h3 id="heading-how-does-iam-internally-work">How does IAM internally work?</h3>
<p>By default, all requests to all resources are denied. This means access has to be explicitly granted for everything.</p>
<p>When a request hits the AWS APIs, it goes through an internal authentication and authorization control that evaluates the requester's permissions for accessing an AWS resource by examining their attached permissions. These permissions are attached in the form of JSON documents.</p>
<p>In the following paragraphs, we will delve into the precise definition of those permissions and how they become associated with various identities.</p>
<h2 id="heading-critical-concepts-for-aws-iam">Critical Concepts for AWS IAM</h2>
<p>We must grasp the fundamental principles of IAM. This encompasses comprehending users, groups, roles, policies, and permissions. Furthermore, we should familiarize ourselves with Access Keys and Multi-Factor Authentication.</p>
<p>Additionally, we'll delve into how these concepts serve as the adhesive that connects all of your AWS services.</p>
<h3 id="heading-users-groups-and-roles">Users, Groups, and Roles</h3>
<p>AWS IAM comes with the concept of users. They can be allocated to groups for the sake of simplifying user rights management. Each identity can be linked to one or multiple policies that indicate the permissions granted to that particular identity for specific resources.</p>
<p>On the contrary, roles are not linked to identities or users, but they can take on them and come with accompanying policies. Additionally, AWS services can also assume roles to ensure secure permission passing.</p>
<p>Roles are a powerful concept, as they allow you to grant temporary access to AWS resources without having to share long-term security credentials, such as access keys or passwords. This reduces the risk of unauthorized access and helps to improve security. Additionally, they help you to manage access to AWS resources based on job functions, rather than individual users. You'll grant permissions to a role and then allows users or services to assume the role to fulfill their duties.</p>
<h3 id="heading-policies-and-permissions">Policies and Permissions</h3>
<p>IAM policies include statements that specify which actions are permitted or prohibited, which resources the actions apply to, and under what conditions the actions are allowed or denied. IAM assesses each policy statement to decide whether to allow or deny the requested action.</p>
<h3 id="heading-access-keys-and-mfa">Access Keys and MFA</h3>
<p>AWS offers various ways to utilize its services, such as interactive access through the AWS management console and web browser, or programmatic access via the AWS API. The two main forms of credentials are console passwords and access keys.</p>
<ul>
<li><p><strong>Console passwords</strong> - they allow the user to sign into an interactive session at the AWS management console. Users will be prompted for the unique 12-digit account identifier, their IAM user name, and their password. The account ID is required as IAM user names don’t have to be unique over all AWS accounts like S3 bucket names, but only per account.</p>
</li>
<li><p><strong>Access keys</strong> - These tools are designed to provide programmatic access to AWS through its API. You can directly submit calls to the AWS API to create, update, delete, or list resources if you have access keys. Access keys are made up of two parts: an Access Key ID and a Secret Access Key. To make using the AWS API more convenient, there are several tools available, such as <a target="_blank" href="https://aws.amazon.com/powershell/">PowerShell</a> for Windows or <a target="_blank" href="https://github.com/awslabs/aws-shell">aws-shell</a> for Linux and macOS.</p>
</li>
</ul>
<p>In the end, every component operates through an API. Whether you're utilizing the AWS console interface, the AWS CLI, or the AWS SDK for any programming language, your actions will be translated into API calls.</p>
<p>For adding another layer of security to the authentication process, you can enable Multi-Factor Authentication, short MFA. MFA allows you to merge:</p>
<ul>
<li><p>"Something you know" refers to information that you possess, such as your username and password.</p>
</li>
<li><p>"Something you own" is a device, either virtual or physical, that generates a single-use password.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675922177086/960449b6-a2bd-4f36-a8ec-baae791fd444.png?auto=compress,format&amp;format=webp" alt="The multi-factor authentication flow via the credentials and the TOTP." /></p>
<p>When you have MFA enabled for your user, the way you access the API using your Access Key ID and Secret Access Key will also change. You must now obtain temporary credentials using your keys and the one-time security token generated by your MFA application. This can be a bit cumbersome if you try to do it manually, but tools like <a target="_blank" href="https://www.leapp.cloud/">Leapp</a> drastically simplify the process for you.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680856046376/3c49ce44-08d9-4e53-b722-40a1df1960fd.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-iam-is-the-glue-between-all-aws-services">IAM Is the Glue between All AWS Services</h3>
<p>No matter what you're constructing on AWS, it's crucial to thoroughly understand and utilize IAM as a key component. While IAM is frequently employed with a haphazard "just make it work" method, it's one of AWS's most comprehensive and well-established services, ensuring the safety of your infrastructure and data.</p>
<p>As a metaphor, it's like the glue that binds everything together. Conversely, it could also be the missing piece that causes everything to crumble.</p>
<h2 id="heading-identity-vs-resource-based-access">Identity vs Resource-Based Access</h2>
<p>As you navigate AWS IAM, you'll encounter two policy types. These can be categorized as either identity-based or resource-based. In the following paragraphs, we'll explore the distinctions between the two and provide examples to aid in comprehension.</p>
<h3 id="heading-identifying-resources-uniquely-amazon-resource-identifiers">Identifying Resources Uniquely: Amazon Resource Identifiers</h3>
<p>To comprehensively examine the policies, it is essential to first grasp how AWS distinguishes resources within its vast ecosystem that caters to over a million clients.</p>
<p>This is established via Amazon Resource Identifiers, short ARN.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1679127660073/f4897b51-bcf0-4bab-8b84-111f36c6ba5f.png?auto=compress,format&amp;format=webp" alt="The segments of an Amazon Resource Name (ARN), including partition, service, region, account-id and resource-id." class="image--center mx-auto" /></p>
<p>ARNs have multiple uses beyond IAM, such as in AWS CloudFormation templates and AWS service APIs. They provide a secure and consistent method for specifying and granting access to resources.</p>
<p>Let’s have a look at the two examples above:</p>
<ul>
<li><p>An Amazon S3 bucket: <code>arn:aws:s3:::my-bucket</code></p>
</li>
<li><p>An Amazon DynamoDB table: <code>arn:aws:dynamodb:eu-west-1:123456789012:table/mytable</code></p>
</li>
</ul>
<p>The ARN prefix, <code>arn:aws</code>, signifies that it belongs to the worldwide AWS system (note that AWS China, or AWS CN, is a distinct entity identified by the prefix <code>arn:aws-cn</code>). It is followed by the service abbreviation. In our case, <code>s3</code> for Amazon S3 and <code>dynamodb</code> for Amazon DynamoDB.</p>
<p>The region is specified by the next part (e.g. <code>eu-west-1</code>), and the account ID is specified by the fourth part (e.g. <code>123456789012</code>). You may notice that certain services, such as S3, are not restricted to a specific region, despite their resources being located in one region. In such instances, the region identifier is left unspecified.</p>
<p>The ARN includes the resource name or identifier to specifically identify the resource. For instance, in the ARN for an Amazon DynamoDB table, the table name (<code>mytable</code>) comes after the <code>table/</code> prefix. This enables you to distinguish the table and grant access to it through IAM policies.</p>
<h3 id="heading-identity-based-access">Identity-Based Access</h3>
<p>On the one hand, AWS offers identity-based policies that authorize users, groups, or roles to access resources. They come in different types:</p>
<ul>
<li><p><strong>Managed Policies</strong>: policies that can exist on their own (standalone) and can be attached to multiple identities within your AWS account. Managed policies in turn also divide into two further categories:</p>
<ul>
<li><p><strong>AWS-managed policies</strong>: policies that are created and managed by AWS.</p>
</li>
<li><p><strong>Customer-managed policies</strong>: policies that you create based on your requirements.</p>
</li>
</ul>
</li>
<li><p><strong>Inline Policies</strong>: policies with a strict one-to-one relationship to an identity.</p>
</li>
</ul>
<p>Let's take a look at a policy example that permits starting and stopping EC2 instances in every region.</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Action"</span>: [
        <span class="hljs-string">"ec2:StartInstances"</span>,
        <span class="hljs-string">"ec2:StopInstances"</span>],
      <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"arn:aws:ec2:*:123456789012:instance/*"</span>,
      <span class="hljs-attr">"Condition"</span>: {
        <span class="hljs-attr">"StringEquals"</span>: {
          <span class="hljs-attr">"aws:PrincipalTag/groups"</span>: <span class="hljs-string">"developers"</span>
        }
      }
    }
  ]
}
</code></pre>
<p>We have the option to link this policy to a user, group, or role to allocate those specific permissions.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1679218426243/ead2b0b0-c121-4ad4-8274-b2f3183ef602.png?auto=compress,format&amp;format=webp" alt="IAM Roles can have an inline policy and one or multiple attached policies." class="image--center mx-auto" /></p>
<p>By attaching the policy to a role, we have the flexibility to temporarily grant permissions to users, groups, or even AWS services.</p>
<h3 id="heading-resource-based-access">Resource-Based Access</h3>
<p>On the other hand, resource-based policies are based on resources and are not linked to identities, but rather to specific AWS resources, such as an S3 bucket.</p>
<p>These policies provide designated principals with permissions for that particular resource. Resource-based policies are essentially inline policies since they cannot exist without their corresponding resource.</p>
<p>Let's go through two examples of resource-based policies:</p>
<ol>
<li><strong>Amazon S3</strong> - a bucket policy that allows you to grant permissions to resources in the bucket, such as objects and folders.</li>
</ol>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>:<span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"PublicReadGetObject"</span>,
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: <span class="hljs-string">"*"</span>,
      <span class="hljs-attr">"Action"</span>: [<span class="hljs-string">"s3:GetObject"</span>],
      <span class="hljs-attr">"Resource"</span>: [<span class="hljs-string">"arn:aws:s3:::my-bucket/*"</span>]
    }
  ]
}
</code></pre>
<ol>
<li><strong>AWS Key Management Service (KMS)</strong> - Granting read permissions for KMS keys for a specific user while maintaining full-administrative permissions for the root user.</li>
</ol>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"Admin Permissions for Root"</span>,
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: {
        <span class="hljs-attr">"AWS"</span>: <span class="hljs-string">"arn:aws:iam::123456789012:root"</span>
      },
      <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"kms:*"</span>,
      <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>
    },
    {
      <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"Read Access for KMS Keys"</span>,
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: {
        <span class="hljs-attr">"AWS"</span>: <span class="hljs-string">"arn:aws:iam::123456789012:user/example-user"</span>
      },
      <span class="hljs-attr">"Action"</span>: [
        <span class="hljs-string">"kms:Describe*"</span>,
        <span class="hljs-string">"kms:List*"</span>,
        <span class="hljs-string">"kms:Get*"</span>,
      ],
      <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>
    }
  ]
}
</code></pre>
<p>Resource-based policies are not supported by most AWS services, but there are a few exceptions. Besides S3 buckets and KMS keys, there are also SNS topics or secrets in AWS Secrets Manager. AWS offers a <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html">comprehensive catalog of all its services along with the corresponding IAM functionalities</a> they support, all well-maintained.</p>
<h2 id="heading-working-with-iam-to-manage-an-organization">Working with IAM to Manage an Organization</h2>
<p>An AWS account comes with natural boundaries for security, access, and billing. Outside users do not have any access, and created infrastructure is solely allocated to your account and its users.</p>
<p>You might already understand why it's good practice to leverage those account boundaries by using multiple AWS accounts. This is not only helpful to strictly separate environments, but it can also be used to map down organizational structures to your AWS ecosystem.</p>
<p>AWS IAM and AWS Organizations make this possible.</p>
<h3 id="heading-aws-organizations-key-concepts">AWS Organizations Key Concepts</h3>
<p>AWS Organizations allows you to effortlessly apply your IAM permissions across multiple accounts. To achieve this, you must first comprehend the various features that come with AWS Organizations.</p>
<ul>
<li><p><strong>The Management Account</strong> - This is the original account that was utilized to establish the organization. It possesses complete access to every AWS resource and service.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676727903809/fd03f587-458d-41ba-bdc5-3b2bce6f602e.png?auto=compress,format&amp;format=webp" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>An Organization</strong> - Think of this as a receptacle for numerous AWS accounts. It enables you to oversee them all in a single, centralized location utilizing the capabilities of AWS Organizations.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676704591342/50dd4445-d270-4131-98ef-0d26522b80c8.png?auto=compress,format&amp;format=webp" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Organizational Units</strong> - Organizational units serve as an effective means for precise management. Each unit functions as a logical container, capable of accommodating accounts and additional organizational units.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676705325499/3ce18071-1ac5-49f5-8b59-e40f1a7b7ccb.png?auto=compress,format&amp;format=webp" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>These features assist in the mapping of applications, projects, and the hierarchical structure of your organization within your AWS ecosystem.</p>
<p>Furthermore, you can limit access rights from a central location for your entire company, specific organizational units, or single accounts through the implementation of service control policies, which we will explore in the following paragraph.</p>
<h3 id="heading-applying-service-control-policies">Applying Service Control Policies</h3>
<p>Service Control Policies (SCPs) allow you to restrict access to AWS resources and services. As mentioned before, they can be applied to an organization, organizational unit, or individual account.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676705479897/741b5c16-d256-4c2f-8b8e-fec8e65cd669.png?auto=compress,format&amp;format=webp" alt class="image--center mx-auto" /></p>
<p>They assist you in implementing precise permissions throughout your various accounts, enabling adherence to compliance regulations and the enforcement of rigorous security measures.</p>
<p>Using SCPs, you could enforce MFA usage across your entire organization, including all member accounts.</p>
<p>Our <a target="_blank" href="https://blog.awsfundamentals.com/aws-organizations-the-key-to-managing-your-cloud-infrastructure-effectively">deep-dive article</a> provides a hands-on approach to learning more about AWS Organizations.</p>
<h2 id="heading-iam-best-practices">IAM Best Practices</h2>
<p>IAM provides a powerful set of tools for managing access to AWS resources, but it can be complex to configure and manage. By following best practices, you can ensure that your AWS environment is secure and well-managed.</p>
<h3 id="heading-least-privilege-and-separation-of-duties">Least Privilege and Separation of Duties</h3>
<p>If you give users or roles too many permissions, it could result in them accessing AWS resources they shouldn't have access to. It's crucial to adhere to the principle of least privilege and only grant permissions that are necessary for users to do their job.</p>
<p>This highlights the need for creating customized roles that grant permissions for specific or limited tasks. It's important to avoid broad permissions or roles that are applied to multiple tasks and grant excessive access.</p>
<h3 id="heading-multi-factor-authentication">Multi-Factor Authentication</h3>
<p><a target="_blank" href="https://blog.awsfundamentals.com/aws-mfa-keeping-your-account-secure-via-multi-factor-authentication">Enabling MFA</a> for your root user or any other IAM user is a straightforward process. You can also mandate the use of MFA across your entire account or AWS organization by implementing policies.</p>
<h3 id="heading-making-use-of-aws-identity-center-or-federation">Making Use of AWS Identity Center or Federation</h3>
<p>In simpler terms, setting up users directly on AWS IAM is an outdated feature. AWS advises utilizing a specialized identity provider and solely utilizing roles to assign access to those identities.</p>
<p>As the name expects, an identity provider (IdP) is a service that solely focuses on managing identities. Those identities can be used across your AWS Organization by using federation.</p>
<p>The AWS Identity Center can act as an IdP, which means that there is no need for a third-party service to manage users and groups throughout the organization or to facilitate Single-Sign-On (SSO). Nonetheless, in larger-scale environments, it is recommended to choose a service that specializes in identity management.</p>
<h3 id="heading-avoiding-common-iam-mistakes">Avoiding Common IAM Mistakes</h3>
<p>In addition to the detailed recommendations listed above, numerous other common IAM mistakes are often found in both small and large projects. Among them are:</p>
<ol>
<li><p><strong>Not making use of IAM roles</strong> - When utilizing AWS services for your workloads, it is crucial to utilize roles with customized permissions. AWS will handle the issuance of temporary credentials to prevent any concerns about database password leaks.</p>
</li>
<li><p><strong>Not rotating access keys regularly</strong> - if you require long-term access keys, they have to be rotated regularly to reduce the risk of accidental leakage.</p>
</li>
<li><p><strong>Using your root for daily tasks</strong> - You should only use your AWS root user to establish your account and organization. Once that's done, it's best to lock it away because its permissions are too broad.</p>
</li>
<li><p><strong>Not making use of SCPs</strong> - if you're working with multiple accounts within an organization, it's important to establish guardrails across your organization via service control policies.</p>
</li>
<li><p><strong>Not making use of Permission Boundaries</strong> - another advanced feature of IAM are <a target="_blank" href="https://blog.leapp.cloud/how-to-master-and-secure-access-and-permissions-in-an-aws-landing-zone">permission boundary policies</a> that can be applied to roles. Those boundaries do not grant permissions on their own, but restrict the maximum permissions that can be delegated via a role.</p>
</li>
</ol>
<p>This list is not comprehensive, but it provides a good starting point for best practices.</p>
<h2 id="heading-extending-your-aws-fundamentals-beyond-iam">Extending your AWS Fundamentals beyond IAM</h2>
<p>It is important to learn the fundamentals of AWS IAM first because it is a critical component of the AWS ecosystem that serves as a central control point for managing access to AWS resources. However, to successfully become a DevOps engineer, you need to continue to learn about other core services like Lambda, DynamoDB, or ECS as they are the backbone of many successful organizations and projects.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1681663852284/7f618448-12cc-4781-bc80-c92915ece378.png" alt class="image--center mx-auto" /></p>
<p>The book <a target="_blank" href="https://awsfundamentals.com/">AWS Fundamentals</a> is a great resource for learning the must-knows about the 16 most used and famous AWS services. It also includes an introduction to modern Infrastructure as Code, which is an important concept for DevOps engineers to understand.</p>
<p><img src="https://awsfundamentals.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fecs.19ddffb6.webp&amp;w=3840&amp;q=75" alt /></p>
<p>In addition, the book includes infographics that visualize critical facts in a bite-sized manner, making it easier to understand and remember key concepts. By learning about IAM and other core AWS services, you can develop the skills and knowledge necessary to become a successful DevOps engineer in the AWS cloud.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>AWS IAM is a critical service that is used to manage access to AWS resources. It is essential to understand the key concepts of IAM, including users, groups, roles, policies, and permissions.</p>
<p>By following best practices, such as adhering to the principle of least privilege and enabling multi-factor authentication, businesses can ensure the security of their AWS environment. Additionally, AWS Organizations and Service Control Policies can be used to manage an organization's AWS ecosystem effectively.</p>
<p>Overall, understanding and utilizing AWS IAM is crucial for maintaining a secure and well-managed AWS environment.</p>
]]></content:encoded></item><item><title><![CDATA[Managing AWS IAM cross-account access at scale]]></title><description><![CDATA[Introduction
Has your organization scaled to operate infrastructure across multiple AWS accounts? Are you having problems accessing resources, or resources accessing on another, across multiple accounts? If so, you’ve found the right article to help ...]]></description><link>https://blog.leapp.cloud/managing-aws-iam-cross-account-access-at-scale</link><guid isPermaLink="true">https://blog.leapp.cloud/managing-aws-iam-cross-account-access-at-scale</guid><category><![CDATA[AWS]]></category><category><![CDATA[IAM]]></category><category><![CDATA[codebuild]]></category><category><![CDATA[cloudformation]]></category><category><![CDATA[leapp]]></category><dc:creator><![CDATA[Damien Burks]]></dc:creator><pubDate>Tue, 25 Apr 2023 14:16:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1684242916978/b157db2f-7b74-41f6-b811-61d7266c5013.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Has your organization scaled to operate infrastructure across multiple AWS accounts? Are you having problems accessing resources, or resources accessing on another, across multiple accounts? If so, you’ve found the right article to help you solve these issues.</p>
<p>In this blog post, we’ll discuss managing cross-account IAM roles at scale. IAM is a powerful, centralized service that allows organizations and users to manage their resources and define permissions across AWS. IAM allows you to manage permissions at various levels and scale access across multiple accounts and organizations. Whether it's an SCP, a user, a group, or a role, this service gives the user or organization plenty of control over access rights to various other services and resources within AWS.</p>
<h2 id="heading-defining-cross-account-access">Defining cross-account access</h2>
<p>When multiple accounts exist within an organization, it can be quite challenging to define cross-account roles and policies. Depending on the use case, the complexity of the permissions and trust policies that are associated with each role may vary. Let’s define a simple use case and describe the access requirements each service that is utilized will need.</p>
<h3 id="heading-bontriages-cross-account-dilemma">BonTriage's cross-account dilemma</h3>
<p>This made-up organization, called BonTriage, would like to deploy a list of cloud formation templates from their staging account, ER-123456, into their production account, TR-789012. These templates are responsible for creating several resources, such as S3 buckets and EC2 instances, and configuring autoscaling groups and other networking components. The engineers, unsure of how to do this, start to research and develop a strategy for getting these resources deployed into those respective accounts. During the research and design phase, they created an example architecture diagram.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1681484654467/97e7781d-cd68-4a8d-b652-4aaf40f9ad90.png" alt="Soimething" class="image--center mx-auto" /></p>
<p>The architecture diagram contains 2 IAM roles and one CloudBuild node. The CodeBuild node, CFTDeployerNode which is in the ER-123456 account, is responsible for deploying a CloudFormation stack into the TR-789012 account. To accomplish this, the CFTDeployerNode resource assumes the IAM role called “CodeBuildRole”. This role has the right to assume another IAM role called “ResourceDeployCAR” which contains the permissions to deploy the CloudFormation stack within the account. Sounds quite simple, right? Let’s dive a little deeper to see how this is happening.</p>
<p>The key component that you must understand about both roles is their respective trust policies. According to AWS, the trust policy of a role defines which principals can assume the role and under what conditions. Based on that definition, the “ResourceDeployCAR” roles must be modified. An example trust policy is highlighted below:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"AllowCodeBuildNodeToAssume"</span>,
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Principal"</span>: {
        <span class="hljs-attr">"AWS"</span>: <span class="hljs-string">"arn:aws:iam::332*********:role/CodeBuildRole"</span>
      },
      <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>
    }
  ]
}
</code></pre>
<p>This trust policy allows the “CodeBuildRole” role to assume the “ResourceDeployCAR” role to deploy the stack set inside of the TR-789012 account. Without the principal of the role added to the trust policy, the role used for the CodeBuild resource would have not been able to assume the “ResourceDeployCAR” role in the other account.</p>
<p>For any cross-account roles or users that you create, you’ll want to ensure that your trust policy permits your other roles to assume them and their permissions sets. Policies of these roles and users are still incredibly relevant, as they ensure access to resources within the role-assumed account. In this case of the CFTDeployerNode, an example policy that would be attached to the “ResourceDeployCAR” role is highlighted below:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"AllowAllCloudformationActivitites"</span>,
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
      <span class="hljs-attr">"Action"</span>: [
        <span class="hljs-string">"cloudformation:Describe*"</span>,
        <span class="hljs-string">"cloudformation:List*"</span>,
        <span class="hljs-string">"cloudformation:Get*"</span>
      ],
      <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>
    }
  ]
}
</code></pre>
<p>With the policy document outlined, the CodeBuild role should be able to create all of the resources via CloudFormation in the other account.</p>
<h2 id="heading-managing-cross-account-roles">Managing cross-account roles</h2>
<p>By giving an example in the previous section, we were able to define a cross-account role that grants access to a CodeBuild resource from an account to deploy CloudFormation resources in a different account. The same pattern for IAM roles and users can be adopted and applied to several accounts across organizations in AWS. However, as the amount of cross-account roles increases, the amount of overhead for managing these roles increases as well.</p>
<p>To effectively manage cross-account roles, I would suggest leveraging Leapp. Owned by Noovolari, Leapp is an open-source cloud application that manages cloud credentials. As a multi-cloud credential management application, it has several key features that enable organizations and teams to easily manage IAM resources without accessing the console or entering CLI commands. Some of the key features of IAM resource management include role and user session management and credential generation and rotation.</p>
<p>Since we’ve given a slight overview of what Leapp is, let’s answer the question you’re probably asking: How does Leapp solve managing cross-account roles at scale? By using Leapp, one can create several profiles and link users and roles to those profiles! When you are interacting with AWS services using CLI commands and boto API calls, your machine must have a credentials file configured with all of the profiles you’d like to use. An example of what the credentials file would typically look like is highlighted below:</p>
<pre><code class="lang-plaintext">[default]
sso_session = my-sso
sso_account_id = 111*********
sso_role_name = readOnly
region = us-west-2
output = text

[profile user1]
sso_session = my-sso
sso_account_id = 444*********
sso_role_name = readOnly
region = us-east-1
output = json

[sso-session my-sso]
sso_region = us-east-1
sso_start_url = https://my-sso-portal.awsapps.com/start
sso_registration_scopes = sso:account:access
</code></pre>
<p>When you leverage Leapp to manage your profiles, you can quickly discern which role you’ve created a session for regardless of the IAM resource type. You can associate any kind of IAM resource with a profile and include MFA information and data in Leapp.</p>
<p><img src="https://lh6.googleusercontent.com/gjtnu-K_mr8uyfgRUAdFFYnDBzxf301JQrPQWDKFHrfs0l0tePAOX74btsA2B-t224n7PU6QDJyZLZZdfXVrqdAtgrrOWVgE0QkUWFpIqm3tF3jKIvKOcshpfpKpD_cFqdwj9q98yu-cRk5fnMy6HjU" alt /></p>
<p>The image above is an example of an IAM Role and IAM User that have been created under two different profiles. The IAM User, ‘Damien’, exists under the named profile called ‘DJB Financial Corp’, whereas the DataCop role is associated with the named profile ‘DataCop’. As new roles are created, new profiles and their roles can be created/added to Leaap. If you have several roles that are associated with a profile, you can filter which role you’d like to use Leapp using the name of the profile. This feature alone makes it incredibly useful when organizations have not only created simple users, roles, and federated roles, but it can aid in managing complex cross-account roles.</p>
<p>If you wish to be more comfortable with working with a shell, Leapp has a CLI tool that would help you manage the profiles and IAM resources as well. If you’d like to learn more information on how to manage profiles with the CLI tool, you can read that information here: <a target="_blank" href="https://docs.leapp.cloud/latest/cli/scopes/profile/">Leapp CLI - Profiles</a></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Defining cross-account permissions and access can be incredibly difficult as your organization scales. Most of the time, an organization will have multiple accounts that need to share data and other components between them. When defining cross-account permissions for roles and users, you’ll want to ensure you are familiar with trust policies. These trust policies will ensure that your role or user grants the other IAM resource the right to assume it.</p>
<p>As the number of IAM cross-account resources grows, you’ll want to leverage a management platform like Leapp. This application has many features to help organizations manage their IAM resources by creating profiles. You can group a plethora of IAM resources into these profiles, and they do not have to be associated with a single account.</p>
<p>By following these strategies I’ve highlighted, you or your organization can effectively define and manage cross-account access and minimize overhead and other transitive issues.</p>
]]></content:encoded></item><item><title><![CDATA[How to fix response did not contain a valid saml assertion]]></title><description><![CDATA[If you read this article, you are managing user identities outside of AWS and using Identity Provider (IdP) Federation to give these external identities permission to use AWS resources in your account.
In this authentication process, one of the most ...]]></description><link>https://blog.leapp.cloud/how-to-fix-response-did-not-contain-a-valid-saml-assertion</link><guid isPermaLink="true">https://blog.leapp.cloud/how-to-fix-response-did-not-contain-a-valid-saml-assertion</guid><category><![CDATA[SAML]]></category><category><![CDATA[IAM]]></category><category><![CDATA[#howtos]]></category><category><![CDATA[error handling]]></category><dc:creator><![CDATA[Alessandro Gaggia]]></dc:creator><pubDate>Fri, 21 Apr 2023 12:19:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682078941181/7b984fa5-899c-4815-be51-da23fb8d78e6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you read this article, you are managing user identities outside of AWS and using Identity Provider (IdP) Federation to give these external identities permission to use AWS resources in your account.</p>
<p>In this authentication process, one of the <strong>most common errors</strong> you may need to confront is "response did not contain a valid saml assertion," and in this article, I want to share with you some troubleshooting advice to solve it.</p>
<h2 id="heading-investigating-a-no-valid-assertion-found-in-saml-response"><strong>Investigating a No valid assertion found in SAML response</strong></h2>
<h3 id="heading-checking-the-attribute-name-and-attribute-value-on-your-idp">Checking the attribute name and attribute value on your IdP</h3>
<p>If you are on AWS (but in general), invalid SAML assertion mainly occurs when the SAML response from the IdP does not include an attribute with the <code>Name</code> set to <a target="_blank" href="https://aws.amazon.com/SAML/Attributes/Role"><code>https://aws.amazon.com/SAML/Attributes/Role</code></a> . The attribute must also contain one or more <code>AttributeValue</code> elements, <strong>each with these two strings</strong>, separated by a comma:</p>
<ul>
<li><p>The ARN of a role that the user can be mapped to</p>
</li>
<li><p>The ARN of the SAML provider</p>
</li>
</ul>
<p>E.g.:</p>
<pre><code class="lang-markdown"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Attribute</span> <span class="hljs-attr">Name</span>=<span class="hljs-string">"&lt;https://aws.amazon.com/SAML/Attributes/Role&gt;</span></span></span>"&gt;

<span class="xml"><span class="hljs-tag"><span class="hljs-string">&lt;AttributeValue&gt;</span></span></span>arn:aws:iam::account-number:role/role-name1,arn:aws:iam::account-number:saml-provider/provider-name<span class="xml"><span class="hljs-tag"><span class="hljs-string">&lt;/AttributeValue&gt;</span></span></span>

<span class="xml"><span class="hljs-tag"><span class="hljs-string">&lt;/Attribute&gt;</span></span></span>
</code></pre>
<p><a target="_blank" href="https://repost.aws/knowledge-center/iam-invalid-saml-response-okta">Here</a> is also an example of a resolution for Okta.</p>
<h3 id="heading-time-synchronisation-issues-between-idp-and-service-provider">Time Synchronisation issues between IdP and Service Provider</h3>
<p><a target="_blank" href="https://docs.pulsesecure.net/WebHelp/Content/PCS/PCS_AdminGuide_8.2/Investigating%20a%20No%20valid%20assertion.htm">https://docs.pulsesecure.net/WebHelp/Content/PCS/PCS_AdminGuide_8.2/Investigating a No valid assertion.htm</a></p>
<p><strong>If the SAML IdP and SAML service provider (AWS, for example) clocks are not synchronized, the assertion can be determined invalid</strong>, and authentication fails.</p>
<p>A possible solution is to verify that your IdP and Service provider <strong>can share the same NTP server</strong> or prove that your server's clock is up-to-date.</p>
<h3 id="heading-metadataxml-mismatch">Metadata.xml mismatch</h3>
<p><strong>Data refreshes, and upgrades can cause the certificates to be no longer trusted by one side of the Federation process or the other</strong>. Try to check and update the metadata.xml on both ends so the certificates will match again.</p>
<h3 id="heading-saml-message-not-properly-formatted-with-missing-or-invalid-elements"><strong>SAML message not properly formatted, with missing or invalid elements</strong></h3>
<p><a target="_blank" href="https://stackoverflow.com/questions/64158310/aws-sso-your-request-included-an-invalid-saml-response">https://stackoverflow.com/questions/64158310/aws-sso-your-request-included-an-invalid-saml-response</a></p>
<p>Sometimes the error occurs not only with the User attribute but in general if the message needs to include all the required information in the required format. For example:</p>
<ul>
<li><p>The message was signed, but <strong>the signature could not be verified</strong>.</p>
</li>
<li><p>Assertion contains an unacceptable <strong>Audience Restriction</strong>.</p>
</li>
<li><p>The assertion is no longer valid, or the message is expired, see <strong>Time Synchronisation issues between IdP and Service Provider</strong>.</p>
</li>
<li><p><strong>SAML response contained an error</strong> indicating that the Cloud Provider received a SAML message from an IdP with an error status code.</p>
</li>
</ul>
<p>Remember that SAML is schema-compliant, so you must adhere to its standard when creating its XML request. Make sure to refer to this <a target="_blank" href="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">document</a> to see all the standard tags.</p>
<p>Some more examples of possible typos can be:</p>
<ul>
<li>Not including encoding at the beginning of the XML:</li>
</ul>
<p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code></p>
<ul>
<li><p>Typo in the Recipient of the <strong>SubjectConfirmationData</strong>: set it to "<a target="_blank" href="https://signin.aws.amazon.com/saml">https://signin.aws.amazon.com/saml</a>."</p>
</li>
<li><p>Not including an <strong>AuthStatement</strong>.</p>
</li>
</ul>
<h3 id="heading-how-to-view-a-saml-response-for-troubleshooting"><strong>How to view a SAML response for troubleshooting</strong></h3>
<p><a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_saml.html">https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_saml.html</a></p>
<p>This article has several ideas to help you narrow down the exact cause of the issue. Still, I'd also like to give you some basic tips on debugging the SAML assertion you receive to find details that can point you to the root cause of your problem.</p>
<p><strong>Google Chrome and Firefox</strong></p>
<ol>
<li><p>Press <strong>F12</strong> to start the <strong>Developer Tools</strong> console.</p>
</li>
<li><p>Select the <strong>Network</strong> tab, and then select <strong>Preserve log</strong> (Persist Log in Firefox)</p>
</li>
<li><p>Look for a <strong>SAML Post</strong>, then view the <strong>Payload</strong> tab at the top. Look for the <strong>SAMLResponse</strong> element that contains the Base64-encoded response.</p>
</li>
<li><p>Copy it.</p>
</li>
</ol>
<p><mark>💡 Security Note: as SAML assertions contain sensitive information, I discourage you from using </mark> <em><mark>online base64 decoders</mark></em> <mark> and using one of these simple scripts to do it from your local terminal.</mark></p>
<p><strong>Windows systems (PowerShell):</strong></p>
<p><code>PS C:\\&gt;[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("base64encodedtext"))</code></p>
<p><strong>MacOS and Linux systems:</strong></p>
<p><code>$echo "base64encodedtext" | base64 --decode</code></p>
<p>Also, if the attributes from your Identity Provider are <strong>not encrypted</strong>, the <a target="_blank" href="https://addons.mozilla.org/en-US/firefox/addon/saml-tracer">Firefox browser SAML tracer Add-on</a> or <a target="_blank" href="https://chrome.google.com/webstore/detail/saml-message-decoder/mpabchoaimgbdbbjjieoaeiibojelbhm?hl=en">Chrome SAML Message Decoder</a> can view these attributes.</p>
<h3 id="heading-tutorials">Tutorials</h3>
<p>To help you further, here are two articles from our blog where we share some hints to configure SAML with GSuite (note that concepts and properties are similar to other IdPs).</p>
<ul>
<li><p><a target="_blank" href="https://blog.leapp.cloud/how-to-saml-federate-your-aws-account-with-g-suite">https://blog.leapp.cloud/how-to-saml-federate-your-aws-account-with-g-suite</a></p>
</li>
<li><p><a target="_blank" href="https://blog.leapp.cloud/how-to-update-in-bulk-g-suite-users-custom-attributes-with-google-admin-sdk">https://blog.leapp.cloud/how-to-update-in-bulk-g-suite-users-custom-attributes-with-google-admin-sdk</a></p>
</li>
</ul>
<h2 id="heading-conclusions">Conclusions</h2>
<p>In this article, we have seen how to troubleshoot a very pesky error of the SAML Federation: "Response did not contain a valid SAML assertion."</p>
<p>We have shown that it can occur when:</p>
<ul>
<li><p><strong>Role attributes are not set correctly</strong> in the SAML request - IdP side.</p>
</li>
<li><p>There is a <strong>time desynchronization</strong> between the IdP and the Service Provider.</p>
</li>
<li><p>There is a <strong>Metadata.xml mismatch</strong> between the actors, so the certificate doesn't match.</p>
</li>
<li><p>There are <strong>typos or an invalid SAML structure</strong> in your request.</p>
</li>
</ul>
<p>In general, I always return to <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_saml.html#troubleshoot_saml_invalid-response">this</a> link when I need to troubleshoot a SAML response, as the problem may lie on a different configuration depending on the IdP you're using.</p>
<p>This little article has been of help to all of you, and till next time, Happy SAML assertions, and see you in the next article! 😉</p>
]]></content:encoded></item><item><title><![CDATA[How to enable dark mode in AWS console]]></title><description><![CDATA[Have you ever been blinded by how bright the AWS console is? Do you want to switch from light mode to dark mode?

Worry not! If you’re a dark mode enthusiast like myself, because you use it on your IDE and all your apps, you enjoy its benefits on pro...]]></description><link>https://blog.leapp.cloud/how-to-enable-dark-mode-in-aws-console</link><guid isPermaLink="true">https://blog.leapp.cloud/how-to-enable-dark-mode-in-aws-console</guid><category><![CDATA[AWS]]></category><category><![CDATA[aws console]]></category><category><![CDATA[dark mode]]></category><dc:creator><![CDATA[Riccardo Rotta]]></dc:creator><pubDate>Thu, 06 Apr 2023 15:10:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1680791474925/a8524a8c-0645-446b-9d5c-25013ab5526b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Have you ever been blinded by how bright the AWS console is? Do you want to switch from light mode to dark mode?</p>
<p><img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExMDU1ZjM3ZGI1NjI4ZGMzOWRkZWFkNmM1OTVjY2RlZGI3MzI5ZjMzNCZjdD1n/LRCxXWRljt4LYf6AK1/giphy.gif" alt="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExMDU1ZjM3ZGI1NjI4ZGMzOWRkZWFkNmM1OTVjY2RlZGI3MzI5ZjMzNCZjdD1n/LRCxXWRljt4LYf6AK1/giphy.gif" class="image--center mx-auto" /></p>
<p>Worry not! If you’re a dark mode enthusiast like myself, because you use it on your IDE and all your apps, you enjoy its benefits on productivity and health, or simply you like the aesthetics of it, <strong>AWS recently released a new</strong> <strong>dark mode for the Management Console</strong>. It is still a beta, but it works with almost all services.</p>
<p>Let me explain how to enable it in this quick article!</p>
<h2 id="heading-how-to-enable-dark-mode-in-the-aws-management-console">How to enable dark mode in the AWS Management Console</h2>
<ol>
<li>First of all, access the AWS console, then <strong>click your account name</strong> in the <strong>top right corner</strong>. In the dropdown menu, click <strong>Settings</strong>.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680793712301/3846a228-9e67-4315-a8c9-000896121e3f.png" alt class="image--center mx-auto" /></p>
<ol>
<li>The <strong>Unified Settings</strong> page will show up, and from there you will be able to see the following options. In the <strong>Display</strong> option, click <strong>Edit.</strong></li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680793117447/c95c7326-236a-48d6-9e86-17ce3a759bda.png" alt class="image--center mx-auto" /></p>
<ol>
<li>Now, select <strong>Dark</strong> in the Visual mode section. You can also see how it will look in the preview window on the side. Finally, click on <strong>Save settings</strong> to join the dark side of AWS!</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680793127821/a107bd8a-2bda-424e-a66e-3d001a80da66.png" alt class="image--center mx-auto" /></p>
<p>And there you go, here’s how your Management Console home should look like. Easier on the eye, isn’t it? Remember that this is a beta feature; the most common services are already fully supporting it, but there are a couple with limited support or no dark mode yet.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680793244622/f502a4fa-d128-43bc-a9e0-b6194899e410.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-pro-tips">Pro Tips</h2>
<p>As a dark mode fan, this feature was one of the first we thought about while our open-source tool <a target="_blank" href="https://leapp.cloud"><strong>Leapp</strong></a> was in development. Besides allowing to access and manage multiple AWS accounts in a click, Leapp was also built to <strong>make the AWS console experience super-easy, quick, and smooth</strong> for DevOps.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680793252645/14600bb8-1ed5-41d0-9360-875e52d89452.png" alt class="image--center mx-auto" /></p>
<p>Feel free to give it a try! And drop a star to the GitHub repository if you like it!</p>
<div class="hn-embed-widget" id="star-leapp"></div><p> </p>
<p>See you in the cloud!</p>
]]></content:encoded></item><item><title><![CDATA[How to master and secure access and permissions in an AWS Landing Zone]]></title><description><![CDATA[Today we proudly announce a special collaboration: starting from the well-expressed concept of the Landing Zone on beSharp's blog Proud2beCloud, we deepened one of the key aspects for an AWS Landing Zone's correct implementation: the use of IAM Polic...]]></description><link>https://blog.leapp.cloud/how-to-master-and-secure-access-and-permissions-in-an-aws-landing-zone</link><guid isPermaLink="true">https://blog.leapp.cloud/how-to-master-and-secure-access-and-permissions-in-an-aws-landing-zone</guid><category><![CDATA[AWS]]></category><category><![CDATA[Governance]]></category><category><![CDATA[IAM]]></category><dc:creator><![CDATA[Nicolò Marchesi]]></dc:creator><pubDate>Fri, 31 Mar 2023 10:34:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1680257543761/6849e0a2-359d-4ffd-b66c-b2b7f3ab4b75.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today we proudly announce a special collaboration: starting from the well-expressed concept of the <a target="_blank" href="https://blog.besharp.it/thats-why-you-need-a-landing-zone-even-if-you-dont-know-it-yet/">Landing Zone</a> on <a target="_blank" href="https://blog.besharp.it/">beSharp's blog Proud2beCloud</a>, we deepened one of the key aspects for an AWS Landing Zone's correct implementation: the use of IAM Policy and Service Control Policies (SCPs).</p>
<p><em>Enjoy the read!</em></p>
<h3 id="heading-introduction">Introduction</h3>
<p>Hello cloud fellows! Today we’ll build up on the cloud landing zone series to explore a fascinating but often ignored context… Service Control Policies! SCPs are powerful, but there are a few caveats and tricks to make them work efficiently with every different kind of <strong>IAM policy</strong>. In this blog post, we will see how the whole IAM ecosystem interacts and how we can effectively leverage the tools to deploy a strong IAM strategy in our Cloud Landing Zone.</p>
<p>There is a lot of ground to cover, so let’s start immediately!</p>
<blockquote>
<p>I don’t want to bother you with all the details about AWS Organizations so that we can keep our focus on permissions. If that’s not the case, refer to one of the thousands of articles on the web or check <a target="_blank" href="https://blog.leapp.cloud/aws-multi-account-structure-with-aws-organization">THIS</a> one I wrote.</p>
</blockquote>
<h2 id="heading-policies">Policies</h2>
<p>So, let’s get the foundations covered (for the laziest of you, skip after the graph, there’s a neat bullet-point recap). Before jumping directly to the interactions, we need to understand what we have at our disposal in our IAM strategy and all the different kind of tools in IAM to make it work:</p>
<ol>
<li><p><strong>Identity-based policies</strong> are the most common type of policy. They are tied to IAM (Identity and Access Management) users, groups, and roles and specify what actions those entities can perform on certain AWS services.</p>
</li>
<li><p><strong>Resource-based policies</strong>, on the other hand, are policies that are directly associated with an AWS resource, such as an S3 bucket or an EC2 instance. Resource-based policies specify who has access to the resource and what actions they can take. Not all AWS services support them (for a comprehensive list, check the <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html">AWS services that work with IAM</a> page), and they are usually used for very specific scenarios.</p>
</li>
<li><p><strong>Permission boundaries (PBs)</strong> are policies that define the maximum permissions that an IAM entity can have. These policies limit an entity's permissions, ensuring they cannot perform actions that exceed their authorized scope. Permission boundaries are also written in AWS policy language and can be attached to IAM entities.</p>
</li>
<li><p><strong>Service control policies (SCPs)</strong> enforce restrictions on AWS accounts within an AWS organization. SCPs are hierarchical policies applied to the entire organization or specific organizational units. SCPs can be used to limit the actions that an AWS account can perform, preventing them from performing activities that are outside their authorized scope.</p>
</li>
<li><p><strong>Session policies</strong> are applied to temporary credentials created by IAM roles. Session policies limit the permissions of a temporary credential set, ensuring that it cannot perform actions that exceed its authorized scope. However, they primarily work like PBs and SCPs: they do not grant permissions and are applied only for the duration of the token. For the sake of simplicity, we’ll introduce this only at the end, so for now, let’s not consider it.</p>
</li>
</ol>
<h2 id="heading-the-caveat">The caveat</h2>
<p>As you may be starting to get, there is a fundamental difference between those policies, and it's laid out in the diagram by the action that connects the policy to the actual permissions.</p>
<blockquote>
<p>⚠️ Permission boundaries and Service control policies do NOT grant ANY permission</p>
</blockquote>
<p>An Identity can access a Resource only through Identity-based and Resource-based policies. Permission boundaries and SCPs can only <strong>limit</strong> the aforementioned permissions. That means we need an Identity-based or Resource-based policy that <strong>explicitly allows</strong> permission to let the policy evaluation engine.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680257825608/c4a2e584-4169-4d72-8f34-b3db48486ae1.png" alt class="image--center mx-auto" /></p>
<p>In short, Identity-based and Resource-based policies define who can access resources and what actions they can perform. Permission boundaries and Service Control Policies limit the scope of those permissions, ensuring that entities cannot perform unauthorized actions.</p>
<h2 id="heading-a-visual-representation-of-policy-interaction">A visual representation of policy interaction</h2>
<p>So let’s get a visual representation of our policies: start by seeing how it works in a single account, and then see how things change by adding AWS Organizations to the equation.</p>
<p>Yeah, I know the icons differ from the AWS framework but bear with me; I want to highlight the differences and that we’re working with fundamentally different policies.</p>
<h3 id="heading-single-account-without-organizations">Single account (without Organizations)</h3>
<p>As you can see, the three elements we can leverage are Identity-based, Resource-based policies, and Permission boundaries:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680257890113/8da0463b-af38-4d5a-a99a-43587d0caf9c.png" alt class="image--center mx-auto" /></p>
<p>We can see that while the policies going in and out of the Identity and the Resource grants access, the Permission Boundaries limit that set of permission instead.</p>
<p>It’s impossible to grant additional permissions through the use of Permission Boundaries.</p>
<h3 id="heading-organization-structure">Organization structure</h3>
<p>When integrating the AWS Organization service, we gain the ability to use Service control policies to have better control over our environment:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680257926751/ec689153-1b6d-45b8-b8cc-754717d1e27b.png" alt class="image--center mx-auto" /></p>
<p>The behavior is practically the same as Permission Boundaries, but we’ll see soon that it has a slight difference. So, to briefly recap:</p>
<ol>
<li><p><strong>AWS Identity-based policies:</strong></p>
<ul>
<li><p>Most common policy type in AWS.</p>
</li>
<li><p>Attached to IAM entities (users, groups, and roles)</p>
</li>
<li><p>Specify actions that entities can execute on specific AWS resources</p>
</li>
<li><p><em>Goes from Identity to Resource</em></p>
</li>
</ul>
</li>
<li><p><strong>AWS Resource-based policies:</strong></p>
<ul>
<li><p>Attached to an AWS resource (e.g., S3 bucket or EC2 instance)</p>
</li>
<li><p>Determine which users have access to the resource</p>
</li>
<li><p>Define what actions the authorized users can perform on the resource</p>
</li>
<li><p>Not all AWS services support them</p>
</li>
<li><p>Used in <strong>very specific</strong> scenarios</p>
</li>
<li><p><em>Goes from Resource to Identity</em></p>
</li>
</ul>
</li>
<li><p><strong>Permission boundaries:</strong></p>
<ul>
<li><p>Attached to IAM entities.</p>
</li>
<li><p>Defining maximum permissions for an IAM entity</p>
</li>
<li><p><strong>Limits</strong> the entity's permissions to the authorized scope</p>
</li>
</ul>
</li>
<li><p><strong>Service control policies (SCPs):</strong></p>
<ul>
<li><p>Hierarchical policies for AWS accounts in an Organization</p>
</li>
<li><p>Used to restrict the actions of AWS accounts</p>
</li>
<li><p><strong>Limits</strong> activities outside the scope of permissions.</p>
</li>
</ul>
</li>
<li><p><strong>Session policies:</strong></p>
<ul>
<li><p>Used with identity-based policies and permission boundaries</p>
</li>
<li><p>Applied to temporary credentials of IAM roles</p>
</li>
<li><p>Limits the permissions of temporary credentials</p>
</li>
<li><p>Ensures authorized scope is not exceeded</p>
</li>
</ul>
</li>
</ol>
<h1 id="heading-the-policy-evaluation-flow">The policy evaluation flow</h1>
<p>Behind all these definitions, a policy evaluation engine goes through all the policies we have seen before and evaluates if the specific action performed has to be allowed or denied.</p>
<p>Here I condensed the logic to understand the decision flow better:</p>
<p>It’s interesting to note that Resource and Identity-based permissions are evaluated at the center of the evaluation flow. Around them, SCPs and PBs are evaluated, which we clustered in control policies.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680257966803/c34fbe79-d6ea-4625-9a69-473a59165c28.png" alt class="image--center mx-auto" /></p>
<p>Aside from Resource-based and Session policies, it turns out that it’s pretty straightforward; the trick here is to focus on the edge cases.</p>
<h3 id="heading-with-resource-based-policies">With resource-based policies</h3>
<p>Resource-based policies result in a deny when the Principal making the request is different than the Principal we’re granting access to through the Resource-based policy. I’ve highlighted the affected case in the schema proposed by AWS at this <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html">link</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680258010906/36a0e285-242a-4976-bacf-db152ca47e32.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-with-session-policies">With session policies</h3>
<p>Even in this case, it’s simpler than it looks. Session policies kick in only when they are present.</p>
<p>If you’re not using them in your request, you shouldn't care, but when the time comes that you’re leveraging them, you need to remember the following:</p>
<ul>
<li><p>there is no allow → implicit deny</p>
</li>
<li><p>there is no explicit deny → implicit deny</p>
</li>
</ul>
<h2 id="heading-a-side-note-on-cross-account-access">A side note on cross-account access</h2>
<p>Until now, we’ve considered only access within the same account, but what would happen if we need to evaluate also cross-account access? It’s simpler than it looks: request is evaluated on policies and permission from the perspective of both the trusted and trusting account and allowed only if both are evaluated as an allow!</p>
<p>If you think about this, it’s more restrictive than single access. Since AWS permission starts with an implicit deny, you must explicitly set the permissions on both accounts before evaluating the request as an allow.</p>
<h2 id="heading-permission-intersections">Permission intersections</h2>
<p>After understanding what is involved in deciding when a request is allowed, we can move on to how they interact.</p>
<p>This led to two practical scenarios, one with and one without Resource-based policies. The main point here is to understand that <strong>the only case in which one’s effective permissions can exceed that of the whole intersection is when Resource-based policies are involved.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680258041245/a4f48fbb-cb0c-44dd-9750-1f3f3ec4f8e8.png" alt class="image--center mx-auto" /></p>
<p>When Resource-based policies are involved, if they evaluate as an allow, you’re taking the final decision before the policy evaluation flow would evaluate Identity-based, Permission Boundaries, and Session policies. This results in permissions granted that can exceed the ones explicitly allowed by those policies.</p>
<h2 id="heading-about-scps-inheritance">About SCPs inheritance</h2>
<p>The last thing to say is about Service Control Policies and the fact that they can be inherited.</p>
<p>Strangely, this doesn’t work as one should expect (but it’s for the better, trust me).</p>
<p>When one thinks about inheritance, usually in programming, but even in other fields, one thinks about getting the parent's configurations to the child. If we apply this to SCPs, Organizational Units, and accounts, one can define the SCPs at the root level and then inherit everything. Well, that’s NOT how it works.</p>
<p>Since DENY statements are evaluated first, in practice, <strong>only DENY statements are inherited</strong>.</p>
<p>If you deny a service in an SCP, there is no way to grant it in a lower-level OU or Account.</p>
<p>So, when an SCP is evaluated, there are actually only two SCPs that concur with the outcome:</p>
<ol>
<li><p>The parent SCP — it’s the SCP evaluated of the next higher-level SCP; this needs to be navigated to the Root to the Organization, so it just needs to add the next layer, one step at a time</p>
</li>
<li><p>The current SCP — the SCP which is currently being evaluated</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680258105218/0232f0fe-9958-4d39-a287-50b15779f218.png" alt class="image--center mx-auto" /></p>
<p>From this perspective, you can see that ALLOW statements are not inherited but need to be explicitly set in the SCP of the Account or Organization Unit. This is for security purposes, as we want to explicitly set the boundaries of accounts and organizational units to avoid implicit significant permissions.</p>
<h3 id="heading-deny-strategy">Deny strategy</h3>
<p>With a deny strategy, actions are allowed by default through a FullAccess SCP managed directly by AWS. You attach that SCP to all Accounts and OU and you need to specify what services and actions are prohibited:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680258132791/d3ada041-6373-4553-8759-2f8df67b6362.png" alt class="image--center mx-auto" /></p>
<p>This is the default configuration of AWS Organizations so that account admins can delegate all services and actions until you create and attach an SCP that denies a specific service.</p>
<p>The benefit of this approach is that <strong>deny statements require less maintenance</strong> because you don't need to update them when AWS adds new services, and it’s supported out of the box. You can also restrict access to specific resources or define conditions for when SCPs are in effect.</p>
<p>This is a great way to start for smaller organizations that need to act fast and don’t have strict requirements over governance and security.</p>
<h3 id="heading-allow-strategy">Allow strategy</h3>
<p>With an allow strategy, you must remove the AWS-managed FullAWSAccess SCP. Now all actions for all services are implicitly denied, and you need to create an SCP that explicitly permits only those services and actions you want to allow. This case is the same schema as the inheritance evaluation.</p>
<p>The benefit of this approach is that <strong>you have more control over what is allowed</strong>. Since everything is implicitly denied, this way is easier to scope down the actual boundaries of an account. Since deny permissions are inherited, you don’t have to specify it everywhere.</p>
<p>However, it requires more maintenance since you have to manually allow each service (and this includes new services). And it comes with some limitations on the allow statements: <strong>Resource elements can only have a ”*” entry,</strong> and they <strong>can't have a Condition.</strong></p>
<p>This approach's value shines when services may not be needed by a large portion of the organization but may still be required for specific use cases. In this scenario, it’s simpler to elevate permissions and satisfy security and governance concerns while allowing flexibility and exceptions.</p>
<h2 id="heading-just-a-few-examples">Just a few examples</h2>
<p>So let’s see those SCPs in action; here, I put some examples so you can better picture what an SCP looks like in a real-world scenario.</p>
<h3 id="heading-pipeline-only-account">Pipeline only account</h3>
<p>In this case, we’ve created an SCP to deny everything except changes that run through pipelines. The use case is to create an automation-only account where no manual action is allowed, but changes are always deployed through pipelines.</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
  <span class="hljs-attr">"Statement"</span>: [
    {
      <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"DenyAllExceptPipelines"</span>,
      <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
      <span class="hljs-attr">"NotAction"</span>: [
        <span class="hljs-string">"codepipeline:*"</span>,
        <span class="hljs-string">"codebuild:*"</span>,
        <span class="hljs-string">"codecommit:*"</span>,
        <span class="hljs-string">"codedeploy:*"</span>,
        <span class="hljs-string">"codestar:*"</span>,
        <span class="hljs-string">"cloudformation:*"</span>,
        <span class="hljs-string">"iam:*"</span>,
        <span class="hljs-string">"s3:*"</span>,
        <span class="hljs-string">"logs:*"</span>,
        <span class="hljs-string">"cloudwatch:*"</span>,
        <span class="hljs-string">"cloudtrail:*"</span>,
        <span class="hljs-string">"codestar:*"</span>,
        <span class="hljs-string">"codestar-notification:*"</span>,
        <span class="hljs-string">"codeartifact:*"</span>,
        <span class="hljs-string">"kms:*"</span>,
        <span class="hljs-string">"tag:*"</span>,
        <span class="hljs-string">"access-analyzer:*"</span>,
        <span class="hljs-string">"codestar-connections:*"</span>,
        <span class="hljs-string">"ssm:GetParameter*"</span>,
        <span class="hljs-string">"sts:*"</span>,
        <span class="hljs-string">"events:*"</span>
      ],
      <span class="hljs-attr">"Resource"</span>: <span class="hljs-string">"*"</span>,
      <span class="hljs-attr">"Condition"</span>: {
        <span class="hljs-attr">"StringNotLike"</span>: {
          <span class="hljs-attr">"aws:PrincipalArn"</span>: [
            <span class="hljs-string">"arn:aws:iam::MY-ACCOUNT-ID:role/MY-ROLE"</span>
          ]
        }
      }
    }
  ]
}
</code></pre>
<h3 id="heading-backup-protection">Backup protection</h3>
<p>In this SCP, we implemented a way to protect all backups made through AWS backup by deletion. Notice that both S3 and Backup vaults are protected and the service cannot be turned down.</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-attr">"Statement"</span>: [
        {
            <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"DenyS3BackupDelete"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"s3:DeleteObject"</span>,
                <span class="hljs-string">"s3:DeleteObjectVersion"</span>,
                <span class="hljs-string">"s3:DeleteObjectTagging"</span>,
                <span class="hljs-string">"s3:DeleteBucket"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: [
                <span class="hljs-string">"arn:aws:s3:::MY-S3-BACKUP*/*"</span>
            ],
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>
        },
        {
            <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"DenyBackupDelete"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"backup:DeleteBackupVault"</span>,
                <span class="hljs-string">"backup:DeleteBackupVaultAccessPolicy"</span>,
                <span class="hljs-string">"backup:PutBackupVaultAccessPolicy"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: [
                <span class="hljs-string">"arn:aws:backup:*:*:backup-vault:MY-BACKUP-VAULT"</span>
            ],
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
            <span class="hljs-attr">"Condition"</span>: {
                <span class="hljs-attr">"StringNotLike"</span>: {
                    <span class="hljs-attr">"aws:PrincipalARN"</span>: <span class="hljs-string">"arn:aws:iam::*:role/MY-EXECUTION-ROLE"</span>
                }
            }
        },
        {
            <span class="hljs-attr">"Sid"</span>: <span class="hljs-string">"DenyBackupTurnoffService"</span>,
            <span class="hljs-attr">"Action"</span>: [
                <span class="hljs-string">"backup:UpdateRegionSettings"</span>
            ],
            <span class="hljs-attr">"Resource"</span>: [
                <span class="hljs-string">"*"</span>
            ],
            <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Deny"</span>,
            <span class="hljs-attr">"Condition"</span>: {
                <span class="hljs-attr">"StringNotLike"</span>: {
                    <span class="hljs-attr">"aws:PrincipalARN"</span>: [
                        <span class="hljs-string">"arn:aws:iam::*:role/MY-EXECUTION-ROLE"</span>
                    ]
                }
            }
        }
    ]
}
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Congratulations, you’ve managed to get to the end of the blog post! We’ve gone from the policy evaluation flow to the actual implementation of SCPs, passing through the understanding of all the details that concur in policy and boundary interaction.</p>
<p>From seeing the SCP examples, as with any governance tool, their implementation is extremely tied to how your organization is structured and works. So I truly believe this knowledge should be well internalized and widely understood within the organization.</p>
<p>Now you’re on your way to mastery; see you next time, and let me know how your cloud journey is going!</p>
<div class="hn-embed-widget" id="star-leapp"></div>]]></content:encoded></item></channel></rss>