<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Somesh Srivastava</title>
    <description>The latest articles on DEV Community by Somesh Srivastava (@somesh1983).</description>
    <link>https://dev.to/somesh1983</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F834439%2F70d004eb-3192-48f0-96db-d835b47767e4.jpg</url>
      <title>DEV Community: Somesh Srivastava</title>
      <link>https://dev.to/somesh1983</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/somesh1983"/>
    <language>en</language>
    <item>
      <title>AWS Community Builders Holiday posts 2022</title>
      <dc:creator>Somesh Srivastava</dc:creator>
      <pubDate>Sat, 24 Dec 2022 04:20:32 +0000</pubDate>
      <link>https://dev.to/aws-builders/aws-community-builders-holiday-posts-2022-3onm</link>
      <guid>https://dev.to/aws-builders/aws-community-builders-holiday-posts-2022-3onm</guid>
      <description>&lt;p&gt;A very warm welcome to all the CBs. The motivation to write this blog came from this &lt;a href="https://dev.to/aws-builders/a-few-personal-stories-from-reinvent-2022-4g09"&gt;post&lt;/a&gt; by &lt;a class="mentioned-user" href="https://dev.to/lockhead"&gt;@lockhead&lt;/a&gt; 🙂&lt;/p&gt;

&lt;p&gt;I'm adding one more question to all the questions Johannes asked to CBs 🙂&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What drives you to become an AWS Community Builder ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you have a passion to do something, then it gives you the energy &amp;amp; enthusiasm to work towards achieving it. My passion to work on AWS and helping the tech community with my experience &amp;amp; knowledge drives me a lot.&lt;/p&gt;

&lt;p&gt;This is how my journey to AWS Community Builder started off in 2022. I was awarded as an AWS APN Ambassador in 2021 but as I left the organization in the same year, the title was also off boarded with it. I remember talking to Katreena Mullican about other programs I can be associated with and continue my contributions in the tech community. Upon knowing about the AWS Community Builders program, I immediately applied it but got rejection. 😒 I then deep dived into the program objectives and started working on contributing to the wider community through blogs, answering queries in the Global AWS Certified Community forums/platforms and many other ways which eventually resulted in my application getting accepted in March 2022 ☺️&lt;br&gt;
I told the world about it &lt;a href="https://www.linkedin.com/posts/somesh-srivastava-5a746113_awscommunitybuilders-activity-6953736043544137728-6bzZ?utm_source=share&amp;amp;utm_medium=member_desktop" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While wrapping the year 2022, if I recall my first year journey as an AWS Community Builder, I feel incredibly proud of the contributions I made:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;written 4 articles&lt;/li&gt;
&lt;li&gt;delivered 3 talks&lt;/li&gt;
&lt;li&gt;organized &amp;amp; led one in-house online quiz event&lt;/li&gt;
&lt;li&gt;answered many queries in the Global AWS Certified Community forum&lt;/li&gt;
&lt;li&gt;Leading the AWS upskill program in Barclays, across India locations while working very closely with AWS T&amp;amp;C team, TAMs and SAs&lt;/li&gt;
&lt;li&gt;joined the AWS User Group Pune as a core organizing team member&lt;/li&gt;
&lt;li&gt;co-organized and contributed in an in-person AWS Community Day Pune 2022 event&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What surprises you most about the AWS Community Builders program?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The diversity of people, skills and resources this program has. Another thing which really surprises me is the amount of contributions the CBs are making, sometimes I really think how do they get time to do so many activities, blogs, talks etc. and whether I contributed enough :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's your background and your experience with AWS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Well I'm thinking on writing another blog on it 🙂 but I'll keep it short here. I started off my career in 2007 and have played many roles in my 16 years of career ranging from Test engineer, Payments domain SME, Blockchain architect, AWS solutions architect. Currently working in Barclays (Pune, India) as a Cloud Engineering Lead and Lead Cloud Solutions Architect for the business unit called Corporate Digital Banking.&lt;br&gt;
My AWS journey started in 2015 when I was setting a Blockchain node on a linux server without knowing it was an EC2 instance :D I got to know from the person who was provisioning the infra, that it was an EC2 which is an AWS service. I started exploring &amp;amp; learning AWS since then and took my career ahead in AWS. Have migrated applications &amp;amp; servers to AWS, architect many AWS solutions which helped customer in their cloud adoption journey. I now possess 6 AWS certifications including 1 professional &amp;amp; 2 specialty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whats's the biggest benefit you see from the program?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Availability and access to the contents &amp;amp; resources, opportunity to learn &amp;amp; upskill yourself, contribute and sharing knowledge with tech communities. &lt;br&gt;
Another benefit is that, it increases the brand value of a person. I really felt it in last few months; but it also increases my confidence and boost my moral to do even more for the community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s the next swag item that you would like to get?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Talking about Swags are incredibly important :) I loved the swags I have received till now from the program. More stickers please!😉 My laptop flap still has free spaces. 😀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1f1m1joy54pqadtpizu2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1f1m1joy54pqadtpizu2.jpg" alt="Image description" width="800" height="1066"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are you eating for dinner today? share the recipe!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Matka Paneer Biryani 😋 (Cheese Biryani in clay pot)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhp4rg0ujl7bohkokxgqa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhp4rg0ujl7bohkokxgqa.jpg" alt="Image description" width="271" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow recipe &lt;a href="https://www.vegrecipesofindia.com/paneer-biryani-recipe/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you have anything else to say about the AWS Community Builders Program in 2022?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Keep learning, collaborating &amp;amp; contributing! 🙂&lt;br&gt;
Thank you &lt;a class="mentioned-user" href="https://dev.to/shafjag"&gt;@shafjag&lt;/a&gt;, Taylor Lucy &amp;amp; Jason Dunn for this opportunity and the lovely swags! :)&lt;/p&gt;

