<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ IAM - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ IAM - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sun, 24 May 2026 22:24:57 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/iam/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Use Keycloak for Identity and Access Management ]]>
                </title>
                <description>
                    <![CDATA[ Whether your deployment requires logins from hundreds of thousands of end users or just a few remote admins, there's no escaping the need to properly control access to your infrastructure. And integrating those logins with industry-standard tools lik... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/keycloak-identity-and-access-management/</link>
                <guid isPermaLink="false">67924b2d0a4e059db2a7577f</guid>
                
                    <category>
                        <![CDATA[ authentication ]]>
                    </category>
                
                    <category>
                        <![CDATA[ IAM ]]>
                    </category>
                
                    <category>
                        <![CDATA[ keycloak ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SSO ]]>
                    </category>
                
                    <category>
                        <![CDATA[ single sign on ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ David Clinton ]]>
                </dc:creator>
                <pubDate>Thu, 23 Jan 2025 13:59:09 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1737640179567/36b76fb3-3e9f-4124-a4d5-bb7d11428a6c.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Whether your deployment requires logins from hundreds of thousands of end users or just a few remote admins, there's no escaping the need to properly control access to your infrastructure. And integrating those logins with industry-standard tools like LDAP and Active Directory can cut down the amount of work it'll take to get yourself up and running.</p>
<p>Keycloak is an enterprise-ready, open source identity access management (IAM) solution that's scalable, extensible, and robust. And it really doesn't need all that much care and feeding to launch a simple implementation.</p>
<p>This article will introduce you to the technology and the ways it can integrate best-practice authentication into your infrastructure.</p>
<p><em>Note on Hitachi Contributions to Keycloak:</em></p>
<p>Takashi Norimatsu works for Hitachi and has been the official maintainer of Keycloak since late 2021. Hitachi has been actively contributing to Keycloak since at least 2018.</p>
<p><a target="_blank" href="https://www.hitachi.com/New/cnews/month/2024/11/241108.html">Hitachi appears to be doing more strategically with open source in general</a> and Keycloak in particular. I believe strong, continued corporate support as part of an open source project is a positive sign, but at the very least, you should be aware of the corporate support for Keycloak during your assessment.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737406737359/1fc95289-7777-4c9f-a651-00bd8a44b517.png" alt="1fc95289-7777-4c9f-a651-00bd8a44b517" class="image--center mx-auto" width="751" height="589" loading="lazy"></p>
<h2 id="heading-getting-started-with-keycloak">Getting Started with Keycloak</h2>
<p>I'll begin with a brief "quick start". As you can see from this screenshot, Keycloak will run happily on multiple platforms. And their <a target="_blank" href="https://www.keycloak.org/guides">product documentation is excellent</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737406768154/a84122e2-1e72-43a8-86f2-aeaddd0c3a3b.png" alt="a84122e2-1e72-43a8-86f2-aeaddd0c3a3b" class="image--center mx-auto" width="1280" height="720" loading="lazy"></p>
<p>But here's some very simple one-command Docker syntax that will create a fully-functioning live Keycloak instance on your local machine:</p>
<pre><code class="lang-bash">docker run -p 8080:8080 \
     -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
     -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.0.7 start-dev
</code></pre>
<p>That's it. After a minute or two, you can open the administration interface on your browser using the appropriate variation of:</p>
<p><a target="_blank" href="http://localhost:8080">localhost:8080</a></p>
<p>Based on the Docker command defaults, you'll log in using admin and admin. Spend a few minutes digging into the environment to get a feel for the tools that are available.</p>
<h2 id="heading-what-keycloak-offers">What Keycloak Offers</h2>
<p>Ok. So why do you need Keycloak? Because it supports all the functionality demanded by modern deployments. That'll include Single Sign-On (SSO) to allow seamless authentication across multiple applications and services, OAuth2, OpenID Connect, SAML protocol compliance, and federated identities using existing LDAP or Active Directory setups or through social media logins like Google.</p>
<p>Keycloak incorporates the use of Multi-factor Authentication (MFA), built-in token revocation and expiration mechanisms, fine-grained permission management through Role-based Access Control (RBAC), and end-to-end encryption for sensitive communications. GDPR, HIPAA, and PCI DSS compliance are all possible.</p>
<p>Keycloak comes with a RESTful API for scripted and programmatic interactions. That will encourage task automation to further optimize your authentication processes. And your developers can build their own custom plugins to fill any usability gaps you encounter.</p>
<h2 id="heading-the-business-case-for-keycloak">The Business Case for Keycloak</h2>
<p>Because Keycloak is open source, there'll be no license fees to worry about. But open source gives you a lot more than just "cheap".</p>
<p>Keycloak cuts out vendor lock-in, allowing you to work with any platform or cloud provider – or move between them whenever necessary. It can also reduce overall operational costs through its simplified deployments (how much time did it take you to get that Docker image up and running?), automated updates, and no limits or cost penalties for even millions of monthly API calls or active users.</p>
<p>Having out-of-the-box (and free) access to the full feature set (including RBAC and MFA) also simplifies planning and execution. There's nothing "more" efficient than having to wait a week to access paywalled functionality until you get a response to your request for more project funding. All Keycloak features are just a click away.</p>
<p>This radar chart illustrates the feature and functionality differences between Keycloak and its major commercial peers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737407002045/d9a45f49-afbb-4709-a9da-016782d7c6ae.png" alt="Differences between Keycloak, Okta, Auth0, and Azure AD" class="image--center mx-auto" width="1750" height="1424" loading="lazy"></p>
<h3 id="heading-what-to-consider">What to Consider</h3>
<p>As much as Keycloak has to offer, it won't be the ideal choice for every use-case. And there are issues about which you should be aware up front.</p>
<p>For instance, while getting started may be easy, fully configuring, say, clustering and high availability for Keycloak can be complex for teams without experience in identity management. Managing latency issues for very large deployments can be challenging.</p>
<p>And while the documentation is generally excellent, it may not fully address specific complexities or edge-case scenarios. Similarly, there's no resource within the Keycloak community that offers guaranteed support. Although there are excellent third-party providers out there.</p>
<p>It's possible that, because you're not working with a commercial product, demonstrating regulatory compliance could be a bit more involved. You may also need to adapt your logging functionality to comply with various audit trail requirements.</p>
<p>Finally, customizable environments risk introducing destabilizing complexity. The further off the beaten trail your plugins and API implementations wander, the greater the odds that something will eventually break – especially around version upgrades.</p>
<h2 id="heading-your-next-steps">Your Next Steps</h2>
<p>It's always helpful to explore the journeys other people took with a new technology.</p>
<p>So <a target="_blank" href="https://www.redhat.com/en/blog/keycloak-success-stories-from-the-openshift-commons-gathering-amsterdam-2023">this page</a> includes information on a fascinating case study involving a Japanese bank that was looking for an API solution and decided on Keycloak because of its high level API security features. Yuichi Nakamura’s presentation <a target="_blank" href="https://youtu.be/jH7-tyrUP9E?si=6gKMdYH-o0LMiYFZ&amp;t=490">at the OpenShift Commons event in 2023</a> gives details how the bank successfully used Keycloak to secure their APIs. Nakamura, Hitachi Chief OSS Strategist, has recently been appointed as Head of Hitachi Open Source Program Office (OSPO).</p>
<p>And <a target="_blank" href="https://hossted.com/knowledge-base/case-studies/infrastructure-and-network/security/enhancing-authentication-services-with-freeipa-and-keycloak/">this is an account</a> of a university that implemented Kerberos Single Sign-On (SSO) for FreeIPA and configured Keycloak to connect with FreeIPA. The university successfully achieved user authentication from Keycloak by leveraging the SSSD option under “user federation” instead of relying on Kerberos or LDAP.</p>
<p>I’m no stranger to Keycloak myself, having taught a <a target="_blank" href="https://www.pluralsight.com/courses/keycloak-getting-started">Getting Started with Keycloak course on Pluralsight</a>. For beginners, this may be a good place to start. A 10 day free trial is available.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ AWS Identity and Access Management (IAM) – Explained With an Analogy ]]>
                </title>
                <description>
                    <![CDATA[ AWS IAM (Identity and Access Management) gives you control over who can access your AWS services and resources based on some predefined permissions. The two keywords here are “who” and “permissions”. “Who” refers to a specific identity, which can be ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/aws-iam-explained/</link>
                <guid isPermaLink="false">66d45e08d1ffc3d3eb89ddbd</guid>
                
                    <category>
                        <![CDATA[ authentication ]]>
                    </category>
                
                    <category>
                        <![CDATA[ authorization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ IAM ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Daniel Adetunji ]]>
                </dc:creator>
                <pubDate>Wed, 16 Nov 2022 18:51:48 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/11/Slide1.JPG" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>AWS IAM (Identity and Access Management) gives you control over <strong>who</strong> can access your AWS services and resources based on some predefined <strong>permissions</strong>.</p>
<p>The two keywords here are “who” and “permissions”. “Who” refers to a specific identity, which can be a <strong>user</strong>, <strong>group</strong> or <strong>role</strong>. “permissions” refer to the <strong>policies</strong> that are attached to an identity. These permissions either allow or deny access to a resource.</p>
<p>IAM is the AWS way of authenticating and authorising identities. Authentication is not, however, the same as authorisation. Authentication is concerned with the “<strong>who</strong>” while authorisation is concerned with the “<strong>permissions</strong>”.</p>
<h2 id="heading-the-difference-between-authentication-and-authorisation">The Difference Between Authentication and Authorisation</h2>
<p>Authentication is when an identity proves it is what/who it says it is. Authorisation, on the other hand, is proving that you have the permissions to access a resource.</p>
<p>To fully understand the difference, consider the following analogy. You need to be both authenticated and authorised in order to board a flight. Authentication is done with your passport or ID, where it is checked to ensure that the photo in your passport matches your face. This proves that you are who you say you are.</p>
<p>After you have been authenticated, you need to prove that you have the permission to take a specific flight. This is done with your boarding pass.</p>
<p>Both authentication and authorisation need to be carried out before you can board a flight. Similarly, both need to be carried out before you can access AWS resources.</p>
<p>You can <a target="_blank" href="https://www.freecodecamp.org/news/whats-the-difference-between-authentication-and-authorisation/">read more about authorisation vs authentication here</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-70.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Authentication &amp; authorisation are not the same</em></p>
<p>IAM users, groups, and roles are concerned with authentication – that is, proving that you are who you say you are. They are like passports that get you through security in an airport.</p>
<p>Without a boarding pass however, you cannot board a plane. The IAM policy is like a boarding pass, in that it grants or denies access to specific resources.</p>
<h2 id="heading-what-are-iam-users">What are IAM Users?</h2>
<p>This is any identity (humans or an application) that requires long term access to AWS resources. These entities make requests to IAM to get authenticated before any interaction with AWS resources is allowed the happen.</p>
<p>Authentication is done using a username/password combination for humans accessing AWS through the console, or through access keys for an application or a human accessing AWS through the command line interface.</p>
<h2 id="heading-what-are-iam-groups">What are IAM Groups?</h2>
<p>IAM users can be placed in an IAM group. IAM groups makes it easier to organise a large number IAM users and apply permissions on a group level instead of an individual level. This is because the latter does not scale for a large number of users.</p>
<p>Imagine you have a team that consists of developers, architects, admin staff, DevOps engineers, live support and testers. Each of these teams has 10 people, for a total of 60 people.</p>
<p>Instead of setting permission policies for 60 people individually, you can put IAM users into their respective groups and apply permissions on a group level. This makes it easier to organise permissions and also easier to scale as your team grows.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-72.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>IAM groups can be created for separate teams</em></p>
<p>There are no login credentials for IAM groups. Also, a user can belong to multiple groups, so for example, an IAM user that is in the DevOps group can also be in the live support group. This maps neatly to the real world where a DevOps engineer can also be in live support.</p>
<h2 id="heading-what-are-iam-roles">What are IAM Roles?</h2>
<p>IAM roles are used to grant <strong>temporary access</strong> to multiple identities. These identities could be humans external to AWS accessing your services, IAM users, or applications.</p>
<p>These identities assume the role temporarily, and any permission policies attached to the role are by proxy applied to the identity assuming that role.</p>
<p>IAM roles are important because AWS has hard limits on the number of IAM users (<a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html">currently 5000</a>).</p>
<h3 id="heading-trust-policies-vs-permission-policies">Trust policies vs permission policies</h3>
<p>IAM policies that are attached to roles come in two flavours – trust policy and permission policy.</p>
<p>The trust policy controls which identity (for example IAM users, AWS resources like EC2 instances, anonymous entities) can assume that role. Once a role is assumed by an identity, AWS issues it <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html">Temporary Security Credentials</a>.</p>
<p>You can think of the trust policy as how AWS authenticates an IAM role to ensure that only the identity that is allowed to assume the role can assume the role – that is, that an identity has proved that it is who/what it says it is.</p>
<p>But there is a catch. With trust policies, this authentication only works for a period of time. Once that time has elapsed, the identity needs to re-authenticate and get new Temporary Security Credentials.</p>
<p>The permission policy is relatively straightforward: it defines the permissions that the role has, which, by proxy, defines the permissions that the identity assuming that role will have.</p>
<p>IAM roles are a relatively difficult concept to grasp, so if you don’t quite understand it yet, please read on and it will become clearer.</p>
<h2 id="heading-how-iam-policies-work">How IAM Policies Work</h2>
<p>IAM Policies are attached to identities, so users, groups, or roles. IAM policies can also be attached to some AWS resources. These types of policies are called <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html">resource based policies</a>.</p>
<p>IAM policies are JSON documents, consisting of one or more statements that grant or deny access to AWS resources.</p>
<p>The IAM policy below shows how permissions are granted to an identity to read and write from an S3 bucket.</p>
<pre><code class="lang-python">{
    <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-string">"Statement"</span>: [
        {
            <span class="hljs-string">"Sid"</span>: <span class="hljs-string">"ListObjectsInBucket"</span>,
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Action"</span>: [<span class="hljs-string">"s3:ListBucket"</span>],
            <span class="hljs-string">"Resource"</span>: [<span class="hljs-string">"arn:aws:s3:::bucket-name"</span>]
        },
        {
            <span class="hljs-string">"Sid"</span>: <span class="hljs-string">"AllObjectActions"</span>,
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Action"</span>: <span class="hljs-string">"s3:*Object"</span>,
            <span class="hljs-string">"Resource"</span>: [<span class="hljs-string">"arn:aws:s3:::bucket-name/*"</span>]
        }
    ]
}
</code></pre>
<ul>
<li><p><code>Sid</code> stands for statement ID, an optional field that lets the reader quickly identify what a statement does.</p>
</li>
<li><p><code>Effect</code> can be either allow or deny</p>
</li>
<li><p><code>Action</code> refers to what action are you trying to perform. Format is <strong>service:operation</strong>.</p>
</li>
<li><p><code>Resource</code> refers to which resource are you interacting with. Typically you'll use <a target="_blank" href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> (Amazon Resource Name) which uniquely identify AWS resources.</p>
</li>
</ul>
<p>By default, all requests are implicitly denied unless a policy explicitly has an “allow” as is the case in the example above.</p>
<p>This principle of least privilege ensures that an identity cannot use a resource unless they are explicitly granted the permission to do so.</p>
<h2 id="heading-bringing-it-all-together-how-iam-works">Bringing it All Together – How IAM Works</h2>
<p>Consider a pizza restaurant. It will have some full time employees – like chefs, waiters and cleaners. It may also have some part time chefs to help during peak demand on evenings and weekends. If the restaurant is any good, it will also have customers who can eat in and take out.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-73.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>IAM restaurant analogy</em></p>
<p>To draw an analogy with AWS IAM, the full time employees are like IAM users. They require long term access to the restaurant’s resources as shown above. These users will all belong to different groups – the waiters, chef, and cleaners group (that is, all waiters, for example, will have the same job title of “waiter”).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-74.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>IAM restaurant analogy</em></p>
<p>How are the restaurant’s employees authenticated? How do we know that they are who they say they are? Name badges with a picture will do the job. This can also show their title which is analogous to the IAM group that they belong to.</p>
<p>The permission policies that define what resources the restaurant’s employees can access are applied on the group level, since every waiter, chef and cleaner will have the same permissions. This may not be true in reality, as the head chef for example may have privileged access. But for simplicity, let's assume it is true.</p>
<p>How does the restaurant manager control who has access to what resources? Doors with locks will do just fine. Keys act as a policy as they control access to parts of the restaurant.</p>
<p>An identical set will be given to all waiters, since waiters will need the same level of access to the food/drink storage room, kitchen, and seating area.</p>
<p>The same logic will apply to the other full time employees, where the appropriate set of keys are handed out so that they can use the restaurant’s resources as needed.</p>
<p>Giving keys to the restaurant employees is analogous to attaching a policy to an IAM user or group. Without the keys, the employees cannot access parts of the restaurant.</p>
<p>Similarly in AWS, without policies that explicitly allow an action, requests cannot be made to AWS resources. The default state in both AWS and our restaurant analogy is an implicit deny when trying to access resources.</p>
<p>The part time employees, like a temporary chef for example, and the customers, don’t need long term access to resources but will need short term access, analogous to IAM roles.</p>
<p>The part time employees can only work during a short window – say during evenings on the weekend. Outside of this time, they don’t have permissions to use the restaurant’s resources.</p>
<p>This part time chef does not have to be the same person. It could be a different person every week, unlike the full time employees that have specific identities.</p>
<p>A part time chef will therefore <strong>assume</strong> the role of a chef and get a <strong>temporary</strong> badge that they keep for the duration of their shift. This is analogous to an entity assuming an IAM role that has a policy attached to it and getting Temporary Security Credentials that will expire after some time.</p>
<p>Again, the policy here is the set of keys that grant permission to parts of the restaurant while the Temporary Security Credential is the temporary badge used to authenticate the chef.</p>
<p>Similarly, the customers are analogous to IAM roles for two reasons. First, they only require temporary access to the restaurant. Second, and perhaps more importantly, a successful restaurant will have tens of thousands to hundreds of thousands of unique customers over its lifetime.</p>
<p>Having a large number of unidentified entities is a perfect use case for IAM roles. Recall that with AWS, there is a hard limit of 5000 for the number of IAM users you can have. If there is a use case where the number of IAM users required will exceed this 5000 limit, using IAM roles is your only option around this.</p>
<p>Just like how IAM roles are assumed, the customer first needs to order something to prove that they are a customer and can assume the role of a customer.</p>
<p>After the customer role is assumed, the permissions policy attached to the customer role is then applied to the customer as well. Customers have permissions to only use some resources like the seating area and the toilet.</p>
<p>To keep the analogy realistic, access to the toilet is controlled by entering a passcode which changes every day, thus ensuring that the access is temporary. This passcode is analogous to the policy attached to the customer role that grants temporary access to the toilet.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-75.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-example-use-case-of-iam-roles">Example Use Case of IAM Roles</h2>
<p>Consider the following very simple architecture: an EC2 instance running an application that needs full access to an S3 bucket.</p>
<p>How would you give the EC2 instance the permission to read and write objects from an S3 bucket? This is explained in the diagram below:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-77.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Attaching a policy to an IAM role and letting an EC2 instance assume that role</em></p>
<ol>
<li><p>Create an IAM role for your EC2 instance</p>
</li>
<li><p>Attach an IAM policy to the role that gives full access to the S3 bucket</p>
</li>
<li><p>Let the EC2 instance assume the role</p>
</li>
</ol>
<p>The IAM policy for full S3 access mentioned in step #2 is:</p>
<pre><code class="lang-python">{
    <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:*"</span>,
                <span class="hljs-string">"s3-object-lambda:*"</span>
            ],
            <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"*"</span>
        }
    ]
}
</code></pre>
<p>You can now read from and write to the S3 bucket. Notice that in the policy above, it doesn’t specify any ARN, but just says “*” for the resource. This means all S3 buckets. If that is what you want, then this policy is fine. But if you want to specify a single bucket, then you need to give the bucket ARN.</p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>Understanding IAM and the difference between users, roles, groups and how policies work gives you a strong foundation on which you can architect and build secure solutions with AWS.</p>
<p>Thank you for reading!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ AWS IAM – Policy, Access Roles, Resources Explained, and Why They're Useful ]]>
                </title>
                <description>
                    <![CDATA[ By Periklis Gkolias IAM, or Identity and Access Management, is one of the most common terms you'll hear in cloud-native environments. But what does it do? And if you're already familiar with IAM, how long did it take you to fully understand it? I wil... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-introduction-to-iam-i-wish-i-had/</link>
                <guid isPermaLink="false">66d4609df855545810e934c3</guid>
                
                    <category>
                        <![CDATA[ Cloud Services ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Solutions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ IAM ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 07 Apr 2022 02:50:41 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/g7In5Xr-2.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Periklis Gkolias</p>
<p>IAM, or Identity and Access Management, is one of the most common terms you'll hear in cloud-native environments.</p>
<p>But what does it do? And if you're already familiar with IAM, how long did it take you to fully understand it?</p>
<p>I will explain the main concepts behind this massive family of software, with you, the busy engineer, in mind.</p>
<p>The fundamentals described here are vendor agnostic, though most of my experience is with AWS's implementation.</p>
<h2 id="heading-what-is-iam">What Is IAM?</h2>
<p>IAM is a complex system of entities (humans, applications, and so on) that request access to a system. It is also a hierarchical set of rules to grant or deny requested access.</p>
<p>Before we go any further, here are the main terms you'll encounter:</p>
<ul>
<li><strong>Resource</strong>: Anything worth protecting. A storage service, virtual machine, etc.</li>
<li><strong>Policy</strong>: A set of rules that dictate who can and can't do something on a single resource or group of resources.</li>
<li><strong>Action</strong>: Anything someone can do inside the cloud environment. For example, creating a virtual machine.</li>
<li><strong>User</strong>: Well... A user :)</li>
<li><strong>Group</strong>: A group of users with the same permissions applied.</li>
<li><strong>Principal</strong>: A user or an application requesting access.</li>
<li><strong>Role</strong>: A set of powers assigned to a principal, usually for a limited amount of time.</li>
</ul>
<h2 id="heading-why-iam-is-useful">Why IAM Is Useful</h2>
<p>IAM is mainly used for authentication, authorization, granular access, and governance.</p>
<p>Let's see what those all mean:</p>
<ul>
<li><strong>Authentication</strong>: The act over verifying who you are.</li>
<li><strong>Authorization</strong>: The act of identifiying if someone can perform the action they are requesting. This is usually combined with authentication, but not always.</li>
<li><strong>Granular access</strong>: Permissions that control each action that can happen on a resource. For example, a user might have permission to see firewall rules, but doesn't have permission to change them. This is implemented with <a target="_blank" href="https://en.wikipedia.org/wiki/Role-based_access_control">Role-Based Access Control</a>.</li>
<li><strong>Governance</strong>: The actions you take to know what is happening in your environment, mostly for reasons of budget, compliance, and proper access scope.</li>
</ul>
<p>If you're a company of 1-3 people, then setting up a full-blown IAM solution is probably overkill. Buf if your team is larger than that, or you're planning to scale up, then you should start considering it.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/WxyvyO4.jpg" alt="IAM pillars" width="600" height="400" loading="lazy"></p>
<h2 id="heading-common-problems-you-dont-use-iam">Common Problems You Don't Use IAM</h2>
<p>I believe you can see the benefits of an IAM solution.</p>
<p>Now let's take a look at some common problems organizations face in the absence of it.</p>
<h3 id="heading-its-hard-to-audit-and-administer-access">It's Hard to Audit and Administer Access</h3>
<p>Have you heard of cases where an employee had more access than they should? And additionally, no one knew?</p>
<p>This can be prevented with a properly set-up IAM solution.</p>
<h3 id="heading-setting-up-accounts-for-new-hires-is-a-pain">Setting Up Accounts for New Hires Is a Pain</h3>
<p>With an IAM solution in place, this would just be a matter of a few clicks. Namely, set up the users and add them to the IAM groups their teams use. That's it.</p>
<p>But without an IAM solution? You would need to set all the permissions for each account manually.</p>
<p>You might have a reference user to copy from, but does each new account need all the permissions the reference user has? Do you have special handling for user accounts that are less than 6 months old? Does the reference user have superuser permissions that should not be accidentally assigned to a new hire's account?</p>
<h3 id="heading-offboarding-people-is-time-consuming">Offboarding People Is Time Consuming</h3>
<p>Here you'll have similar problems to the new hire case above. But when a collegue is leaving, you'll need to change the password to all the accounts they <strong>potentially</strong> used.</p>
<p>This can turn ugly very fast, not to mention the side effects this has on other team memebers.</p>
<p>And you would have to do this for every script, application, and other resource whenever there's an offboarding. What if you have a team change 2-3 times per month? You and your team would have a hard time being productive.</p>
<h3 id="heading-simple-things-require-human-intervention">Simple Things Require Human Intervention</h3>
<p>Without an IAM solution, tasks like resetting a password or re-enabling an account that was locked need to be done manually.</p>
<p>Top-tier IAM solutions have a way to resolve such issues fast without much hassle.</p>
<h2 id="heading-best-practices">Best Practices</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/M7N8blv.jpg" alt="Best practices" width="600" height="400" loading="lazy"></p>
<p>If you've decided to set up IAM, here are some best practices. This is far from a full list, and is based on my personal experience. But I've seen these practices on more than one team, so they should work for you as well.</p>
<h3 id="heading-never-grant-full-access-ever">Never Grant Full Access... EVER</h3>
<p>In a real-world scenario, you wouldn't want every user to have unlimited access to an account. Ideally, no one should full access to anything (apart from the account owner).</p>
<p>For example, if an employee's responsibility is to monitor logs, they should have read access only to that tool. They should not be able to restart a service, or view billing information.</p>
<h3 id="heading-prefer-groups-to-multiple-users">Prefer Groups to Multiple Users</h3>
<p>It's better to use groups instead of multiple users when you have a choice. Groups make administration exponentially easier.</p>
<p>For example, if a new person joins your organization as a developer, they can be added to an IAM group for developers. That new person will then inherit all the powers of that IAM group.</p>
<p>The alternative, creating a user for each group (reader_susan, admin_susan) is considered obsolete.</p>
<h3 id="heading-prefer-roles-on-existing-users-to-creating-a-new-user">Prefer Roles on Existing Users to Creating a New User</h3>
<p>When given the option, prefer assigning a role to an existing user rather than creating a new user.</p>
<p>For example, don't create an admin user and share the password between 10 people. Create an admin role and assign it to whoever needs it for a limited amount of time.</p>
<h3 id="heading-audit-permissions-frequently">Audit Permissions Frequently</h3>
<p>It is easy to make mistakes or perform malicious actions. At the very least, a company should audit permissions regularly, and ensure that only the proper people have the minimum level of access necessary for their roles.</p>
<p>You could also send an email to a certain team when a suspicious action happens. For example, assigning an admin role to a new hire.</p>
<h3 id="heading-set-up-boundaries-beforehand">Set Up Boundaries Beforehand</h3>
<p>If an IAM solution allows for it, add boundaries to your ecosystem.</p>
<p>According to Amazon's documentation:</p>
<blockquote>
<p>A permissions boundary is an advanced feature for using a managed policy to set the maximum permissions that an identity-based policy can grant to an IAM entity. An entity's permissions boundary allows it to perform only the actions that are allowed by both its identity-based policies and its permissions boundaries.</p>
</blockquote>
<p>(I know, I know — I promised to be vendor-agnostic 🙂)</p>
<p>In layman's terms, you can define the "maximum" permissions that can be assigned to anyone.</p>
<p>For example, a user will at most be able to view the logs from the relevant tool and restart a service. If someone attempts to get a role to create a new virtual machine they will be disallowed.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thank you for reading this far. I hoped you enjoyed this introduction to IAM.</p>
<p>If you have any questions, please reach out to me on Twitter.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Add Limited Access IAM Users to an EKS Cluster ]]>
                </title>
                <description>
                    <![CDATA[ By Faizan Bashir Introduction Elastic Kubernetes Service (EKS) is the fully managed Kubernetes service from AWS. It is deeply integrated with many AWS services, such as AWS Identity and Access Management (IAM) (for authentication to the cluster), Ama... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/adding-limited-access-iam-user-to-eks-cluster/</link>
                <guid isPermaLink="false">66d45edf787a2a3b05af43a8</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Services ]]>
                    </category>
                
                    <category>
                        <![CDATA[ EKS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ IAM ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Kubernetes ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Fri, 31 Jan 2020 11:27:37 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9c9d3d740569d1a4ca36ad.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Faizan Bashir</p>
<h3 id="heading-introduction"><strong>Introduction</strong></h3>
<p><a target="_blank" href="https://aws.amazon.com/eks/">Elastic Kubernetes Service (EKS)</a> is the fully managed <a target="_blank" href="https://kubernetes.io/">Kubernetes</a> service from AWS. It is deeply integrated with many AWS services, such as AWS Identity and Access Management (IAM) (for authentication to the cluster), Amazon CloudWatch (for logging), Auto Scaling Groups (for scaling worker nodes), and Amazon Virtual Private Cloud (VPC) (for networking). Many companies trust Amazon EKS to run their containerized workloads.</p>
<p><img src="https://faizanbashir.me/assets/images/posts/eks-iam.png" alt="EKS IAM Authentication" width="600" height="400" loading="lazy"></p>
<p>EKS uses IAM to provide authentication to your Kubernetes cluster (via the <code>aws eks get-token</code> command, or the <a target="_blank" href="https://github.com/kubernetes-sigs/aws-iam-authenticator">AWS IAM Authenticator for Kubernetes</a>). For authorization it relies on native <a target="_blank" href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/">Kubernetes Role Based Access Control (RBAC)</a>. IAM is used for authentication to your EKS Cluster. And you can manage the permissions for interacting with your cluster’s Kubernetes API through the native Kubernetes RBAC system.</p>
<h2 id="heading-how-to-create-an-iam-user">How to create an IAM User</h2>
<p>Go to your <a target="_blank" href="https://console.aws.amazon.com/">AWS Console</a> where you will find the <a target="_blank" href="https://console.aws.amazon.com/iam/home">IAM service</a> listed under the “Security, Identity &amp; Compliance” group. Inside the IAM dashboard click on the Users tab and click the “Add User” button.</p>
<p><img src="https://faizanbashir.me/assets/images/posts/1*VtA7fGzE2a_h6yMTl69lBw.png" alt="AWS IAM Dashboard User Tab" width="600" height="400" loading="lazy"></p>
<p>Create a new user and allow the user <strong>programmatic access</strong> by clicking on the "Programmatic access" checkbox. You do not need any particular permission for your user to access EKS. You can go ahead without selecting any permission.</p>
<p><img src="https://faizanbashir.me/assets/images/posts/1*7FqyvVFoRxZClqC16SevXw.png" alt="Access Keys" width="600" height="400" loading="lazy"></p>
<p>After the user is created, you will have access to the user's <strong>Access Key ID</strong> and <strong>Secret Access Key</strong>. You will be required to use these keys in the next step.</p>
<h2 id="heading-configure-the-aws-cli">Configure the AWS CLI</h2>
<p>Configuring your AWS CLI with a new user is as simple as running the <code>aws configure</code> command and providing the <code>AWS Access Key ID</code> and the <code>AWS Secret Access Key</code>. The <code>Default region name</code> and <code>Default Output format</code> are optional, though.</p>
<pre><code class="lang-shell">$ aws configure --profile eks-user
AWS Access Key ID [None]: AKIAI44QH8DHBEXAMPLE
AWS Secret Access Key [None]: je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: text
</code></pre>
<p>Once configured you can test to see if the user is properly configured using the <code>aws sts get-caller-identity</code> command:</p>
<pre><code class="lang-shell">$ aws sts get-caller-identity --profile eks-user
</code></pre>
<p>If the user is properly configured with the <code>aws</code> cli utility you should see a response like the one shown below:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"UserId"</span>: <span class="hljs-string">"AIDAX7JPBEM4A6FTJRTMB"</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/eks-user"</span>
}
</code></pre>
<h2 id="heading-creating-a-role-and-rolebinding-for-the-user">Creating a Role and RoleBinding for the user</h2>
<p>With your IAM user properly configured, you can go ahead and create a role for the user. This snippet of code creates a role named <code>eks-user-role</code> with a modest <code>list</code> permission to the <code>pods</code> resource in your cluster.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">kind:</span> <span class="hljs-string">Role</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">eks-user-role</span>
<span class="hljs-attr">rules:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">""</span>]
  <span class="hljs-attr">resources:</span> [<span class="hljs-string">"pods"</span>]
  <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"list"</span>]
</code></pre>
<p>Save the above snippet of code in a file and then <code>apply</code> the Role to your Kubernetes cluster:</p>
<pre><code class="lang-shell">$ kubectl apply -f role.yaml
</code></pre>
<p>With the role configured you need to create a corresponding RoleBinding:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">rbac.authorization.k8s.io/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">RoleBinding</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">eks-user-role-binding</span>
<span class="hljs-attr">subjects:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">kind:</span> <span class="hljs-string">User</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">eks-user</span>
  <span class="hljs-attr">apiGroup:</span> <span class="hljs-string">rbac.authorization.k8s.io</span>
<span class="hljs-attr">roleRef:</span>
  <span class="hljs-attr">kind:</span> <span class="hljs-string">Role</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">eks-user-role</span>
  <span class="hljs-attr">apiGroup:</span> <span class="hljs-string">rbac.authorization.k8s.io</span>
</code></pre>
<p>Save the above snippet of code in a file and then <code>apply</code> the Role Binding to your Kubernetes cluster:</p>
<pre><code class="lang-shell">$ kubectl apply -f role-binding.yaml
</code></pre>
<h2 id="heading-adding-the-user-to-the-aws-auth-configmap">Adding the user to the aws-auth configmap</h2>
<p>If you want to grant additional AWS users or roles the ability to interact with your EKS cluster, you must add the users/roles to the <code>aws-auth</code> ConfigMap within Kubernetes in the <code>kube-system</code> namespace.</p>
<p>You can do this by either editing it using the <code>kubectl edit</code> command:</p>
<pre><code class="lang-shell">$ kubectl edit configmap aws-auth -n kube-system
</code></pre>
<p>Or by importing the <code>aws-auth</code> ConfigMap and applying the changes:</p>
<pre><code class="lang-shell">$ kubectl get configmap aws-auth -n kube-system -o yaml &gt; aws-auth.yaml
</code></pre>
<p>Add the user under the <code>mapUsers</code> as an item in the <code>aws-auth</code> ConfigMap:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">data:</span>
  <span class="hljs-attr">mapUsers:</span> <span class="hljs-string">|
    - userarn: arn:aws:iam::123456789012:user/eks-user
      username: eks-user
      groups:
      - eks-role</span>
</code></pre>
<p>If the user is properly configured you should be able to list pods in the Cluster:</p>
<pre><code class="lang-shell">$ kubectl get pods --as eks-user
</code></pre>
<p>The <code>--as</code> flag impersonates the request to Kubernetes as the given user. You can use this flag to test permissions for any given user.</p>
<h2 id="heading-configuring-permissions-for-the-user">Configuring permissions for the user</h2>
<p>The role which you defined previously only had permission to list pods. The <code>eks-user</code> cannot access any other Kubernetes resources like Deployments, ConfigMaps, Events, Secrets, logs or even shell into a given pod.</p>
<p>In a real-world scenario, you will need to provide permissions to a user to access the required resources. The below snippet of code provides access to resources such as <code>events</code>, <code>pods</code>, <code>deployments</code>, <code>configmaps</code> and <code>secrets</code>.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">rules:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">""</span>]
  <span class="hljs-attr">resources:</span> [<span class="hljs-string">"events"</span>]
  <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"get"</span>, <span class="hljs-string">"list"</span>, <span class="hljs-string">"watch"</span>]
