<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rohan Mode on Medium]]></title>
        <description><![CDATA[Stories by Rohan Mode on Medium]]></description>
        <link>https://medium.com/@rohan.modhemm?source=rss-6919623256da------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zCjxdz36w2IVJgVscMcwfQ.jpeg</url>
            <title>Stories by Rohan Mode on Medium</title>
            <link>https://medium.com/@rohan.modhemm?source=rss-6919623256da------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:27:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rohan.modhemm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Case Study: Evaluation & Enforcement of Compliance with AWS Config and Remediation using SSM…]]></title>
            <link>https://medium.com/@rohan.modhemm/case-study-evaluation-enforcement-of-compliance-with-aws-config-and-remediation-using-ssm-3dc983139869?source=rss-6919623256da------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dc983139869</guid>
            <dc:creator><![CDATA[Rohan Mode]]></dc:creator>
            <pubDate>Wed, 29 Mar 2023 21:55:28 GMT</pubDate>
            <atom:updated>2023-03-29T21:55:28.427Z</atom:updated>
            <content:encoded><![CDATA[<h3>Case Study: Evaluation &amp; Enforcement of Compliance with AWS Config and Remediation using SSM Automation</h3><p>In this blog, we are going to cover the case study on enforcing compliance with AWS Config and remediating the resources with Systems Manager Automation to achieve continuous compliance.</p><p>In today’s fast-paced business environment, organizations strive to provide customers with exceptional digital experiences while also staying ahead of the competition. To achieve this, companies are constantly making changes to their technology environments and applications, which can create a risk of misconfiguration. Misconfiguration can lead to malfunctions or security issues, which can be detrimental to the organization’s reputation and financial stability.</p><p>Let’s take a basic example to understand this, say that a financial institution is launching a new online banking application to provide customers with easy access to their accounts and transactions. For effective and secure deployment the institution uses a continuous integration and deployment (CI/CD) pipeline to automate the process of building, testing, and deployment of applications to their cloud environment on AWS. However, during the deployment process, a misconfiguration occurs, and sensitive customer data is inadvertently exposed to unauthorized users.</p><p>Therefore, we want the configuration of our AWS resources to be continuously assessed, audited, and evaluated against compliance requirements, and any non-compliant resources should be automatically remediated to achieve continuous compliance. This is where AWS Config comes into the picture, providing a robust foundation for the enterprise to flag all misconfigurations, compliant and non-compliant resources in their infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*n6FWVsFOvm9fUeObFS1Zig.jpeg" /></figure><p>The AWS Config Service is a namespace that includes two independent resources — the Configuration Resource and the Compliance Resource. The Configuration Resource provides a point-in-time snapshot of the configuration of AWS resources, including contextual attributes such as account, region, availability zone, and event timestamps. It provides a detailed view of the current state of AWS resources in an account and is useful for monitoring changes in the configuration of these resources over time.</p><p>In contrast, the Compliance Resource focuses on the compliance status of resources and their own context. It includes the rule, account, and event timestamps, and provides information about whether a specific resource is compliant with a particular rule or policy. The Compliance Resource is helpful for tracking compliance status changes over time and identifying patterns in non-compliant resources. By using AWS Config, users can monitor their AWS environment for changes, track compliance status changes, and ensure that their resources remain in compliance with defined rules and policies.</p><p><strong>Topics we will cover :</strong></p><ul><li><a href="#ebeb">AWS Config</a></li><li><a href="#ad83">How Config Works?</a></li><li><a href="#ef9d">Administrative Features</a></li><li><a href="#a33e">Non-Compliant Resources with Remediation Workflow</a></li><li><a href="#e1dc">Step by Step Evaluation of Compliance with AWS Config and Remediation using SSM Automation</a></li><li><a href="#83cb">Frequently Asked Questions (FAQ’s)</a></li></ul><h3>AWS Config</h3><ul><li>AWS Config is a service that enables users to assess, audit, and evaluate the configurations of AWS resources. It provides a detailed view of the current state of the resources, changes made to them, and how they are related to one another over time.</li><li>AWS Config continuously monitors and records the configuration changes of resources in an AWS account, and it provides users with a complete inventory of their AWS resources. It can also help users comply with industry standards and regulations by providing automated compliance checks and enabling users to create their custom rules.</li><li>AWS Config can be used to track changes to resources, troubleshoot issues, and assess resource compliance. It also supports integration with other AWS services such as Amazon CloudWatch and AWS CloudTrail, making it easier to monitor and analyze resource configurations.</li></ul><h3>How Config Works?</h3><ul><li>AWS Config is a service that includes a feature called Configuration Recorder. This feature enables the detection of changes in the configurations of AWS resources and captures these changes as configuration items.</li><li>If you set up AWS Config using the console or the AWS CLI, the Configuration Recorder is automatically created and started for you. By default, the Configuration Recorder records all supported resources in the region where AWS Config is running.</li><li>You also have the option to create a customized Configuration Recorder that only records the types of resources that you specify.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OJXpYP6qrQEI7M8YnUWHKw.png" /><figcaption>AWS Config Working</figcaption></figure><ul><li>Whenever a change is detected in a supported resource type that the Configuration Recorder is recording, AWS Config creates a Configuration Item. A Configuration Item represents a point-in-time view of the various attributes of the supported AWS resource. For instance, if the Configuration Recorder is recording an S3 bucket, a configuration item is created whenever a bucket is created, updated, or deleted.</li><li>When changes to the recorded resources occur, AWS Config sends notifications and updates the configuration states via the AWS Config delivery channel to the Amazon S3 bucket that you specified when setting up your Delivery Channel.</li><li>What AWS Config delivers to the S3 bucket is referred to as a Configuration Snapshot. A Configuration Snapshot is a collection of Configuration Items for the supported resources that exist in your account. These Configuration Snapshots provide a complete picture of the resources being recorded and their configurations.</li></ul><h3>Administrative Features</h3><ul><li>Centrally manage Multiple Accounts, Multi-Region data aggregation</li><li>Identify non-compliant resources with the AWS Config dashboard</li><li>Continuously evaluate configurations with pre-built or custom rules</li><li>Manage compliance of your AWS resource configuration at scale via Conformance packs</li><li>Continuously view and monitor the resource inventory and configuration history of third-party resources</li></ul><h3>Non-Compliant Resources with Remediation Workflow</h3><ul><li>Remediation of non-compliant resources is important because it helps to ensure that a system or organization is functioning in accordance with established standards or regulations.</li><li>Non-compliant resources can pose security risks, cause disruptions in operations, and result in legal or financial penalties. By identifying and remediating non-compliant resources, organizations can reduce these risks and improve their overall security posture.</li><li>Let’s take a basic example to understand this, say a company has a cloud-based infrastructure on AWS that includes multiple Amazon RDS database instances used to store sensitive data. The company has a policy that requires all RDS instances to be encrypted using AWS Key Management Service (KMS) and to have automated backups enabled. However, AWS Config flagged that one of the RDS instances is not encrypted with KMS, and automated backups are not enabled. This indicates non-compliance with the company’s security policy and poses a serious security risk.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*ZNR0q5FQJgfE6LQXaqjytg.jpeg" /><figcaption>AWS Config Remediation Workflow</figcaption></figure><ul><li>Remediation in this case could involve configuring the RDS instance to use KMS encryption and enabling automated backups. This could be automated by creating a CloudWatch events rule to trigger a Lambda function in which the remediation action for the rule has been defined. This can also be achieved via AWS Systems Manager Automation which in turn triggers a lambda function with remediation actions achieving the same outcome.</li></ul><h3>Step by Step Evaluation of Compliance with AWS Config and Remediation using SSM Automation</h3><p>Step 1 : Enable Config Recorder<br>Step 2 : Create an IAM Role<br>Step 3 : Launch an EC2 Instance &amp; Assign IAM Role<br>Step 4 : Install Apache Server<br>Step 5 : Setup Software Inventory in AWS Systems Manager<br>Step 6 : Add a Config Rule for blacklist non-compliant applications<br>Step 7 : Add Remediation Action for the rule<br>Step 8 : Test and Remediate the Config Rule <br>Step 9 : Remove Apache Server and Test Compliance</p><h3>Step 1 : Enable Config Recorder</h3><ol><li>On AWS Management Console, under Services search for <strong>Config</strong>. Here, you will see the config console click on <strong>Get started</strong> to setup config for your account for a specific region. Now on this page leave general settings default and under <strong>Delivery method</strong> select <strong>create a bucket</strong> and provide the bucket name, make sure the bucket name is <strong>unique</strong> and click on <strong>Next</strong>. Under <strong>Rules</strong> leave everything default and click on <strong>Next</strong>. Review all the configurations and click on <strong>Confirm</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZYVCGBWNJwOwaqvUr-h8rw.gif" /></figure><h3>Step 2 : Create an IAM Role</h3><ol><li>Under Services search for <strong>IAM</strong> and open it in a new tab. Now under <strong>Roles </strong>click on <strong>Create Roles</strong>. Under <strong>Trusted Entity Type</strong> select AWS service and select <strong>EC2</strong> as the <strong>use case</strong>. Now click on <strong>Next</strong>. Here search for the following <strong>predefined IAM role</strong> and add it.</li></ol><pre>AmazonEC2RoleforSSM</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yL650gR8SuHZzg3avdcrHQ.gif" /></figure><h3>Step 3 : Launch an EC2 Instance &amp; Assign IAM Role</h3><ol><li>Under Services search for <strong>EC2</strong> and open it in a new tab. Click on <strong>Launch instances</strong>. Provide the name for the instance and click on <strong>Add additional tags </strong>and add tags with Key as <strong>Env</strong> and Value as <strong>DevTest</strong>, further under <strong>Resource types</strong> add <strong>Volume</strong> along with Instances. Select <strong>Amazon Linux 2023 AMI</strong>. Select the <strong>Key-pair</strong> and <strong>security group</strong>. Make sure you add the <strong>IAM role</strong> under<strong> </strong>Advance details<strong> </strong>that we recently created under the <strong>IAM instance Profile </strong>and click on <strong>Launch instance</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7Ga8H6oRHVdmsGQqxsCJw.gif" /></figure><h3>Step 4 : Install Apache Server</h3><ol><li>Once the instance has been launched successfully, select it and click on Connect. Now on the terminal execute the following commands.</li></ol><pre>sudo yum install httpd<br>sudo systemctl enable httpd<br>sudo systemctl start httpd<br>sudo systmectl status httpd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*skQy5-Ll3Flz0ph9KuNTAQ.gif" /></figure><h3>Step 5 : Setup Software Inventory in AWS Systems Manager</h3><ol><li>Under Services, search for <strong>SSM</strong> and click on Systems Manager to open it. Now on the left panel under <strong>Node Management</strong> click on <strong>Fleet Manager</strong>. Here you shall see your recently launched instance select it and under the <strong>Account Management</strong> dropdown select setup inventory, now under targets select specifying a tag and provide the tags Key as <strong>Env </strong>and Value as <strong>DevTest</strong>. Let everything default and click on <strong>Setup inventory</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LjhbQEfSKynjgRZ9pmNl8Q.gif" /></figure><p>2. Now under <strong>Fleet Manager</strong> select <strong>Inventory</strong>, scroll down and you shall see your instance click on it. Under Inventory, you shall see the entire list of applications installed on your instance, search for <strong>Name: Equal: httpd</strong> and you shall see the httpd service present in the inventory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0U7eSkyZRZI7ndJNZcFlA.gif" /></figure><h3>Step 6 : Add a Config Rule for blacklist non-compliant applications</h3><ol><li>Under Services, search for Config and open it. On the Config dashboard click on Rules. Now click on Add Rule, under <strong>AWS Managed Rules</strong> search for <strong>blacklist</strong> and select the following rule and click on Next. Further, leave everything default and under parameters provide the value as <strong>httpd</strong> for key <strong>applicationNames, </strong>provide the tags as <strong>Env </strong>and<strong> DevTest </strong>and click on <strong>Next</strong>. Further, Review and click on <strong>Add rule</strong>.</li></ol><pre>Rule - ec2-managedinstance-applications-blacklisted</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TR1njoXnSI0cb7kfsS3Apg.gif" /></figure><h3>Step 7 : Add Remediation Action for the rule</h3><p>1. Once the rule has been added successfully select it and under actions click on. Under select remediation action select <strong>Manual remediation</strong>. Under Remediation action details search for <strong>AWS:StopEC2Instance</strong> and select it. Under the <strong>Resources ID parameter</strong> select <strong>InstanceID</strong> and click on <strong>Save changes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4ZFnljn_1_DZ0sXRm1_tw.gif" /></figure><h3>Step 8 : Test and Remediate the Config Rule</h3><ol><li>Now select the rule and you shall see under the <strong>Resources in scope</strong> is your instance which we created earlier. Select the instance and click on <strong>Remediate</strong>. Now back on the EC2 console, you shall see that your instance is in a <strong>Stopping state</strong>, which means our remediation for the rule works seamlessly.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71t9a9k7uTlTFkW0TqiyAA.gif" /></figure><h3>Step 9 : Remove Apache Server and Test Compliance</h3><ol><li>Now we shall test for compliance, for which we will start the instance and connect to it. Now execute the following commands to <strong>remove httpd</strong> service/application from your instance.</li></ol><pre>sudo yum list installed | grep httpd<br>sudo yum remove httpd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U6hfz_LreI_DBulTyYv1kA.gif" /></figure><p>2. Once you are done with this wait for 30 minutes as the <strong>SSM Inventory</strong> updates every <strong>30 minutes</strong>. Now back on the Config console, you shall see our rule is showing <strong>Compliant</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfGWNvB5Jj5PMbtN8O5zng.gif" /></figure><h3>Frequently Asked Questions (FAQ’s)</h3><ol><li>When should I use AWS Config rules versus conformance packs?<br>Yes. Conformance packs are intended to simplify compliance management and reporting at scale when you are managing several accounts. Conformance packs are designed to provide aggregated compliance reporting at the pack level and immutability. This helps the managed AWS Config rules and remediation documents within the conformance pack to not be modified or deleted by the individual member accounts of an organization.</li><li>How are AWS Config and AWS Config rules related to AWS Security Hub?<br>AWS Security Hub is a security and compliance service that provides security and compliance posture management as a service. It uses AWS Config and AWS Config rules as its primary mechanism to evaluate the configuration of AWS resources. AWS Config rules can also be used to evaluate resource configuration directly. AWS Config rules are also used by other AWS services, such as AWS Control Tower and AWS Firewall Manager.</li><li>What is multi-account, multi-Region data aggregation?<br>Data aggregation on AWS Config helps you aggregate AWS Config data from multiple accounts and Regions into a single account and a single Region. Multi-account data aggregation is useful for central IT administrators to monitor compliance for multiple AWS accounts in the enterprise.</li></ol><h3>Conclusion</h3><p>Here, we have successfully understood the working, features, and practical implementation of Evaluation &amp; Enforcement of Compliance with AWS Config and Remediation using SSM Automation.</p><h3>Related Posts</h3><p><a href="https://www.linkedin.com/posts/rohan-mode_case-study-detecting-and-scanning-container-activity-6989725102821048320-lgFn?utm_source=share&amp;utm_medium=member_desktop">Detecting and Scanning Container Vulnerabilities with Amazon Inspector</a><br><a href="https://www.linkedin.com/posts/rohan-mode_case-study-store-and-retrieve-secrets-using-activity-6824340154275123201-HwBq">Store and Retrieve Secrets using AWS Secrets Manager</a><br><a href="https://www.linkedin.com/posts/rohan-mode_case-study-integrate-aws-single-sign-on-activity-6848755630132486144-US3R?utm_source=share&amp;utm_medium=member_desktop">Integrate AWS Single Sign-On (SSO) with Azure Active Directory</a><br><a href="https://www.linkedin.com/posts/rohan-mode_amazon-dynamodb-fast-and-scalable-nosql-activity-6769621764562542592-ims7">Amazon DynamoDB: Fast And Scalable NoSQL Database</a><br><a href="https://www.linkedin.com/posts/rohan-mode_blue-green-deployments-using-elastic-beanstalk-activity-6772796190598668288-UKTX">Blue-Green Deployments Using Elastic Beanstalk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dc983139869" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Case Study: Detecting and Scanning Container Vulnerabilities with Amazon Inspector]]></title>
            <link>https://medium.com/@rohan.modhemm/case-study-detecting-and-scanning-container-vulnerabilities-with-amazon-inspector-7f7a14742949?source=rss-6919623256da------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f7a14742949</guid>
            <dc:creator><![CDATA[Rohan Mode]]></dc:creator>
            <pubDate>Sat, 22 Oct 2022 22:56:29 GMT</pubDate>
            <atom:updated>2022-10-22T22:56:29.608Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, we are going to cover the case study on Amazon Inspector to test the automated detection and scanning capabilities for container images.</p><p>With the emerging use of micro-service architectures to deliver better fault isolation and resilient applications use of containers is increasing along with risks tied to it. Applications that are present either in the staging or production environments may have certain vulnerabilities that can be exploited by attackers and used to cause greater damage.</p><p>Let’s take a basic example to understand this, say we are using a misconfigured caching server that is deployed in our staging environment, one of our engineers mistakenly left the port open so that anyone outside of the VPC can access it. Such misconfigurations increase the temptation for the attackers to exploit the systems, we may find later that the caching server has gone rogue and started attacking other services. With this, the best supposition to consider is that the server is no longer trusted and other systems in the same network might have been compromised.</p><p>To avoid such situations we must always test and audit our systems to ensure overall security posture. This is where Amazon Inspector comes into picture providing a complete vulnerability scanning producing a detailed list of security findings prioritized by level of severity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*BGupEaEiZclx6doN8i7Eeg.png" /></figure><p>Amazon Inspector is an automated security assessment service that helps improve the security and compliance of applications deployed on AWS. Amazon Inspector automatically assesses applications for exposure, vulnerabilities, and deviations from best practices.</p><p><strong>Topics we will cover :</strong></p><ul><li><a href="#bce2">Amazon Inspector</a></li><li><a href="#3170">How Inspector Works?</a></li><li><a href="#5be0">Administrative Features</a></li><li><a href="#b480">Step by Step Detection and Scanning Container Vulnerabilities with Amazon Inspector</a></li><li><a href="#7140">Frequently Asked Questions (FAQ’s)</a></li></ul><h3>Amazon Inspector</h3><ul><li>Amazon Inspector is basically a security service created in a way to analyze AWS resources to identify potential security issues.</li><li>By creating templates and setting goals, you can easily assess the safety of your AWS resources. The evaluation process scans various items, analyzes all collected data, and compares it to the set of security rules specified in the template. The result is a detailed report showing possible security issues on your resources and what to do to fix them based on priority.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*7073Y_46L3_smdQJTJ2Zgw.png" /><figcaption><strong>Scanning for Specific Compute Resources</strong></figcaption></figure><ul><li>Amazon Inspector continuously scans your Amazon EC2 instances and Amazon ECR container images for software vulnerabilities and unintended network exposure.</li><li>Further we will understand step by step implementation of Amazon Inspector to detect and scan vulnerabilities for Container images.</li></ul><h3>How Inspector Works?</h3><ul><li>The updated version of Amazon Inspector features a simplified one-click enablement continuous and automated scanning multi-account with AWS organizations and uses the widely adopted Systems Manager SSM agent in place of the older standalone classic agent.</li><li>Once Enabled Inspector discovers workloads automatically and provides you with real-time environment coverage details and view of consolidated findings across accounts and resources you will receive near real-time finding notifications.</li><li>These findings are prioritized and you’ll see a contextualized inspector risk score from there you can start your analysis and kick off automated triage.</li><li>Inspector provides Management APIs for comprehensive programmatic access to your amazon inspector account and resources. Also you have access to detailed findings in Amazon Event Bridge and through AWS Security Hub Integrations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EpA5rSlkrJDd4GbH3DD9QQ.png" /><figcaption><strong>Amazon Inspector Working</strong></figcaption></figure><h3>Administrative Features</h3><ul><li>Centrally manage Multiple Accounts with AWS Organizations</li><li>Continuously scan for vulnerabilities and network exposure</li><li>Assess vulnerabilities accurately with the Amazon Inspector Risk score</li><li>Identify high-impact findings with the Amazon Inspector dashboard</li><li>Monitor and process findings with other services and systems</li><li>Manage your findings using customizable views</li></ul><h3>Step by Step Detection and Scanning Container Vulnerabilities with Amazon Inspector</h3><p>Step 1 : Create an IAM Role<br>Step 2 : Create an ECR Repository<br>Step 3 : Launch an EC2 Instance<br>Step 4 : Install Docker and pull vulnerable image<br>Step 5: Push Docker Image on ECR Repository<br>Step 6: Validate status of SSM Agent<br>Step 7: Enable Amazon Inspector<br>Step 8: Inspector Findings</p><h3>Step 1 : Create an IAM Role</h3><ol><li>On AWS Management Console, under Services search for <strong>IAM</strong> and open it in new tab. Now under <strong>Roles </strong>click on <strong>Create Roles</strong>. Under <strong>Trusted Entity Type</strong> select AWS service and select <strong>EC2</strong> as the <strong>use case</strong>. Now click on <strong>Next</strong>. Here search for following <strong>two predefined IAM roles</strong> and add them.</li></ol><pre>AmazonEC2ContainerRegistryFullAccess<br>AmazonSSMManagedInstanceCore</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJhZDmE1lTf0nq27RV-N8w.gif" /></figure><h3>Step 2 : Create an ECR Repository</h3><ol><li>Under Services search for <strong>ECR</strong> and open it in new tab. Now under <strong>Create a repository</strong> click on <strong>Get started</strong>. Provide the <strong>Repository name</strong> and click on <strong>Create repository</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kNzk2D2uwJTD8stu87UFDg.gif" /></figure><h3>Step 3 : Launch an EC2 Instance</h3><ol><li>Under Services search for <strong>EC2</strong> and open it in new tab. Click on <strong>Launch instances</strong>. Select <strong>Amazon Linux 2 AMI</strong>. As we require <strong>SSM-agent</strong> to execute inspector scans it is pre-installed on Amazon Linux 2 AMI. Select the <strong>Key-pair</strong> and <strong>security group</strong>. Make sure you add the <strong>IAM role</strong> that we recently created under <strong>IAM instance Profile </strong>and click on <strong>Launch instance</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fu8iHpg70hzb2DtEypjNZg.gif" /></figure><h3>Step 4 : Install Docker and pull vulnerable Image</h3><ol><li>Select the <strong>EC2 instance</strong> that we created earlier and click on <strong>Connect</strong>. Now under <strong>EC2 instance connect</strong> click on <strong>Connect</strong>. <br>Run the following commands to install docker and pull the vulnerable image here we are using <strong>centos:7</strong>. You can choose any older image and shall find vulnerabilities associated with it after inspector scans.</li></ol><pre>sudo su -<br>yum -y install docker <br>systemctl start docker<br>docker pull centos:7<br>docker images</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J7aoyBbOclJpxgVv0e1_GQ.gif" /></figure><h3>Step 5 : Push Docker Image on ECR Repository</h3><ol><li>Back to ECR console select the Repository that we created earlier and click on <strong>View push commands</strong>. Now Copy the commands step by steps and execute on our instance CLI.<br>The first command is to <strong>authenticate</strong> your <strong>docker client</strong> to your <strong>ECR registry</strong>. Skip the second command as we have already built a <strong>docker image</strong>. The third command is to <strong>push</strong> the image to <strong>docker</strong> <strong>repository</strong>, here make sure you <strong>update</strong> the command with your <strong>image name.</strong> The final command is to <strong>push</strong> the image to your <strong>AWS repository</strong>. Back to ECR console click on the <strong>repository name</strong> and validate the<strong> image</strong> has been successfully pushed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*odddEQk8UgmqdaUWmOZxHg.gif" /></figure><h3>Step 6 : Validate status of SSM Agent</h3><ol><li>Back to the instance CLI to validate the status of SSM-agent. Use the following command.</li></ol><pre>systemctl status amazon-ssm-agent</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWeZ33f1ja5zL2o2zO7AmA.gif" /></figure><h3>Step 7: Enable Amazon Inspector</h3><ol><li>On AWS Management Console, under Services search for <strong>Amazon Inspector</strong>. Here click on get started and make sure you disable the Inspector as it is a paid service and your get 15 day trial to test it. Now click on <strong>Enable Inspector</strong>, wait for couple of minutes and you should see the Inspector console enabled.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knocsycV1Avs_ewPB9RhSQ.gif" /></figure><h3>Step 8: Inspector Findings</h3><ol><li>Wait for <strong>4–5 minutes</strong> for Inspector to scan all the resources in the backed and produce the <strong>contextualize list of findings</strong> based on Priority. Here you shall see 3 critical findings were discovered and once you dig in you shall see what vulnerabilities are present based on its severity.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S46XjPjTFTHY7oq2Grb8jg.gif" /></figure><h3>Frequently Asked Questions (FAQ’s)</h3><ol><li>Can I manage Amazon Inspector using my AWS Organizations structure?<br>Yes. Amazon Inspector is integrated with AWS Organizations. You can assign a DA account for Amazon Inspector, which acts as the primary administrator account for Amazon Inspector and can manage and configure Amazon Inspector centrally. The DA account can centrally view and manage findings for all the accounts that are part of your AWS organization.</li><li>Do I need any agents to use Amazon Inspector?<br>It depends on which resources you’re scanning. AWS Systems Manager Agents (SSM Agents) are required for vulnerability scanning of Amazon EC2 instances. No agents are required for network reachability of Amazon EC2 instances and vulnerability scanning of container images.</li><li>What is an Inspector risk score?<br>The Inspector risk score is a highly contextualized score that is generated for each finding by correlating common vulnerabilities and exposures (CVE) information with network reachability results, exploitability data, and social media trends. This makes it easier for you to prioritize findings and focus on the most critical findings and vulnerable resources. You can see how the Inspector risk score was calculated and which factors influenced the score in the Inspector Score tab within the Findings Details side panel.</li></ol><h3>Conclusion</h3><p>Here, we have successfully understood the working, features, and practical implementation of Detection and Scanning Container Vulnerabilities with Amazon Inspector.</p><h3>Related Posts</h3><p><a href="https://www.linkedin.com/posts/rohan-mode_aws-certificate-manager-acm-features-and-activity-6747856487122509824-B4BW">AWS Certificate Manager</a> <br><a href="https://www.linkedin.com/posts/rohan-mode_case-study-store-and-retrieve-secrets-using-activity-6824340154275123201-HwBq">Store and Retrieve Secrets using AWS Secrets Manager</a><br><a href="https://www.linkedin.com/posts/rohan-mode_case-study-integrate-aws-single-sign-on-activity-6848755630132486144-US3R?utm_source=share&amp;utm_medium=member_desktop">Integrate AWS Single Sign-On (SSO) with Azure Active Directory</a><br><a href="https://www.linkedin.com/posts/rohan-mode_amazon-dynamodb-fast-and-scalable-nosql-activity-6769621764562542592-ims7">Amazon DynamoDB: Fast And Scalable NoSQL Database</a><br><a href="https://www.linkedin.com/posts/rohan-mode_blue-green-deployments-using-elastic-beanstalk-activity-6772796190598668288-UKTX">Blue-Green Deployments Using Elastic Beanstalk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f7a14742949" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Case Study: Integrate AWS Single Sign-On (SSO) with Azure Active Directory]]></title>
            <link>https://medium.com/@rohan.modhemm/case-study-integrate-aws-single-sign-on-sso-with-azure-active-directory-79c71e1020ce?source=rss-6919623256da------2</link>
            <guid isPermaLink="false">https://medium.com/p/79c71e1020ce</guid>
            <dc:creator><![CDATA[Rohan Mode]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 23:03:17 GMT</pubDate>
            <atom:updated>2021-09-28T23:06:19.164Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, we are going to cover the case study on accessing AWS Management Console for a user based in Azure Directory via AWS Single Sign-on (SSO) through SAML 2.0 Service.</p><p>In Today’s world with multiple websites and apps we have to deal with multiple passwords, and most of the time we end up reusing them which may leads to password reuse attack. Similar things happen in any organization where the employees have to make note of password for different infrastructure and tools they use for day to day work. They too end up having the same password for all the resources. On the backend, information security teams are coping with multiple authentication schemes and lack one source of truth.</p><p>This is where AWS Single Sign-on comes into picture providing a robust foundation for the enterprise to maneuver beyond passwords and protect their business. AWS Single sign-on establishes an authentication authority in order that your workforce users can access any application seamlessly and securely, from anywhere, indirectly reducing administrative overhead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*o5Rxy4mr7v5Ga9GzSajhtA.jpeg" /></figure><p>AWS Single Sign-On is a cloud-based single sign-on (SSO) service that makes it easy to centrally manage SSO access to all or any of your AWS accounts and cloud applications. It has default integration with AWS Organizations and both manages the granular user access to AWS Services.</p><p><strong>Topics we will cover :</strong></p><ul><li><a href="#f830">AWS Single Sign-on</a></li><li><a href="#f3b2">What is SAML 2.0?</a></li><li><a href="#0368">How SAML 2.0 works?</a></li><li><a href="#105a">Administrative Features</a></li><li><a href="#33bc">SAML 2.0 based federation for API access in AWS</a></li><li><a href="#e085">AssumeRoleWithSAML vs SSO</a></li><li><a href="#135e">Step by Step integration of AWS Single Sign-on with Azure Active Directory</a></li><li><a href="#039a">Security Best Practices</a></li><li><a href="#96e5">Frequently Asked Questions (FAQ’s)</a></li></ul><h3><strong>AWS Single Sign-on</strong></h3><ul><li>AWS Single Sign-On (AWS SSO) is where you create, or connect, your workforce identities in AWS once and manage access centrally across your AWS organization.</li><li>You can choose to manage access just to your AWS accounts or cloud applications. You can create user identities directly in AWS SSO, or you can bring them from your Microsoft Active Directory or a standards-based identity provider, such as Okta Universal Directory or Azure AD.</li><li>With AWS SSO, you get a unified administration experience to define, customize, and assign fine-grained access. Your workforce users get a user portal to access all of their assigned AWS accounts or cloud applications. AWS SSO can be flexibly configured to run alongside or replace AWS account access management via AWS IAM.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFVyMXZEHfvCaQw_2OuwQw.png" /></figure><h3>What is SAML 2.0?</h3><p>Security Assertion Markup Language (SAML) is basically a standard for users to logging into different applications based on their sessions in another context. The SAML 2.0 has significant advantages on logging in via username and password which are:</p><ul><li>No need for Credentials</li><li>No requirement to remember or renew password</li><li>No more weak passwords</li></ul><h3>How SAML 2.0 works?</h3><ul><li>The user access the portal via an Application start URL provided by the organization.</li><li>Now the application redirects the user to IdP (Identity Provider) for authentication which is mainly called as authentication requests.</li><li>The IdP constructs the authentication response in the form of XML-document which consists of the email address and password of the user, then signs it using X.509 Certificate, later provides this information to Service Provider.</li><li>The Services Provider knows Identity Provider as the trusted entity, retrieves the authentication response and validates it using the certificate fingerprint.</li><li>This is how the identity of the user is verified and he/she is authorized to access the application based on access control.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2zLaSAcpjF3t75Wzw99tA.png" /></figure><h3>Administrative Features</h3><ul><li>Integrated with AWS Organizations</li><li>Manage SSO access for multiple AWS accounts</li><li>Attribute-based access control</li><li>Create and manage users in AWS SSO</li><li>Multi Factor Authentication</li><li>Connects with Microsoft Active Directory</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ib1BrzLArr50_wSFVpcxog.jpeg" /></figure><p>With AWS SSO, users can find and access all of their assigned accounts and applications in one place. Users can simply sign in to their personalized user portal with their existing corporate credentials and with one click access any of their assigned accounts and applications.</p><h3>SAML 2.0 based federation for API access in AWS</h3><p>Let’s assume we need to provide access to users for copying the data from the personal computers to a backup folder. For which you build an application which in the backend reads and write objects in an S3 bucket. However, the users don’t have direct access to AWS. This is where temporary federated logins comes into picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKyU9elOnjjLaR0Uez8WxA.jpeg" /></figure><h3><strong>AssumeRoleWithSAML vs SSO</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3M5xwYhE9uCqemmQfWKfYA.jpeg" /></figure><ul><li>In AssumeRoleWithSAML we have to maintain a 3rd party IdP Login portal that will check our identity with Identity store, and return to us the SAML 2.0 assertion that is sent to STS (Security Token Service) and we get back security credentials thus we are connected to AWS.</li><li>However, if we have multiple accounts on AWS then we are required to set this same AssumeRoleWithSAML process for each and every single account and top of it we need to manage the login portal as well.</li><li>While in SSO our browser interface will login through the login portal of SSO which in return we don’t have to manage, and SSO is already integrated with our Identity store, so we don’t have any extra setup to do for the same.</li><li>Here, the advantage is that we can setup this process only once for multiple AWS accounts we wanna connect to, with further access control via AWS Organizations and Policies.</li></ul><h3>Step by Step integration of AWS Single Sign-on with Azure Active Directory</h3><p>Step 1 : Enable and Setup AWS SSO<br>Step 2 : Configure Enterprise Application in Azure Active Directory<br>Step 3 : Setup Automatic Provisioning between AWS SSO and Azure Enterprise Application<br>Step 4 : Assign User to AWS Accounts with Permission sets<br>Step 5: Test the Single Sign-On Setup</p><h4>Step 1 : Enable and Setup AWS SSO</h4><ol><li>On AWS Management Console, under Services search for AWS Single Sign-on and open it in new tab. Now Click on <strong>Enable AWS SSO.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPsnb9iHuTNv-8EMu0mHRg.png" /></figure><p>2. Now click on <strong>Choose your Identity source</strong>, then under Identity source click on <strong>Change</strong> and select E<strong>xternal Identity provider</strong>, scroll down and click on <strong>Download metadata file</strong> for SAML.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvhjI0do0wOQIbEP60Zrhg.gif" /></figure><h4>Step 2 : Configure Enterprise Application in Azure Active Directory</h4><p>1. Now login on your Azure Portal, and click on Azure Active Directory, then click on add and select Enterprise application, then search for aws single sign-on select from the searches click on Create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X2AmavLQa59Ie-ekCCwQMQ.gif" /></figure><p>2. Now click on <strong>Single sign-on</strong> from the left panel, select <strong>SAML</strong> for the method and click on <strong>Upload metadata file</strong>. Now select the file that we downloaded earlier from AWS console, add it and then <strong>Save</strong> the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsvkrxkISU8TTxcekZwO1A.gif" /></figure><p>3. Scroll down, and under SAML Signing Certificate, click on download the <strong>Federation Metadata XML </strong>file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*43l-jOstx35Faq9Aty6EOg.gif" /></figure><h4>Step 3 : Setup Automatic Provisioning between AWS SSO and Azure Enterprise Application.</h4><p>1. Back on AWS SSO console, under <strong>IdP SAML metadata</strong> upload the <strong>Federation Metadata XML</strong> file that we just downloaded from Azure portal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mHBcuxaegqnxIxOV1dPdUw.gif" /></figure><p>2. Now on Azure console click on <strong>Users and Groups</strong> from the left panel, then click on <strong>Add user/group</strong>, select the user and click on <strong>Select</strong> and then <strong>Assign</strong> it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kjMuRGKJNK3pEWJ3ulrCCA.gif" /></figure><p>3. Back on AWS Single Sign-on console click on <strong>Enable Automatic Provisioning</strong> and you shall get the <strong>SCIM endpoint</strong> and <strong>Access token</strong>, copy these as we will provide them on the next step for integration at Azure side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*Xzp2q4SoCsz0n1BvJQWniA.png" /></figure><p>4. Now click on <strong>Provisioning</strong> on the left panel, select <strong>Get started</strong>, under provisioning mode select <strong>Automatic </strong>and provide the <strong>SCIM</strong> endpoint under <strong>Tenant URL </strong>and <strong>Security</strong> <strong>Token</strong>, then click on <strong>Test Connection, </strong>after the test success make sure you Save the Configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kboyT7ktUks2JjXzukNOlQ.gif" /></figure><p>5. Now under Provisioning click on <strong>Start</strong> <strong>ß</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WlAHTs3rhptY1YTWeLkXvg.png" /></figure><p>6. Wait for few seconds and you shall see the provisioning cycle has been completed successfully and <strong>1 user </strong>has be provisioned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8SWaqK44pvmkgsHmjqXiVw.png" /></figure><h4>Step 4 : Assign User to AWS Accounts with Permission sets</h4><p>1. Back on AWS SSO console if you check under <strong>Users</strong> you shall see the Azure AD user should populate, then click on <strong>AWS</strong> <strong>accounts</strong> on the left panel, select the aws account and click on <strong>Assign users</strong>, then select the user click on <strong>Next: Permission sets. </strong>Here, select the <strong>PowerUserAccess</strong> and then click on Finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3TTxUVSKzzkq8SZJB2tOOQ.gif" /></figure><p>2. Now the most important but small step, if not done then you shall receive an error on the Login page as <strong>MFA invalid credentials</strong>. So make sure you don’t miss this step. On Azure console, under <strong>User Attributes &amp; Claims</strong> click on the <strong>Unique User Identifier</strong> and change the source attribute to <strong>user.mail</strong> and make sure you <strong>Save</strong> the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKppVJzktSDDGBB9W_xJ9Q.gif" /></figure><p>3. Now back on AWS SSO Console click on the <strong>User Portal link</strong> and open it in new incognito tab. Once redirected to the Microsoft login provide the user credentials and you shall see the AWS account to login the management console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5q0TWCfV7L_o_IqLpnvkcg.gif" /></figure><p>Here, once logged in we will test for the <strong>PowerUserAccess</strong> by accessing <strong>IAM</strong> which should not be accessible and then create a <strong>bucket</strong> as PowerUser has access to all services other than IAM.</p><p>Thus, we have successfully configure Single Sign-on with <strong>Azure Active Directory</strong> Integration with <strong>AWS SSO.</strong></p><h3>Security Best Practices</h3><ul><li>Use SCIM for best Security, Consistency and Convenience</li><li>Make sure users have email address attribute in AWS SSO</li><li>Specify IdP user/group names when provisioning manually or doing POCs</li><li>Configure Virtual MFA when using Active Directory Domain Services or AWS SSO as identity source.</li></ul><h3><strong>Frequently Asked Questions (FAQ’s)</strong></h3><ol><li>Can I implement attribute-based access control in AWS SSO?<br>Yes. AWS SSO allows you to select user attributes, such as cost center, title, or locale, from your identity source, and then use them for attribute-based access control (ABAC) in AWS. You can define permissions once, and then grant, revoke, or modify AWS access by simply changing the attributes in your identity source.</li><li>What data will AWS SSO store on my behalf?<br>AWS SSO will store data about which AWS accounts and cloud applications are assigned to which users and groups, as well as what permissions have been granted for accessing AWS accounts. AWS SSO will also create and manage IAM roles in individual AWS accounts for each permission set you grant access for your users.</li><li>What problems does AWS SSO solve?<br>AWS SSO eliminates the administrative complexity of custom SSO solutions you use to provision and manage identities across AWS accounts and business applications. AWS SSO simplifies the user experience and improves security by eliminating individual passwords needed for each AWS account or cloud business application. AWS SSO also solves the problem of limited visibility of the access to your cloud applications by integrating with AWS CloudTrail and providing a central place for you to audit SSO access to AWS accounts and SAML-enabled cloud applications, such as Microsoft 365, Salesforce, and Box.</li></ol><h3><strong>Conclusion</strong></h3><p>Here, we have successfully understood the features, use-cases, and practical implementation of AWS Single Sign-on with integrating the Microsoft Azure Active Directory for federated access with specified access control via AWS Organizations and policies.</p><h3><strong>Related Posts</strong></h3><p><a href="https://www.linkedin.com/posts/rohan-mode_aws-certificate-manager-acm-features-and-activity-6747856487122509824-B4BW">AWS Certificate Manager</a> <br><a href="https://www.linkedin.com/posts/rohan-mode_case-study-store-and-retrieve-secrets-using-activity-6824340154275123201-HwBq">Store and Retrieve Secrets using AWS Secrets Manager</a><br><a href="https://www.linkedin.com/posts/rohan-mode_amazon-dynamodb-fast-and-scalable-nosql-activity-6769621764562542592-ims7">Amazon DynamoDB: Fast And Scalable NoSQL Database</a><br><a href="https://www.linkedin.com/posts/rohan-mode_blue-green-deployments-using-elastic-beanstalk-activity-6772796190598668288-UKTX">Blue-Green Deployments Using Elastic Beanstalk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79c71e1020ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Case Study: Store and Retrieve secrets using AWS Secrets Manager]]></title>
            <link>https://medium.com/@rohan.modhemm/case-study-store-and-retrieve-secrets-using-aws-secrets-manager-b24acdc6244b?source=rss-6919623256da------2</link>
            <guid isPermaLink="false">https://medium.com/p/b24acdc6244b</guid>
            <dc:creator><![CDATA[Rohan Mode]]></dc:creator>
            <pubDate>Fri, 23 Jul 2021 13:21:11 GMT</pubDate>
            <atom:updated>2021-07-23T13:21:11.329Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, we are going to cover the case study on storing, retrieving, and rotating secrets using AWS Secrets Manager.</p><p>Traditionally, when you want to access the database information from your custom application, you used to embed the credentials, the secret for accessing the database directly from the application. But when it was required to rotate the credentials you had to invest more time and effort to update the application using new credentials. This increases the risk when you have more than one application using the same credentials, as failing to update one would lead to application failure.</p><p>This is where AWS Secrets Manager comes into the picture, it enables you to replace hardcoded credentials in your code, including passwords, with an API call to Secrets Manager and retrieve the secret programmatically. This helps ensure the secret can’t be compromised by someone examining your code, because the secret no longer exists in the code. Also, you can configure it to automatically rotate the secret according to a specified schedule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*5QGOs6Lgz0tEZ7nTZfRLJQ.png" /></figure><p><strong>Topics we will cover :</strong></p><ul><li><a href="#b3a2">AWS Secrets Manager</a></li><li><a href="#8754">How does the Secret Rotation Works?</a></li><li><a href="#903f">How does Secrets Manager Encrypt and Decrypt our Secrets?</a></li><li><a href="#de5e">Secrets Replication Across AWS Regions</a></li><li><a href="#7086">Step by Step Storing and Retrieving of Secrets Using Secrets Manager via AWS CLI</a></li><li><a href="#779c">Compliance with Standards</a></li><li><a href="#2307">AWS Secrets Manager Vs SSM Parameter Store</a></li><li><a href="#92a1">Frequently Asked Questions (FAQ’s)</a></li></ul><p>Before performing the Secrets Manager activity, we should understand the basic concepts of AWS Secrets Manager, Features, and Base Scenario.</p><h3><strong>AWS Secrets Manager</strong></h3><ul><li>It is a service provided by AWS to store secrets i.e. <strong>passwords, credentials, third party keys</strong>, or any such confidential information.</li><li>Secrets Manager allows you to <strong>store</strong> and <strong>manage</strong> access to these credentials.</li><li>Use Secrets Manager to store your credentials<strong> instead of hard-coding</strong> them in your code or configuration files.</li><li>It allows you to replace hardcoded credentials in your code with an <strong>API call </strong>to<strong> </strong>Secrets Manager for <strong>retrieving </strong>the secrets <strong>programmatically.</strong></li><li>It allows you to easily <strong>change or rotate </strong>your credentials, thereby avoiding any code or config changes.</li><li>It <strong>encrypts </strong>the protected text of a secret by using <strong>AWS Key Management Service.</strong></li></ul><h3><strong>How does the Secret Rotation Works?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*cF_pAw723k0bWkeUHJ6LaA.png" /></figure><ul><li>The rotation function contacts the secured service authentication system and creates <strong>a new</strong> set of credentials to access the database. Secrets Manager stores these new credentials <strong>because the </strong>secret text <strong>during a remake </strong>of <strong>the secret</strong> with the AWSPENDING staging label attached.</li><li>The rotation function then tests the AWSPENDING version of <strong>the secret</strong> <strong>to make sure </strong>that the credentials work, and grants <strong>the specified </strong>level of access to the secured service.</li><li>If the tests succeed, the rotation function then moves the label AWSCURRENT to the <strong>new version</strong> to mark it <strong>as the</strong> default version. Then, all of the clients start using this version of <strong>the secret</strong> <strong>rather than </strong>the old version.</li><li>The function also assigns the label AWSPREVIOUS to the old version. The version that had the AWSPREVIOUS staging label now has no label <strong>and thus </strong>deprecated.</li></ul><h3><strong>How does Secrets Manager Encrypt and Decrypt our Secrets?</strong></h3><p>Encrypting and decrypting secrets To protect secrets, Secrets Manager uses <strong>envelope encryption</strong> with AWS KMS customer master keys (CMKs) and data key to protect each secret value. Whenever the secret value in a secret changes, Secrets Manager generates a new data key to protect it. The data key is encrypted under an AWS KMS CMK and stored in the metadata of the secret. To decrypt the secret, Secrets Manager must first decrypt the encrypted data key using the CMK in AWS KMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*SlGcGLzghkk6dcAzjNTPAA.png" /></figure><h3>Secrets Replication Across AWS Regions</h3><p>By replicating secrets across AWS Regions, you may reduce the time it takes to get back up and running in production in the event of a disaster by ensuring that the credentials are safely kept in a replica region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*k5flh56nYH7UouznOy9MyA.png" /></figure><p>AWS Secrets Manager, AWS CloudTrail, Amazon CloudWatch Events, and AWS Lambda are all used in this process. To begin, open Secrets Manager and create a secret to hold your RDS database credentials. AWS KMS encrypts this secret, and Lambda will run a PUT operation on a secret with the same name in the same AWS Region as your secret to automate the replication of the secret’s value in your AWS Region.</p><h3><strong>Step by Step Storing and Retrieving of Secrets Using Secrets Manager via AWS CLI</strong></h3><p>Step 1 : Create and Store your Secret in Secrets Manager<br>Step 2 : Retrieve your Secret via AWS Console<br>Step 3 : Retrieve your Secret via AWS CLI<br>Step 4 : Terminating the Resources</p><h4><strong>Step 1 : Create and Store your Secret in Secrets Manager</strong></h4><ol><li>Under Services search for Secrets Manager and open it in a new tab. Now click on <strong>Store a new Secret.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*cbsYP7DAenUK5X_r5vqDBQ.png" /></figure><p>2. Now click on Other types of secrets, and provide the Secret key and its Value. Let the encryption key be default encryption key. Now click on <strong>Next.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*yhs_VrMdlBTMKrxoqrdvuQ.gif" /></figure><p>3. Provide the Secret name and a description. Further, scroll down and click on <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*5onzFxoutF3YuXHXqb_Rzw.gif" /></figure><p>4. Here, under Configure automatic rotation select Disable automatic rotation and click on Next. Now, scroll down and click on <strong>Store</strong>. Here your Secret has been stored successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*baZtpU3EQbrpL438pGHRQg.png" /></figure><h4><strong>Step 2: Retrieve your Secret via AWS Console</strong></h4><ol><li>Once your secret has been stored successfully, click on it to Open and search for <strong>Retrieve secret value</strong>. Now you shall see your stored secret values.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*sDwFaayoXvsA-ziVLd8g2Q.gif" /></figure><p>This is how we have accessed our Secret via Console. Now, let see via AWS CLI in further steps.</p><h4><strong>Step 3: Retrieve your Secret via AWS CLI</strong></h4><ol><li>Now under Services, search for CloudShell and open it in a new tab. Let the CloudShell environment be created. Once the environment is successfully set up use the following command to describe our Secret.</li></ol><pre><strong>aws secretsmanager describe-secret --secret-id Prod/MyDemoSecret</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*cFeZ1mBphCx1M-bvGqdCpA.png" /></figure><p>2. Now to view the secret string use the following command.</p><pre><strong>aws secretsmanager get-secret-value --secret-id Prod/MyDemoSecret --version-stage AWSCURRENT</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*eH23PFOeGmQzGp3M2R0tKQ.png" /></figure><p>Thus, we have successfully accessed our Secret value stored in Secrets Manager via <strong>AWS CLI.</strong></p><h3><strong>Compliance with Standards</strong></h3><p>Health Insurance Portability and Accountability Act <strong>(HIPAA)</strong>, Payment Card Industry <strong>(PCI)</strong> Data Security Standard <strong>(DSS)</strong>, System and Organization Control <strong>(SOC)</strong>, The Federal Risk and Authorization Management Program <strong>(FedRAMP)</strong>, The Department of Defense <strong>(DoD)</strong> Cloud Computing Security Requirements Guide <strong>(SRG).</strong></p><h3><strong>AWS Secrets Manager Vs SSM Parameter Store</strong></h3><p>There are many similarities between these two services. Both of these services offer a solution to store values under a name or key. However, AWS Secrets Manager provides better feasibility with regards to SSM Parameter Store. Let’s take a look at their differences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyFAY4nv3SgPkcba29cJlA.png" /></figure><h4>Password Generation</h4><p>AWS Secrets Manager is able to generate random secrets through the AWS CLI or SDK. The best example is CloudFormation Templates for RDS instance creation, wherein you can randomly generate a password and reference it in the configuration of RDS as it only requires a username and password. Other than CloudFormation, applications accessed through the SDKs can make use of this feature. Only AWS Secrets Manager has the ability to produce random strings; it is not available in SSM Parameter Store.</p><h4><strong>Secrets Rotation</strong></h4><p>The option to r<strong>otate</strong> the <strong>secret value</strong> is provided by AWS Secrets Manager. AWS Secrets Manager comes with full key rotation integration for RDS out of the box. This means AWS Secrets Manager can rotate keys and apply the new key/password to RDS on your behalf. You can use an AWS Lambda function to build custom key rotation logic for services other than RDS.</p><h4><strong>Cross Account Access</strong></h4><p>Another significant difference between AWS Secrets Manager and SSM Parameter Store is that secrets can be <strong>shared between accounts</strong>. IAM users and application resources in one Development or Production AWS account will have access to secrets in another AWS account for example <strong>Security AWS Account</strong>. This type of functionality is also useful in situations where a client needs to share information.</p><h3><strong>Frequently Asked Questions (FAQ’s)</strong></h3><ol><li>What secrets can I manage in AWS Secrets Manager?<br>You can manage secrets such as database credentials, on-premises resource credentials, SaaS application credentials, third-party API keys, and Secure Shell (SSH) keys. Secrets Manager enables you to store a JSON document which allows you to manage any text blurb that is 64 KB or smaller.</li><li>How does AWS Secrets Manager implement database credential rotation without impacting applications?<br>AWS Secrets Manager enables you to configure database credential rotation on a schedule. This enables you to follow security best practices and rotate your database credentials safely. When Secrets Manager initiates a rotation, it uses the super database credentials provided by you to create a clone user with the same privileges, but with a different password. Secrets Manager then communicates the clone user information to databases and applications retrieving the database credentials.</li><li>How can my application use these secrets?<br>First, you must write an AWS Identity and Access Management (IAM) policy permitting your application to access specific secrets. Then, in the application source code, you can replace secrets in plain text with code to retrieve these secrets programmatically using the Secrets Manager APIs.</li></ol><h3><strong>Conclusion</strong></h3><p>Here, we have successfully understood the features, use-cases, and practical implementation of the Storing and Retrieving Secrets Using AWS Secrets Manager Via Console and AWS CLI.</p><h3><strong>Related Posts</strong></h3><p><a href="https://www.linkedin.com/posts/rohan-mode_aws-certificate-manager-acm-features-and-activity-6747856487122509824-B4BW">AWS Certificate Manager</a><br><a href="https://www.linkedin.com/posts/rohan-mode_amazon-dynamodb-fast-and-scalable-nosql-activity-6769621764562542592-ims7">Amazon DynamoDB: Fast And Scalable NoSQL Database</a><br><a href="https://www.linkedin.com/posts/rohan-mode_blue-green-deployments-using-elastic-beanstalk-activity-6772796190598668288-UKTX">Blue-Green Deployments Using Elastic Beanstalk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b24acdc6244b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>