&lt;p&gt;Happy Holidays Everyone! &lt;br&gt;
Merry Christmas and a Very Happy New Year!&lt;/p&gt;

</description>
      <category>music</category>
    </item>
    <item>
      <title>How to provide restricted &amp; secure access to a third party, to your AWS accounts, using Attribute Based Access Control (ABAC)</title>
      <dc:creator>Somesh Srivastava</dc:creator>
      <pubDate>Sat, 21 May 2022 11:47:29 +0000</pubDate>
      <link>https://dev.to/aws-builders/how-to-provide-restricted-secure-access-to-a-third-party-to-your-aws-accounts-using-attribute-based-access-control-abac-1ojb</link>
      <guid>https://dev.to/aws-builders/how-to-provide-restricted-secure-access-to-a-third-party-to-your-aws-accounts-using-attribute-based-access-control-abac-1ojb</guid>
      <description>&lt;p&gt;Many Organizations work with different vendors or third parties, to provide or consume services or you may have outsourced your work completely to the vendor. Often there is a need for Organizations to provide access to their resources like server, storage, database etc. to third parties but then the questions comes “HOW to give them secure access?. The question becomes more important when your resources are on the cloud.&lt;/p&gt;

&lt;p&gt;This blog post will showcase a secure solution to answer above question. There are services and features in AWS which can be leveraged to achieve the above goal. Services like IAM, Attribute Based Access Control (ABAC) are much powerful to help in this regard. IAM provides permissions and policies, allows switching between IAM roles, and other features.&lt;/p&gt;

&lt;p&gt;For the scope of this blog, Attribute Based Access Control (ABAC), IAM Role &amp;amp; Switch role functionalities have been used to derive the solution. Here is how the solution looks like-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HUAjzKcl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2w6tculf2r8s60ngxif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HUAjzKcl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2w6tculf2r8s60ngxif.png" alt="Solution architecture — Attribute Based Access Control (ABAC)" width="880" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is Attribute Based Access Control (ABAC) and how it is different from traditional Role Based Access Control (RBAC)?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As per &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html"&gt;AWS documentation&lt;/a&gt; - “Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes. In AWS, these attributes are called tags. You can attach tags to IAM resources, including IAM entities (users or roles) and to AWS resources. You can create a single ABAC policy or small set of policies for your IAM principals. These ABAC policies can be designed to allow operations when the principal’s tag matches the resource tag. ABAC is helpful in environments that are growing rapidly and helps with situations where policy management becomes cumbersome.”&lt;/p&gt;