<span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">""</span>]
  <span class="hljs-attr">resources:</span> [<span class="hljs-string">"pods"</span>, <span class="hljs-string">"pods/log"</span>, <span class="hljs-string">"pods/exec"</span>]
  <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"list"</span>, <span class="hljs-string">"get"</span>, <span class="hljs-string">"create"</span>, <span class="hljs-string">"update"</span>, <span class="hljs-string">"delete"</span>]
<span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">"extensions"</span>, <span class="hljs-string">"apps"</span>]
  <span class="hljs-attr">resources:</span> [<span class="hljs-string">"deployments"</span>]
  <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"list"</span>, <span class="hljs-string">"get"</span>, <span class="hljs-string">"create"</span>, <span class="hljs-string">"update"</span>, <span class="hljs-string">"delete"</span>]
<span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">""</span>]
  <span class="hljs-attr">resources:</span> [<span class="hljs-string">"configmaps"</span>]
  <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"list"</span>, <span class="hljs-string">"get"</span>, <span class="hljs-string">"create"</span>, <span class="hljs-string">"update"</span>, <span class="hljs-string">"delete"</span>]
<span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">""</span>]
  <span class="hljs-attr">resources:</span> [<span class="hljs-string">"secrets"</span>]
  <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"list"</span>, <span class="hljs-string">"get"</span>, <span class="hljs-string">"create"</span>, <span class="hljs-string">"update"</span>, <span class="hljs-string">"delete"</span>]