&lt;p&gt;While RBAC defines permissions based on a person’s job function, known outside of AWS as a role. Within AWS a role usually refers to an IAM role, which is an identity in IAM that you can assume. IAM does include managed policies for job functions that align permissions to a job function in an RBAC model. In IAM, you implement RBAC by creating different policies for different job functions. You then attach the policies to identities (IAM users, groups of users, or IAM roles). As a best practice, you grant the minimum permissions necessary for the job function. This is known as &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege"&gt;granting least privilege&lt;/a&gt;. Do this by listing the specific resources that the job function can access. The disadvantage to using the traditional RBAC model is that when employees add new resources, you must update policies to allow access to those resources.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is what you need for this to get implemented:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;an AWS account for the third party whom you want to give access to. Better to have a dedicated OU for the third party.&lt;/li&gt;
&lt;li&gt;AWS account(s) which you want to give access of. OU strategy may differ per organization&lt;/li&gt;
&lt;li&gt;IAM policies which need to be associated with IAM role for third parties&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Below is what I have created for the purpose of this demo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: OU structure in AWS Organization&lt;/strong&gt;&lt;br&gt;
An OU called ‘OU-3rd-party’ and an AWS Account underneath it, for the third party and another OU called ‘OU-development’ and an AWS account underneath for the development which belongs to the organization want to build their workload on.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Both these are root accounts, hence MUST be restricted from giving access to anybody.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KGMHJk1N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dj1xrsxv399jb358615d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KGMHJk1N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dj1xrsxv399jb358615d.png" alt="AWS Organization structure" width="860" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note there is no Service Control Policy (SCP) on the 3rd-party OU. I’ll explain later why&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6E_Em-Bx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e70t5eix3g80zjndzfni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6E_Em-Bx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e70t5eix3g80zjndzfni.png" alt="Image description" width="794" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create IAM users for third party&lt;/strong&gt;&lt;br&gt;
Create an IAM user for the 3rd party, so that it can assume the IAM role from the development (or any other) AWS account(s) but only when the user and role tags match. The following policy allows a user to assume any role in your account with the &lt;code&gt;3rdPartyAccessRole&lt;/code&gt; name prefix. The role must also be tagged with the same team tag as the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CK-R7hlq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9uyraxxaxfhz8wrrlgfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CK-R7hlq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9uyraxxaxfhz8wrrlgfi.png" alt="IAM Policy called ‘assumerolepolicy-3rdparty’ for third party user" width="880" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1L2DXM8H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sq0r9oibo96hjvofw91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1L2DXM8H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sq0r9oibo96hjvofw91.png" alt="3rd party IAM user with IAM policy attached" width="847" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H-byi7m---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/prbanoadzd9dvomuoir9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H-byi7m---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/prbanoadzd9dvomuoir9.png" alt="3rd party IAM user with tag" width="738" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, login to the Development AWS account, in my case it is &lt;code&gt;836016191915&lt;/code&gt;. An IAM role which needs to be assumed by the third party user is to be created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Create ABAC Policy &amp;amp; IAM role to be assumed by the third party user, in the development account&lt;/strong&gt;&lt;br&gt;
The following policy called &lt;code&gt;3rdparty-access-policy&lt;/code&gt; allows principals to read secrets, start and stop EC2s but only when those resources are tagged with the same key-value pairs as the principal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "secretsmanagerreadonlyforsameteam",
            "Effect": "Allow",
            "Action": [
                "secretsmanager:Describe*",
                "secretsmanager:List*",
                "secretsmanager:Get*"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/access-team": "${aws:PrincipalTag/access-team}"
                }
            }
        },
        {
            "Sid": "secretmanagerlistsecretsforAll",
            "Effect": "Allow",
            "Action": [
                "secretsmanager:GetRandomPassword",
                "secretsmanager:ListSecrets"
            ],
            "Resource": "*"
        },
        {
            "Sid": "allowEC2startstopforsameteam",
            "Effect": "Allow",
            "Action": [
                "ec2:StartInstances",
                "ec2:StopInstances"
            ],
            "Resource": "arn:aws:ec2:*:*:instance/*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/access-team": "${aws:PrincipalTag/access-team}"
                }
            }
        },
        {
            "Sid": "describeEC2forAll",
            "Effect": "Allow",
            "Action": "ec2:DescribeInstances",
            "Resource": "*"
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Following IAM role &lt;code&gt;3rdPartyAccessRole&lt;/code&gt; is created and the &lt;code&gt;3rdparty-access-policy&lt;/code&gt; that was created in the previous step is attached to it. The role also needs to be tagged with the same tag as the resource and the principal tag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qi1_1TAI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch6qxvytiuccvfxkxa7q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qi1_1TAI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch6qxvytiuccvfxkxa7q.png" alt="IAM role in the development account" width="880" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DOD3kbu---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pl8poug726avoog2zjm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DOD3kbu---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pl8poug726avoog2zjm.png" alt="tag on the IAM role in the development account" width="880" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All done now! It is the time to test.&lt;/p&gt;

&lt;p&gt;Login to the AWS Console, with the third party IAM user created. In my case, it is the user &lt;code&gt;3rd-party-vendor-user&lt;/code&gt;. Upon login, it doesn’t have access to any of the resources in its AWS account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yHeAgjV---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hp4g1xqqyid3ssxhmzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yHeAgjV---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hp4g1xqqyid3ssxhmzn.png" alt="No access to S3 service" width="880" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3FB8Zo4P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee3nxwqbtei7h0vjjhd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3FB8Zo4P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee3nxwqbtei7h0vjjhd2.png" alt="No access to EC2 service" width="880" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aq1CzCd1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rswo1nvqwsx2clb79enj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aq1CzCd1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rswo1nvqwsx2clb79enj.png" alt="No permission to access Secrets manager service" width="880" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U6yIMO6d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63kjbsx94nki2i9seqnq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U6yIMO6d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63kjbsx94nki2i9seqnq.png" alt="No permission to access IAM service" width="880" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now lets ask the third party user to assume the role &lt;code&gt;3rdPartyAccessRole&lt;/code&gt; from the development account &lt;code&gt;836016191915&lt;/code&gt;via Switch role functionality OR the switch role link generated in the IAM role can be shared with them -&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ym6yccjp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/elysp0a7m6d79i368vbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ym6yccjp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/elysp0a7m6d79i368vbm.png" alt="Link to Switch role" width="880" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’ll use the Switch role option:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--32MytOVB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/906m47692l139zbtdlpc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--32MytOVB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/906m47692l139zbtdlpc.png" alt="Image description" width="377" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the development account number, the IAM role created and the display name (optional) and click on Switch Role button:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CIBI7RB_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w66nwt6scl00wxf6fuz9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CIBI7RB_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w66nwt6scl00wxf6fuz9.png" alt="Image description" width="880" height="505"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Upon login, click the account information drop down to see additional details. Notice the ‘currently active as’ &amp;amp; ‘Account ID’ fields, it is the IAM role &amp;amp; the AWS Account ID, the 3rd party user assumed. To verify who has assumed the role, see the ‘Signed is as’ field below on the same panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GhlwUeQd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dg3u1vkr6j90lrihfydd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GhlwUeQd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dg3u1vkr6j90lrihfydd.png" alt="Switch role information" width="880" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, lets test the permissions. While in the development account, third party user is allowed to list and get the value of only those secrets which are tagged as same as the user’s tag i.e. &lt;code&gt;access-team = 3rdpartyuser&lt;/code&gt;. The policy also allows the third party user to start and stop only those EC2s which are tagged as same as the user’s tag.&lt;/p&gt;

&lt;p&gt;OK. In the Secrets manager service, there are two secrets stored: First, the ‘demo-secret’ which &lt;strong&gt;doesn’t have&lt;/strong&gt; the tag &lt;code&gt;access-team = 3rdpartyuser&lt;/code&gt; which means the third party user can’t retrieve the password whereas the second secret, &lt;code&gt;secret-3rdparty&lt;/code&gt; is accessible to the third party user. See the setup below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ONdgvlLx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6zfm2whlyfjjafy47mf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ONdgvlLx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6zfm2whlyfjjafy47mf.png" alt="Secret in the ASM which can NOT be accessed by the third party user" width="880" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---HI92Jz8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m76vzbwnob76hlc1g12s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---HI92Jz8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m76vzbwnob76hlc1g12s.png" alt="Secret in the ASM which can be accessed by the third party user" width="880" height="437"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Third party user, as per the permissions, can list the secrets&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XysAcgFg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gsyxhd3vhgdex82m3of3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XysAcgFg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gsyxhd3vhgdex82m3of3.png" alt="Image description" width="880" height="312"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;When trying to access the demo-secret (remember it doesn’t have the same tag as the IAM user) it gets an error:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qaltxpMO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xj66kb19frcl9w5528p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qaltxpMO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xj66kb19frcl9w5528p.png" alt="Image description" width="880" height="445"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now, when accessing the second secret &lt;code&gt;secret-3rdparty&lt;/code&gt;, it is able to retrieve the password successfully since the resource tag matches the principal tag:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I224sd91--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgr5ewuxlta9lxhv0kbk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I224sd91--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgr5ewuxlta9lxhv0kbk.png" alt="Image description" width="880" height="652"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Great! Lets test the EC2 permissions as well. In the Development account, there is one EC2 in stopped state and tagged as &lt;code&gt;access-team = aws-community-builder&lt;/code&gt; which means logged in third party user should not be able to start this EC2.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sUU-DdOr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1cbd27mlg20zvy8yxpzw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sUU-DdOr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1cbd27mlg20zvy8yxpzw.png" alt="EC2 in Development account" width="880" height="426"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Lets see and as expected, it can not Start the instance:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vh0TML6g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jsyb4wm4inafxayxjo1l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vh0TML6g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jsyb4wm4inafxayxjo1l.png" alt="Image description" width="880" height="763"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;They can verify why they can not access as the resource doesn’t belong to them:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vGnj9bpi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5inl4ajjepd2zeuhwi6s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vGnj9bpi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5inl4ajjepd2zeuhwi6s.png" alt="Image description" width="880" height="547"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Well done! :)&lt;/p&gt;

&lt;p&gt;Now, the answer why there is no Deny SCP buy still the third party user doesn’t have permissions to any AWS resources, is because an IAM principal is denied access by default, they must be explicitly allowed to perform an action. Otherwise, they are &lt;em&gt;&lt;strong&gt;implicitly denied&lt;/strong&gt;&lt;/em&gt; access.&lt;/p&gt;

&lt;p&gt;Here, the third party IAM user has explicit Allow in the Identity based policy, for &lt;code&gt;sts:AssumeRole&lt;/code&gt; only, rest of the permissions are implicitly denied. Here is how the policy evaluation logic works:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hqc-AW-j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ednocetvystsip4lp04a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hqc-AW-j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ednocetvystsip4lp04a.png" alt="Image description" width="880" height="407"&gt;&lt;/a&gt; &lt;br&gt;
*source: AWS documentation Policy evaluation logic&lt;/p&gt;

&lt;p&gt;If your use case requires the use of AWS CLI or AWS API to assume that role then you can introduce more security by using the External ID;refer the documentation - &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html"&gt;https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your company uses a SAML-based identity provider (IdP) to manage corporate user identities, you can use SAML attributes for fine-grained access control in AWS. Attributes can include cost center identifiers, user email addresses, department classifications, and project assignments. When you pass these attributes as session tags, you can then control access to AWS based on these session tags. Follow the AWS documentation &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_abac-saml.html"&gt;IAM tutorial: Use SAML session tags for ABAC&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With this blog post, I have showcased how you can provide secure access to the AWS resources in your AWS accounts, to the Third parties which require access to those AWS resources, through AWS Console, using attribute based access control.&lt;/p&gt;