</code></pre>
<p>Add the above permissions to the <code>role.yaml</code> file and apply the changes, using <code>kubectl apply -f</code>.</p>
<h2 id="heading-test-test-and-test">Test, test and test!</h2>
<p>Now go ahead and test to see if the permissions have been properly applied to the <code>eks-user</code>. You can test the same using the above mentioned <code>--as USERNAME</code> flag or set the <code>eks-user</code> as the default profile for the <code>aws</code> cli.</p>
<pre><code class="lang-shell">$ export AWS_PROFILE=eks-user
</code></pre>
<p>Once configured you can test to see if the user is properly configured using the <code>aws sts get-caller-identity</code> command:</p>
<pre><code class="lang-shell">$ aws sts get-caller-identity
</code></pre>
<p>You should see a response like the following, indicating the user is properly configured with your <code>aws</code> cli utility:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"UserId"</span>: <span class="hljs-string">"AIDAX7JPBEM4A6FTJRTMB"</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/eks-user"</span>
}
</code></pre>
<p>Test the permissions of the user with the below-mentioned commands.</p>
<pre><code class="lang-shell">$ kubectl get pods
$ kubectl get secrets
$ kubectl get configmaps
$ kubectl get deployments
$ kubectl logs &lt;pod-name&gt;
$ kubectl exec -it &lt;pod-name&gt; sh
$ kubectl create configmap my-cm --from-literal=db_username=&lt;USERNAME&gt; --from-literal=db_host=&lt;HOSTNAME&gt;
$ kubectl create secret generic my-secret --from-literal=db_password=&lt;SOME_STRONG_PASSWORD&gt;
</code></pre>
<p>Simply put, the <code>eks-user</code> user should be able to perform all the actions specified in the verbs array for <code>pods</code>, <code>secrets</code>, <code>configmaps</code>, <code>deployments</code>, and <code>events</code>. You can read more about it here <a target="_blank" href="https://kubernetes.io/docs/reference/access-authn-authz/authorization/">Kubernetes Authorization Overview</a>.</p>
<h2 id="heading-can-i-or-not">Can-I or Not</h2>
<p>You can use <code>auth can-i</code> to check if you have permission to a resource. To see if you have the permission to get pods simply run:</p>
<pre><code class="lang-shell">$ kubectl auth can-i get pods
</code></pre>
<p>The answer will be a simple <code>yes</code> or <code>no</code>. Amazing, isn’t it?</p>
<p>Wanna check if you have <code>cluster-admin</code> permissions? Fire this:</p>
<pre><code class="lang-shell">$ kubectl auth can-i "*" "*"
</code></pre>
<h2 id="heading-wrap-up">Wrap up</h2>
<p>EKS provides the Kubernetes control plane with the backend persistence layer. The Kubernetes API server and the master nodes are provisioned and scaled across various availability zones, resulting in high availability and eliminating a single point of failure. An AWS-managed Kubernetes cluster can withstand the loss of an availability zone.</p>
<p>Access and authorization controls are critical for any security system. Kubernetes provides us with an awesome robust RBAC permission mechanism.</p>
<p><em>Originally published at</em> <a target="_blank" href="https://faizanbashir.me/adding-limited-access-iam-user-to-eks-cluster"><strong>faizanbashir.me</strong></a></p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