&lt;p&gt;I hope you have learned something from this blog post. If you liked reading this blog post, please clap and follow me for more interesting posts.&lt;/p&gt;

&lt;p&gt;Till then Happy Learning!&lt;/p&gt;

&lt;p&gt;Be AWSome! Be Happy! :)&lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Power of AWS Organization ID in controlling access to AWS resources</title>
      <dc:creator>Somesh Srivastava</dc:creator>
      <pubDate>Sat, 09 Apr 2022 13:20:09 +0000</pubDate>
      <link>https://dev.to/aws-builders/power-of-aws-organization-id-in-controlling-access-to-aws-resources-jc4</link>
      <guid>https://dev.to/aws-builders/power-of-aws-organization-id-in-controlling-access-to-aws-resources-jc4</guid>
      <description>&lt;p&gt;If you are using a single or multiple AWS Accounts then you may already be aware of the AWS Organizations service. It is a service which is used to centrally manage the AWS Accounts. It gives a unique ID called ‘Organization ID’ per master AWS Account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ssymdybqei0htslfqm1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ssymdybqei0htslfqm1.png" alt="AWS Organizations"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Different companies use different strategy to use and manage the AWS Accounts. AWS Organizations provide several features, which not only helps managing the AWS Accounts but also gives power to central cloud COE/Ops teams restricting permissions, apply security guardrails, managing cost across AWS Accounts within one AWS Organization.&lt;/p&gt;

&lt;p&gt;One of the ways to restrict access to only certain AWS services &amp;amp; principals is using the policies. AWS offers different &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies" rel="noopener noreferrer"&gt;policy types&lt;/a&gt;, but two most commonly &amp;amp; widely used policies are Identity-based policies and Resource-based policies.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As per official &lt;a href="//As%20per%20official%20AWS%20documentation,%20Identity-based%20policies%20are%20JSON%20permissions%20policy%20documents%20that%20control%20what%20actions%20an%20identity%20(users,%20groups%20of%20users,%20and%20roles)%20can%20perform,%20on%20which%20resources,%20and%20under%20what%20conditions%20while,%20Resource-based%20policies%20are%20JSON%20policy%20documents%20that%20you%20attach%20to%20a%20resource%20such%20as%20an%20Amazon%20S3%20bucket."&gt;AWS documentation&lt;/a&gt;, Identity-based policies are JSON permissions policy documents that control what actions an identity (users, groups of users, and roles) can perform, on which resources, and under what conditions while, Resource-based policies are JSON policy documents that you attach to a resource such as an Amazon S3 bucket.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While using the resource based policies, AWS provides ‘condition keys’, which can be used to apply more granular control over actions allowed, to be performed by AWS service or principal.&lt;/p&gt;

&lt;p&gt;The condition key — &lt;strong&gt;aws:PrincipalOrgID&lt;/strong&gt; is very useful in this context. It verifies the organization id, in the AWS Organization, belongs to the principal who is making the request to use the resource such as S3 bucket, VPC endpoint, KMS keys etc. One of the examples is, restricting access of the S3 bucket to the principals belong to one specific AWS Organization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fks3hp8n5neubrw68jfyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fks3hp8n5neubrw68jfyf.png" alt="S3 bucket policy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above S3 bucket policy explains that, all the users from the member AWS Accounts under Organization ID ‘o-fgxx1zr’ are allowed to put objects in the mentioned S3 bucket resource. Here the aws:PrincipalOrgID under the condition block will be matched against the key &amp;amp; value in request context. If it is evaluated as true, then only the permission will be granted to take mentioned actions on the given resource(s).&lt;/p&gt;

&lt;p&gt;Another good use of the aws:PrincipalOrgID is with the &lt;strong&gt;policy attached to VPC Endpoints&lt;/strong&gt;, I have used it in many of the scenarios. Most of the big enterprises whether it is Financial service or any other, use the controlled AWS environment to make it secure.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;One of the examples from the actual customer use case is, where customer wanted to allow internal AWS accounts only (belong to customer’s organization) to retrieve &amp;amp; update secrets from the central Secrets Manager store.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The solution provided was to &lt;strong&gt;1&lt;/strong&gt;. create a secret in AWS Secrets Manager and &lt;strong&gt;2&lt;/strong&gt;. attach a resource policy to the Secret which allows users to retrieve &amp;amp; update secrets only when the request comes through the VPC endpoint — vpce-03aa191527a0d1dfc&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffq3bxvg7lvit5jxd8i3g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffq3bxvg7lvit5jxd8i3g.png" alt="Secrets Manager — Secret"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5v3f4pbblohpljr7w512.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5v3f4pbblohpljr7w512.png" alt="Secrets Manager — Resource-based policy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt;.Next step was to, create a VPC Endpoint policy for AWS Secrets Manager service, so that service can be accessed from within a VPC only, (since this VPC was acting as a Hub VPC and principals from the other AWS Accounts were able to access this Hub VPC) and attach a resource-based policy which allows principals from the AWS Accounts but only if they are a member of Organization ID — o-fg6xxx1zr.&lt;/p&gt;

&lt;p&gt;Below policy Deny mentioned permissions on any Secrets from any Principal if they don’t belong to the member AWS account falls under Organization ID — ‘o-fgxxx1zr’.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd58cbzbsuct5ml7zr7a7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd58cbzbsuct5ml7zr7a7.png" alt="Secrets manager VPC endpoint policy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use the aws:PrincipalOrgID in any resource-based policy to control access (if supported) to that resource. It is specially useful when you have 100s of 1000s of AWS Accounts to manage.&lt;/p&gt;

&lt;p&gt;In this blog post, I have shown how you can control access of resources to the member AWS Accounts of an AWS Organization with the help of the condition key — aws:PrincipalOrgID.&lt;/p&gt;

&lt;p&gt;Recently, AWS announces support of PrinciplaOrgID in Lambda function resource-based policies, read it &lt;a href="https://aws.amazon.com/about-aws/whats-new/2022/03/aws-lambda-principalorgid-resource-policies/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. A blog is also available &lt;a href="https://aws.amazon.com/blogs/compute/using-organization-ids-as-principals-in-lambda-resource-policies/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hope this blog post will help you securing your resources. I’ll write another blog on another real world use case very shortly.&lt;/p&gt;

&lt;p&gt;Till then Happy Learning!&lt;/p&gt;

</description>
      <category>security</category>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Event-Driven serverless architecture to automatically remediate security findings</title>
      <dc:creator>Somesh Srivastava</dc:creator>
      <pubDate>Sat, 09 Apr 2022 12:55:36 +0000</pubDate>
      <link>https://dev.to/aws-builders/event-driven-serverless-architecture-to-automatically-remediate-security-findings-o8g</link>
      <guid>https://dev.to/aws-builders/event-driven-serverless-architecture-to-automatically-remediate-security-findings-o8g</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QAjWwvRU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cepy4rrjbg6fknohbrp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QAjWwvRU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cepy4rrjbg6fknohbrp.png" alt="Security remediation framework — Architecture" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We all love to design, build and deploy on AWS. But as the cloud adoption is growing, the security concerns in and around the cloud is also growing. We see and hear about the security breaches and incidents very often now a days.&lt;/p&gt;

&lt;p&gt;Having spent a good amount of time in migrating, building and deploying applications on AWS for multiple customers, I can say that organizations take their cloud security very seriously, specially the financial firms. I’ve seen the most strict and controlled AWS environments, the best implementations of DevOps pipelines, maturity level of firms to integrate their internal processes into the AWS environment and the security of cloud resources through extensive preventive and detective controls.&lt;/p&gt;

&lt;p&gt;If you are owing an AWS platform in your firm and looking for a fully automated security solution or do not want to spend huge money in buying the managed security solution from vendors; then this blog will help you implement the security solution in-house no matter how big or small your firm is.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In this bog, I’ll walk you through the solution, based on the event-driven architecture, to detect and remediate the security findings automatically using AWS managed security services.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The logic behind this solution is to collect the security findings at central place, so making it easy to detect, capture and respond; irrespective of the number of AWS Accounts being used.&lt;/p&gt;

&lt;p&gt;Next question is how to implement it?&lt;/p&gt;

&lt;p&gt;In AWS, there are services which work on master-member model to centralize logs/findings/events, few example are AWS Security Hub, AWS Guard Duty, Config etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/guardduty/features/"&gt;Amazon GuardDuty&lt;/a&gt; — a threat detection service which continuously monitors for malicious activity and capable of analyzing tens of billions of events across multiple AWS data sources, such as AWS CloudTrail event logs, Amazon Virtual Private Cloud (VPC) flow Logs, and DNS query logs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/security-hub/features/"&gt;AWS Security Hub&lt;/a&gt; — a cloud security posture management service that performs automated, continuous security best practice checks against your AWS resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/config/"&gt;AWS Config&lt;/a&gt; — This service enables you to assess, audit, and evaluate the configurations of your AWS resources. Config continuously monitors and records your AWS resource configurations and allows you to automate the evaluation of recorded configurations against desired configurations.&lt;/p&gt;

&lt;p&gt;Let’s take an assumption that there are 10 AWS Accounts, where the workloads are running, let’s call them ‘AWS Solution' accounts.&lt;/p&gt;

&lt;p&gt;We then need one AWS account which will work as a central place to collect the security findings and events, let’s call it 'Core-compliance' account.&lt;/p&gt;

&lt;p&gt;We know that every action that is performed in AWS is basically an API call and every action emits an event — a signal that a system’s state has changed. These events get collected in the event bus in &lt;a href="https://aws.amazon.com/eventbridge/"&gt;Amazon Event Bridge&lt;/a&gt; service.&lt;br&gt;
I have enabled AWS GuardDuty as member, in each of the AWS Solution accounts where are Master can either be your core-compliance AWS Account or your root/master AWS account, because AWS Security Hub will used to detect the findings from Amazon GuardDuty.&lt;/p&gt;

&lt;p&gt;Since, Security Hub is integrated with AWS services like IAM Access Analyzer, Macie, Firewall Manager, Amazon Inspector etc. I have enabled Security Hub as member in each of the AWS Solution accounts and as Master in the central core-compliance AWS Account, hence with this setup, all the Security Hub findings will be pushed &amp;amp; collected at a central place.&lt;/p&gt;

&lt;p&gt;I have also enabled IAM Access Analyzer, which helps identifying the resources in organization and accounts, such as Amazon S3 buckets or IAM roles, shared with an external entity. Findings from IAM Access Analyzer will also be sent to Security Hub member which eventually goes to master Security Hub.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;You might be aware that Security Hub processes these findings using a standard findings format called the AWS Security Finding Format (ASFF).&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To enable AWS Config, I have used the AWS Config Conformance pack. &lt;em&gt;The Conformance pack is a collection of AWS Config rules and remediation actions&lt;/em&gt; that can be easily deployed as a single entity in an account and a Region or across an organization in AWS Organizations. More details are available &lt;a href="https://docs.aws.amazon.com/config/latest/developerguide/conformance-packs.html"&gt;here&lt;/a&gt;. AWS provides ready-made &lt;a href="https://docs.aws.amazon.com/config/latest/developerguide/conformancepack-sample-templates.html"&gt;sample conformance pack&lt;/a&gt; which can be deployed easily.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7qBAOVm9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cv6d4pwr1b9suyfy2dx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7qBAOVm9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cv6d4pwr1b9suyfy2dx.png" alt="AWS Config — conformance pack" width="880" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Security Hub doesn’t get findings from AWS Config by default, hence a solution needs to be in place to send Config rule evaluations as findings into Security Hub, use the official AWS blog here, this will import AWS Config rules evaluations as findings in Security Hub in the ASFF format which Security Hub uses.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---6jQ8RIZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zbg7zhnqiqeva2w6jwl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---6jQ8RIZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zbg7zhnqiqeva2w6jwl.png" alt="Image description" width="802" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I have all the findings from all 10 AWS Accounts into the member Security Hub and eventually into the Security Hub (Master).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default, Security Hub automatically sends all new findings and all updates to existing findings to EventBridge as &lt;strong&gt;Security Hub Findings — Imported events&lt;/strong&gt;. Please refer &lt;a href="https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-cwe-integration-types.html"&gt;here&lt;/a&gt; for more details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The security findings do not get detected instantly, it take few minutes to reflect in the services like GuardDuty, Security Hub or AWS Config but I wanted to capture some high severity events in near real time such as someone tries to attach internet gateway in AWS Account, or someone has applied unrestricted S3 bucket policy, or someone is adding 0.0.0.0/0 as Inbound rule in a security group.&lt;/p&gt;

&lt;p&gt;As said earlier, every actions in AWS is an API call and every action generates events, &lt;em&gt;hence an event pattern is created to capture all the events&lt;/em&gt; from the solution account with target set as the ARN of the default event bus of core-compliance AWS Account. These events takes no time to be available in Event Bridge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PlNmajMy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1fvp1pjsszdmopiog48.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PlNmajMy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1fvp1pjsszdmopiog48.png" alt="event pattern to capture all Events of solution AWS account" width="726" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hirSWcwQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egar5elhjpskjymd6hxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hirSWcwQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egar5elhjpskjymd6hxg.png" alt="Event rule target — Event bus of core-compliance account" width="740" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I have all the findings generating out of different Security services, all the events generating from actions from all AWS Solution accounts, at one place.&lt;/p&gt;

&lt;p&gt;Next step is, how do we capture these events? The answer is using the Event patterns in Event Bridge service e.g. to capture the event of an action when someone adds internet gateway to the VPC; for that the custom event pattern looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YC0MR8N2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0vnux4g9td8f8zv15dm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YC0MR8N2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0vnux4g9td8f8zv15dm.png" alt="custom event pattern for capturing event from action" width="457" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m_zF10Cm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15jy03vxir2kefsh4zhp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m_zF10Cm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15jy03vxir2kefsh4zhp.png" alt="custom event pattern for capturing event from Security Hub findings" width="567" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that the event is captured, it is now time to take action. I have used a fleet of lambda functions to do this job - code that reads the event, retrieves the AWS account details from it, then gains access into the AWS account and finally takes action to do what it is supposed to do; &lt;em&gt;in above scenario detaching the internet gateway from the VPC&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Wondering how does lambda gained access to the impacted AWS Account? Answer is &lt;em&gt;by assuming an IAM Role, which is already deployed in each of the AWS Solution accounts&lt;/em&gt;, for Lambda to assume.&lt;/p&gt;

&lt;p&gt;Now the last step is, to notify the AWS account owner or a contacts DL, if configured for an account, which can be used to send the Email notification to, regarding the remediation which took place in their AWS Account. The best way to send notifications is by using AWS SNS service.&lt;/p&gt;

&lt;p&gt;With every custom event pattern along with Lambda as a target, SNS topic as a target which sends the notification to the owner/DL.&lt;/p&gt;

&lt;p&gt;That’s all !! It’s done! :)&lt;/p&gt;

&lt;p&gt;You have a security framework in place which monitors AWS accounts for any unwanted activities, takes action and notifies you that too automatically. A complete peace of mind ☺️ isn’t it?&lt;/p&gt;

&lt;p&gt;You can improve this framework, by introducing more services such as Amazon Detective, Macie, Audit Manager and also integrate it with change management tools such as JIRA, Service Now etc, or deploy the framework in all AWS regions, to make it more powerful.&lt;/p&gt;

&lt;p&gt;Hope this blog will help you in building the security framework which automatically remediates the security findings. Feel free to put your questions in the comment section, I’ll try my best to answer those at the earliest.&lt;/p&gt;

&lt;p&gt;Happy Learning!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>security</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
