<?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 Paolo Latella on Medium]]></title>
        <description><![CDATA[Stories by Paolo Latella on Medium]]></description>
        <link>https://medium.com/@platella?source=rss-da8c94ce739b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*VPvEL2TlpRZJBW4wTRDoKQ.jpeg</url>
            <title>Stories by Paolo Latella on Medium</title>
            <link>https://medium.com/@platella?source=rss-da8c94ce739b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:52:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@platella/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[Let your developer manage Identity on AWS— Delegate responsibility using permissions boundaries]]></title>
            <link>https://towardsaws.com/let-your-developer-manage-identity-on-aws-delegate-responsibility-using-permissions-boundaries-134fadca3e42?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/134fadca3e42</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[boundaries]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Thu, 29 Sep 2022 14:31:19 GMT</pubDate>
            <atom:updated>2022-10-04T10:44:49.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bH6dgVh3pIWPsa739viIRA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@erinlarsonphotography?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Erin Larson</a> on <a href="https://unsplash.com/s/photos/boundary?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Cloud Agility and Safety</h3><p>To improve their Cloud agility, companies must permit developers to experiment and innovate quickly and safely. For example, what happens if our developers needed the IAM privileges to permit a Lambda function to read/write data on a DynamoDB or S3 bucket ? The right approach is to delegate to our developers the responsibility for app-specific IAM resources without compromising security requirements.</p><h4>The centralized vs decentralized model</h4><p>Let’s assume that our developers are using various services like AWS Lambda, Amazon EC2 and Amazon EKS. All of these services need IAM roles to perform some actions inside AWS. Who is going to create those roles ? Most of the company resolve this problem by adopting a <strong>centralized governance</strong> (cloud resource broker) model. This approach guarantees maximum controls but reduces agility: the developers must ask the MSO (Managed Service Organization) for the app-specific identity resources, wait for resources, test the resources and eventually adapt the request. This approach slows down the process, we need to introduce a different approach, more agile and therefore less centralized. In a <strong>decentralized governance</strong> model, we can delegate some responsibility, such as identity management, directly to our developers but inside a well-defined perimeter with the right controls. In this model, the MSO is responsible in create and maintain the controls (directive, preventive, detective and reactive) in order to guarantee the organization’s security and compliance requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZFdpGjo1Ho_GPlvzVb5ng.png" /></figure><p>In a decentralized governance model, it’s essential to develop a critical mass of people with AWS experience, establish new operational processes, and leverage services designed to improve agility and guarantee safety [1]. <strong>Decentralized model can help you to strike the right balance between agility and safety in a Cloud world. </strong>So this is where a permissions boundary comes in!</p><h3>Permissions boundaries for IAM entities</h3><p>AWS Identity and Access Management (IAM) service provide permissions boundaries features to control the maximum permission that IAM entities (users or roles) can have. As the <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html">Service control policies (SCPs)</a> the permission boundary restricts the permissions of the users and roles attached to it but unlike the SCP <strong>a permission boundary does not actually grant permissions. </strong>You can use permission boundaries on two different scenarious:</p><ol><li>Limit maximum permission of a user or role</li><li>Delegate identity management to others</li></ol><p>In both cases the permission boundary is an AWS managed policy or a customer managed policy that set the boundary for an IAM entity (user or role).</p><h4>Scenario 1 — Limit permission of a specific IAM entity</h4><p>In this scenario we put a permission boundary directly to an IAM entity (user or role) to limit the maximum permission that this identity can receive.</p><pre>aws iam <strong>put-user-permissions-boundary</strong> --permissions-boundary arn:aws:iam::123456789012:policy/boundary --user-name <em>user</em></pre><p>In this configuration we are creating a <strong>preventive control</strong> where the user or role can perform only the actions that are allowed by both its identity-based policies and its permissions boundaries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/0*PHk0FbVFwnInMjgd.png" /><figcaption>Effective permissions as intersection of permission boundary and identity-based policy</figcaption></figure><p>Identity-based policies (inline or managed )are attached to a user or role. Identity-based policies grant permission to the entity while permissions boundaries limit those permissions. The effective permissions are the intersection of both policy types. An explicit deny in either of these policies overrides the allow.</p><h4>Scenario 2 — Delegate identity management to others</h4><p>In this scenario we use permissions boundaries to delegate permissions management tasks, such as role creation, to IAM users in your account. This permits others to perform tasks on your behalf within a specific boundary of permissions. For example, assume that <em>Account Admin</em> is the administrator of AWS account and he wants to delegate Lambda role creation to the <em>DevOps team</em>. However, he must ensure that DevOps team creates role that permit only to get objects from an S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1K7KrKtzZFZIpsSXOkHig.png" /><figcaption>Delegate to DevOps team the capability to create and attach role to AWS Lambda</figcaption></figure><p>To enforce these rules we must completes the following tasks:</p><ol><li>The <em>Account Admin</em> create the <em>Lambda Permission Boundary</em> that permit only the S3:GetObjectaction</li><li>The <em>Account Admin</em> attach to <em>DevOps Team</em> the <em>DevOps User Identity Based policy </em>that permit the IAM:CreateRoleaction and require the<em> Lambda Permission Boundary </em>attachment</li><li>The <em>DevOps Team</em> can create the role <em>Lambda Role</em> with the <em>Lambda Role Identity Based Policy</em> and <em>Lambda Permission Boundary</em> attached to role.</li></ol><h3>Reference</h3><p>[1] <a href="https://aws.amazon.com/it/blogs/apn/governance-in-the-aws-cloud-the-right-balance-between-agility-and-safety/">Governance in the AWS Cloud: The Right Balance Between Agility and Safety</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=134fadca3e42" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/let-your-developer-manage-identity-on-aws-delegate-responsibility-using-permissions-boundaries-134fadca3e42">Let your developer manage Identity on AWS— Delegate responsibility using permissions boundaries</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adopt Compliance as Code in your AWS environment — Part I — The right tools for the right job]]></title>
            <link>https://towardsaws.com/adopt-compliance-as-code-in-your-aws-environment-part-i-the-right-tools-for-the-right-job-f14477543aa4?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f14477543aa4</guid>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[compliance]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 09:03:15 GMT</pubDate>
            <atom:updated>2022-09-20T06:20:48.119Z</atom:updated>
            <content:encoded><![CDATA[<h3>Adopt Compliance as Code in your AWS environment — Part I — The right tools for the right job</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbb5K93wGP7dhv7qcCHAHA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sortino?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Joshua Sortino</a> on <a href="https://unsplash.com/s/photos/code?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Compliance in a Cloud world</h3><p>In order to protect its business, every company in the world should define a compliance program. A compliance program is a set of requirements that meet a specific standard (internal or external). A requirement is expressed by a statement or assertion — the policy<strong> — </strong>that specifies the correct or expected behaviour of an entity<strong>. </strong>To meet the compliance program, the organization implements controls<strong>,</strong> defines procedures<strong> </strong>and writes guidelines<strong> </strong>that satisfy these policies. <strong>Security and governance processes must evolve to support modern Cloud infrastructures</strong> keeping in mind two things: the organization share responsibility with cloud service providers [1] and the organization must improve its business agility without compromising safety [2].</p><h4>Compliance as Code (Policy as Code)</h4><p>To find the right balance between agility and compliance, the security and governance team must define new rules, engage the right people, and leverage cloud technologies. One of these rules is to <strong>define your compliance policies such that they can be treated as software</strong>. The companies must adopt a new approach to planning, developing, and testing policies. Just like we use Infrastructure as Code in infrastructure automation and the approach of CI/CD in application lifecycle management, at the same time our DevSecOps teams should adopt policy-as-code, especially in a cloud world. Because the compliance program is a set of policies that meet a standard, it is more correct to speak of Policy as Code as one implementation of Compliance as Code.</p><h4>Shift-Left and Shift-Righ approach</h4><p>The security and compliance team should adopt the policy-as-code practice to meet compliance requirements without compromising agility. In a DevOps process, during the software development, the team can execute the tests on the left side and/or on the right side of the lifecycle. On the left side the teams test software with the goal to meet the design criteria, instead on the right side they test integration with the rest of the world [3]. We can make the same analogy for the policy-as-code practice. Working on the left side we can detect compliance issues very early in the process, but our tests are limited in scope and more related to a specific workload. On the right side, we can assess the resources against compliance requirements defined at the organization level. On the left side, the tests are planned and executed by the project’s team while on the right side the tests are planned and executed by a CCoE (Cloud Center of Excellence) team [1].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u51rWj-MLqMB1b_FOOfSyA.png" /><figcaption>Policy as Code — Shift-Left and Shift-Righ approach</figcaption></figure><h3>The right tools for the right job</h3><p>There are different tools to implement policy-as-code in a Cloud world, most of them are open source and many others are provided directly by the cloud provider. On the left side, the tests are implemented with the goal to verify the compliance of a specific workload against a standard. Usually, on this side, there is no dependency on cloud providers so we can use general-purpose tools. On the right side, instead, we need to assess the resources against the compliance requirements defined at the organization level. On this side, the policies are cross-projects, cross-business and implemented by a CCoE team. On this side, the tools provided by the Cloud providers are usually more effective and straightforward to adopt.</p><h4>The right tools for the right job on AWS</h4><p>AWS provide different services that give you a comprehensive view of your compliance status and permit you to continuously monitor the cloud resources. In particular, to help the policy-as-code adoption, AWS provide services and features that you can put on the DevOps lifecycle both for a shift-left than shift-right approach.</p><p><strong>Shift-Left — AWS CDK and OPA<br></strong>On the left side, we can use <a href="https://docs.aws.amazon.com/cdk/latest/guide/home.html">AWS Cloud Development Kit</a> together with a framework that simplifies policy development and management such as <a href="https://www.openpolicyagent.org/">OPA — Open Policy Agent</a> — an open-source engine incubated in the CNCF. By integrating AWS CDK and OPA we can realize policy as code capability that tests the changes before AWS CDK makes changes in your AWS environment. In this scenario, CDK generates a Cloudformation template that will be validated against OPA policy document before executing a create or launch stack. In this scenario, the OPA policies are specific to the workload we are creating or updating.</p><p><strong>Shift-Left — AWS CloudFormation Guard<br></strong>On the left side, we can use <a href="https://github.com/aws-cloudformation/cloudformation-guard">AWS CloudFormation Guard</a> an open source tool that helps validate your workload against a rule set to keep resources in compliance with the project’s guidelines. Guard is an open-source command line interface (CLI) that provides a domain-specific language (DSL) to express policy-as-code and then validate JSON/YAML template against that code. Cloudformation Guard support also Terraform JSON configuration files and Kubernetes configurations.</p><p><strong>Shift-Right — AWS Config Rule and RDK<br></strong>On the right side, the policies are defined by a CCoE and have an overall (entire organization) scope. AWS Config and in particular the <a href="https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html">AWS Config Rules</a> can evaluate the configuration settings for specific AWS resources or for an entire AWS account. If a resource does not pass a rule check, AWS Config flags the resource as non-compliant and notifies it. AWS Config provide also a <a href="https://github.com/awslabs/aws-config-rdk">Rule Development Kit (RDK)</a> that simplifies your custom rule creation and management.</p><h4><strong>The importance of CI/CD</strong></h4><p>To improve the agility of compliance we must introduce a continuous compliance workflow in which our DevSecOps team and/or our CCoE team can release policies in continuous integration and continuous deployment (CI/CD) fashion. Following the decoupling best practice we will put alongside the pipeline of Infrastructure and application the pipeline for compliance. To implement CI/CD pipeline we can use <a href="https://aws.amazon.com/products/developer-tools/">AWS Developer Tools</a> such as Codepipeline, Codebuild and Codedeploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hG2SpUHkIzTJ7yGnaQSQSw.png" /><figcaption>Compliance as Code — Pipeline with AWS</figcaption></figure><h3>Reference</h3><p>[1] <a href="https://aws.amazon.com/compliance/shared-responsibility-model/?nc1=h_ls">AWS Shared Responsibility Model</a></p><p>[2] <a href="https://aws.amazon.com/it/blogs/apn/governance-in-the-aws-cloud-the-right-balance-between-agility-and-safety/">Governance in the AWS Cloud: The Right Balance Between Agility and Safety</a></p><p>[3] <a href="https://www.dynatrace.com/news/blog/what-is-shift-left-and-what-is-shift-right/">Shift left vs shift-right: A DevOps mystery solved</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f14477543aa4" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/adopt-compliance-as-code-in-your-aws-environment-part-i-the-right-tools-for-the-right-job-f14477543aa4">Adopt Compliance as Code in your AWS environment — Part I — The right tools for the right job</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IDS/IPS on AWS — Part II — Detect intrusion on AWS with VPC Traffic Mirroring and Suricata]]></title>
            <link>https://towardsaws.com/ids-ips-on-aws-part-ii-detect-intrusion-on-aws-with-vpc-traffic-mirroring-and-suricata-562846806d58?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/562846806d58</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[intrusion-detection]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[network-security]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Sat, 02 Apr 2022 17:09:20 GMT</pubDate>
            <atom:updated>2022-04-05T11:06:02.298Z</atom:updated>
            <content:encoded><![CDATA[<h3>IDS/IPS on AWS — Part II — Detect intrusion on AWS with VPC Traffic Mirroring and Suricata</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rv_P7pv0bdXlcODTcYqOQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@evgenit?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Evgeni Tcherkasski</a> on <a href="https://unsplash.com/s/photos/mirroring?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Intrusion Detection in Cloud</h3><p>An Intrusion Detection System (IDS) analyzes network traffic looking for specific signatures, behaviours or anomalies that indicate an attempted intrusion. In a Cloud environment, we can’t conduct detection at the network layer using an <a href="https://en.wikipedia.org/wiki/Network_tap">NTAP</a> or <a href="https://en.wikipedia.org/wiki/Port_mirroring">SPAN</a> because the network is virtualized, the only available options are C<em>loud Native</em> systems or V<em>irtualized Appliances</em> [1]. Amazon Web Service provides <a href="https://aws.amazon.com/network-firewall/?whats-new-cards.sort-by=item.additionalFields.postDateTime&amp;whats-new-cards.sort-order=desc">AWS Network Firewall</a> as a Cloud Native solution, while to support virtualized appliance IDS solutions the VPC Traffic Mirroring feature has been released in 2019.</p><h3>VPC Traffic Mirroring</h3><p>VPC Traffic Mirroring is an Amazon Web Services (AWS) feature launched in 2019 on the VPC service. It permits copying inbound/outbound traffic from/to a source and sending it to a target inside an Amazon VPC. Traffic Mirroring is an agentless method for capturing raw data packets and send to a target for content inspection, threat monitoring or troubleshooting [2]</p><p>Traffic Mirroring components are:</p><ul><li><strong>Mirror Source: </strong>the ENI where we want to sniff traffic</li><li><strong>Mirror Target:</strong> the destination of mirrored traffic</li><li><strong>Mirror Filter:</strong> a set of rules for inbound/outbound traffic</li><li><strong>Mirror Rules: </strong>define which kind of traffic we want to mirror</li><li><strong>Mirror Session: </strong>establishes a relationship between a traffic mirror source, a traffic mirror target and a filter (with its rules)</li></ul><p>For example, by leveraging traffic mirroring we can inspect all traffic (<em>North-South</em> and <em>East-West) </em>that flows through the ENIs of our private EC2 Instances. Configuring these ENIs as mirror source we can capture (copy) all inbound/outbound traffic and sends it to a set of EC2 Instances — behind a Network Load Balancer (NLB) — with an IDS/IPS engine aboard for content inspection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Qd6Y-GVSruWAGWbZ0EVYw.png" /><figcaption>Reference Architecture for North-South / East-West traffic inspection leveragin VPC Traffic Mirroring</figcaption></figure><p>Mirrored traffic between ENIs (mirror sources) and NLB (mirror target) travel on VXLAN encapsulated packets [2]. The NLB receives traffic on UDP port 4789 and redirects it to one or more EC2 instances for packet inspection.</p><h3>Suricata Intrusion Detection</h3><p>Suricata is an open source threat detection engine that combines intrusion detection (IDS), intrusion prevention (IPS), network security monitoring (NSM) and PCAP processing. We can use Suricata for threat detection by leveraging the VPC Traffic Mirroring Feature. By the Traffic Mirroring a copy of VPC traffic flows is sent to a set of EC2 instances (behind a NLB) with the Suricata engine aboard.</p><h4>Suricata on Amazon EC2</h4><p>To install Suricata on EC2 you can use this Ansible playbook: <a href="https://github.com/PaoloL/ansible-suricata">https://github.com/PaoloL/ansible-suricata</a>. The playbook installs Suricata on Amazon Linux 2 and also install Apache Web Server because it is necessary to respond to NLB health checks. To scale the IDS system, we can put the Suricata instances inside an Amazon Autoscaling Group.</p><h3>Send mirrored traffic to Suricata (behind a NLB)</h3><p>To send traffic to a set of Amazon EC2 instances for traffic inspection we need to create a NLB and attach the Suricata instances as the target group of NLB</p><p><strong>Step-1: Create NLB and related Target Group</strong></p><pre>aws elbv2 create-load-balancer --name <em>IDS-LoadBalancer</em> --type network --scheme internal --subnets <em>prvsubnet1 prvsubnet2</em></pre><pre>aws elbv2 create-target-group --name <em>SuricataService</em> --protocol <strong>UDP</strong> --port <strong>4789</strong> --health-check-protocol HTTP --health-check-port 80 --health-check-path / --vpc-id vpc-<em>123456789</em></pre><p>The Network Load Balancer uses protocol UDP and port 4789 (VXLAN packets) for routing traffic to the targets while using protocol HTTP and port 80 for the health checks, in fact, the EC2 target instance has an Apache Web Server aboard only to respond to the health check.</p><p><strong>Step 2: Create Listener and register Instances</strong></p><pre>aws elbv2 create-listener --load-balancer-arn <em>IDS-LoadBalancer-arn</em> --protocol <strong>UDP</strong> --port <strong>4789</strong> --default-actions Type=forward,TargetGroupArn=<em>SuricataService-arn</em></pre><pre>aws elbv2 register-targets --target-group-arn <em>SuricataService-arn</em> --targets Id=<em>Suricata01InstanceID</em> Id=<em>Suricata02InstanceID</em></pre><p>The Network Load Balancer receive VXLAN encapsulated packets then the load balancer listener listens on port 4789 protocol UDP and forwards to EC2 instances registered as target on the same port and protocol.</p><p><strong>Step 3: Create Traffic Mirror resources</strong></p><pre>aws ec2 create-traffic-mirror-target <strong>--network-load-balancer-arn </strong><strong><em>IDS-LoadBalancer-arn</em></strong></pre><pre>aws ec2 create-traffic-mirror-filter --tag-specifications &#39;ResourceType=traffic-mirror-filter,Tags=[{Key=&#39;Name&#39;,Value=&#39;IDSMirroringTCP&#39;}]&#39; --description &quot;Mirror TCP Traffic&quot;</pre><pre>aws ec2 create-traffic-mirror-filter-rule --description &quot;TCP Rule Ingress&quot; --destination-cidr-block 0.0.0.0/0 <strong>--protocol 6</strong> --rule-action accept --rule-number 1 --source-cidr-block 0.0.0.0/0<strong> --traffic-direction ingress</strong> --traffic-mirror-filter-id <em>TCPTrafficMirrorFilter</em></pre><pre>aws ec2 create-traffic-mirror-filter-rule --description &quot;TCP Rule Egress&quot; --destination-cidr-block 0.0.0.0/0 <strong>--protocol 6</strong> --rule-action accept --rule-number 1 --source-cidr-block 0.0.0.0/0 <strong>--traffic-direction egress</strong> --traffic-mirror-filter-id <em>TCPTrafficMirrorFilter</em></pre><pre>aws ec2 create-traffic-mirror-session --tag-specifications &#39;ResourceType=traffic-mirror-filter,Tags=[{Key=&#39;Name&#39;,Value=&#39;IDSMirroringTCP&#39;}]&#39; <strong>--traffic-mirror-target-id <em>NLBTrafficMirrorTarget</em> --network-interface-id eni-123456789</strong> --session-number 1 --traffic-mirror-filter-id tmf-04812ff784EXAMPLE</pre><p>A Traffic Mirror session specifies the Traffic Mirror source (the ENI of the instances that we would analyze) and the Traffic Mirror target (the NLB that routes traffic to Suricata instances). A Traffic mirror filter defines a subset of the traffic to mirror, in this case, all TCP traffic.</p><h3>Send Suricata alert to Cloudwatch Logs</h3><p>When a packet body matches a Suricata signature the engine writes a record on log files. This record can be amended with metadata, such as the application layer record (HTTP, DNS, etc) an alert was generated for, and elements of the rule. Suricata write events in the/var/log/suricatadirectory</p><ul><li><strong>Line based alerts logs</strong> (fast.log): this log contains alerts generate by Suricata engine.</li><li><strong>Extensible Event Format logs</strong> (eve.json): this is a JSON output for alerts and events.</li><li><strong>Engine statistics logs (stats.log)</strong>: this log contains engine statistics such as packet counters or memory use counters</li></ul><p>Using Cloudwatch Logs Agent we can collect events of <em>fast.log</em> file and send them to the Amazon CloudWatch service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uxn8v7R1EKESohiB6qTiUA.png" /><figcaption>Cloudwatch Logs events published by Suricata engine</figcaption></figure><p>The Ansible playbook, mentioned above in addition to installing Suricata and Apache also takes care of installing the CloudWatch Logs agent on EC2 instances and configuring it</p><pre>[/var/log/suricata/fast.log]<br><strong>file = /var/log/suricata/fast.log</strong><br>log_group_name = suricata-ids<br>log_stream_name = {instance_id}<br>datetime_format = %b %d %H:%M:%S<br>initial_position = start_of_file</pre><p>You can search and filter the Suricata log by creating one or more <em>filters </em>and you can attach a <em>metric</em> to this filter<em>. </em>A metric filter turn log data into numerical CloudWatch metrics that you can graph or set an alarm on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnYxKduqFnZLaPhS_1WLAw.png" /></figure><p>An alarm performs one or more actions based on the value of the metric relative to a threshold over a number of time periods. In this case, we count the occurrence of the EXPLOIT event and if the number of occurrences is greater than 2 events we send a notification to our SOC (Security Operation Center) by an Amazon SNS topic.</p><h3>References</h3><p>[1] <a href="https://platella.medium.com/ids-ips-on-aws-part-i-an-overview-of-available-solutions-2896ee7c6d27">https://platella.medium.com/ids-ips-on-aws-part-i-an-overview-of-available-solutions-2896ee7c6d27</a></p><p>[2] <a href="https://platella.medium.com/amazon-vpc-deep-dive-on-vpc-traffic-mirroring-feature-a129e8a0132e">https://platella.medium.com/amazon-vpc-deep-dive-on-vpc-traffic-mirroring-feature-a129e8a0132e</a></p><p>[3] <a href="https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-how-it-works.html">https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-how-it-works.html</a></p><p>[4]<a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html">https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html</a></p><p>[5]<a href="https://github.com/PaoloL/ansible-suricata">https://github.com/PaoloL/ansible-suricata</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=562846806d58" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/ids-ips-on-aws-part-ii-detect-intrusion-on-aws-with-vpc-traffic-mirroring-and-suricata-562846806d58">IDS/IPS on AWS — Part II — Detect intrusion on AWS with VPC Traffic Mirroring and Suricata</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon VPC — Deep Dive on VPC Traffic Mirroring feature]]></title>
            <link>https://towardsaws.com/amazon-vpc-deep-dive-on-vpc-traffic-mirroring-feature-a129e8a0132e?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a129e8a0132e</guid>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Thu, 31 Mar 2022 11:01:55 GMT</pubDate>
            <atom:updated>2022-09-19T10:44:07.721Z</atom:updated>
            <content:encoded><![CDATA[<h3>Amazon VPC — Deep Dive on VPC Traffic Mirroring feature</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnDfckt_v68PpF0nj1cq8g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@hardlypink?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Victor Li</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>VPC Traffic Mirroring</h3><p>Traffic Mirroring is an Amazon Web Services (AWS) feature launched in 2019 on VPC service. This feature permits copying inbound/outbound traffic from/to a source and sending it to a target inside an Amazon VPC. Traffic Mirroring is an agentless method for capturing raw data packets and send to a target for content inspection, threat monitoring or troubleshooting.</p><h4>Traffic Mirroring components</h4><p>Traffic Mirroring copies inbound/outbound traffic from/to an Elastic Network Interface (ENI) and sends it to an Elastic Network Interface or Network Load Balancer (NLB). The components of a Traffic Mirroring resource are:</p><ul><li><strong>Mirror Source: </strong>is the ENI of an EC2 instance where we want to copy network traffic.</li><li><strong>Mirror Target:</strong> is the destination of mirrored traffic (currently only ENI or NLB)</li><li><strong>Mirror Filter:</strong> is a set of inbound and outbound rules that determine which kind of traffic we want to mirror. The <strong>Mirror Rules</strong> define which traffic is mirrored (for example TCP protocol on port 8080 outbound) and are evaluated from the lowest value to the highest value</li><li><strong>Mirror Session: </strong>is a relationship between a traffic mirror source, a traffic mirror target and a filter. A session encapsulates mirrored traffic on <a href="https://en.wikipedia.org/wiki/Virtual_Extensible_LAN">VXLAN</a> packets.</li></ul><p>The traffic mirror source and the traffic mirror target can be in the same VPC or different VPCs connected using a VPC peering (in the same region) or by a Transit Gateway (also in a different region). The traffic mirror target and traffic mirror source can be owned by a different AWS account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G10lu-GKjp1LBe2irh4yAQ.png" /><figcaption>VPC Traffic Mirroring Session</figcaption></figure><p>Mirrored traffic between source and target travel on VXLAN encapsulated packets. If the target is an ENI, the software on the EC2 instance should be able to parse these packets, if the target is an NLB the load balancer receives traffic on UDP port 4789 and redirect to one or more EC2 instances that should be able to parse this packets.</p><h4>VXLAN Encapsulation</h4><p>The VXLAN (Virtual eXtensible Local Area Network) framework, described in <a href="https://datatracker.ietf.org/doc/html/rfc7348">RFC 7348</a>, addresses some requirements of the network infrastructure in a multi-tenant environment (Cloud environment). Cloud providers can use the VXLAN framework to host multiple tenants, each with their own isolated network, on a network shared infrastructure. It uses the encapsulation technique to <strong>encapsulate OSI Layer 2 information within an OSI Layer 4 datagram</strong> using a well-known UDP port (4789) assigned by the IANA. VPC Traffic Mirroring leverages this framework to encapsulate the mirrored traffic and send it to a target — as an Intrusion Detection System — that should be able to parse it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYSe7NU5hj9ePEF1Fd4p2g.png" /><figcaption>IPV4 over VXLAN packet format</figcaption></figure><p>VPC Traffic mirroring useDstAddressin the outer headers to identify the IP address of the ENI or Network Load Balancer that is registered as target of the mirroring session. TheSrcAddress in the outer headers is the IP address of the ENI registered as source of the mirroring session. The VXLAN header includes a 24-bit field VNIthat is used to uniquely identify the VXLAN (you can customize this on VPC Traffic mirroring). In the inner headers, we have the content of the packet that the client sends to the server (an HTTP server in this example).</p><h4>Create Traffic Mirror resources</h4><p>The following tasks help you to create a traffic mirror session. A traffic mirror session is a relationship between a source and a target and defines which kind of packet we would capture. In this example, we would capture all TCP and UDP traffic that goes through the ENI of an EC2 instance with a focus on traffic from/to a specific CIDR block (192.168.0.0/16)</p><p>Step 1 — Create Traffic Mirror Target</p><pre>aws ec2 <strong>create-traffic-mirror-target</strong> --network-load-balancer-arn <em>IDS-LoadBalancer-arn</em></pre><p>You must configure a security group for the traffic mirror target that allows VXLAN traffic from the source to the target.</p><p>Step 2 — Create Traffic Mirror Filter</p><pre>aws ec2 <strong>create-traffic-mirror-filte</strong>r --tag-specifications &#39;ResourceType=traffic-mirror-filter,Tags=[{Key=&#39;Name&#39;,Value=&#39;MirroringTCP&amp;UDPTraffic&#39;}]&#39; --description &quot;Mirror TCP Traffic&quot;</pre><p>Use a traffic mirror filter as a container of mirroring rules to determine the traffic we want to mirror. Rules inside a filter are evaluated from the lowest value to the highest value and the first match wins.</p><p>Step 3A — Create Filter rules for TCP packets ingress/egress</p><pre>aws ec2 <strong>create-traffic-mirror-filter-rule</strong> --description &quot;TCP Rule Ingress&quot; --destination-cidr-block 192.168.0.0/16 <strong>--protocol 6</strong> --rule-action accept <strong>--rule-number 1</strong> --source-cidr-block 192.168.0.0/16<strong> --traffic-direction ingress</strong> --traffic-mirror-filter-id <em>TCPTrafficMirrorFilter</em></pre><pre>aws ec2 create-traffic-mirror-filter-rule --description &quot;TCP Rule Egress&quot; --destination-cidr-block 192.168.0.0/16 <strong>--protocol 6</strong> --rule-action accept <strong>--rule-number 1</strong> --source-cidr-block 192.168.0.0/16 <strong>--traffic-direction egress</strong> --traffic-mirror-filter-id <em>TCPTrafficMirrorFilter</em></pre><p>Step 3B— Create Filter rules for UDP packets ingress/egress</p><pre>aws ec2 <strong>create-traffic-mirror-filter-rule</strong> --description &quot;UDP Rule Ingress&quot; --destination-cidr-block 192.168.0.0/16 <strong>--protocol 17</strong>--rule-action accept <strong>--rule-number 2 </strong>--source-cidr-block 192.168.0.0/16<strong> --traffic-direction ingress</strong> --traffic-mirror-filter-id <em>TCPTrafficMirrorFilter</em></pre><pre>aws ec2 create-traffic-mirror-filter-rule --description &quot;UDP Rule Egress&quot; --destination-cidr-block 192.168.0.0/16 <strong>--protocol 17</strong>--rule-action accept <strong>--rule-number 2 </strong>--source-cidr-block 192.168.0.0/16 <strong>--traffic-direction egress</strong> --traffic-mirror-filter-id <em>TCPTrafficMirrorFilter</em></pre><p>Filter rules define traffic direction (inbound/outbound), action (accept/reject), protocol, source port range, destination port range, source CIDR block and destination CIDR block. Rules number define the priority inside a mirror filter.</p><p>Step 4— Create Traffic Mirror Session</p><pre>aws ec2 create-traffic-mirror-session --tag-specifications &#39;ResourceType=traffic-mirror-filter,Tags=[{Key=&#39;Name&#39;,Value=&#39;MirroringTCP&amp;UDP&#39;}]&#39; <strong>--traffic-mirror-target-id <em>NLBTrafficMirrorTarget</em> --network-interface-id eni-123456789</strong> --session-number 1 --traffic-mirror-filter-id <em>TrafficMirrodID</em></pre><p>A Traffic Mirror session is a relationship between a traffic mirror source (the ENI of the instance that we would analyze) the traffic mirror target (the NLB) and a session.<strong> If an ENI is attached to more than one session the session with the lower session number win</strong> (traffic is only mirrored one time).</p><p>To verify the VPC Traffic Mirroring feature you can capture the VXLAN packet on the primary interface on one of the EC2 instances behind the NLB using <strong>tcpdump </strong>tool [2]:</p><pre><strong>tcpdump -v -n -i eth0 port 4789 and udp[11:4] = 14445326</strong></pre><pre>16:37:06.561644 IP (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto UDP (17), length 146)<br> 172.31.89.233.65501 &gt; 172.31.91.76.4789: [no cksum] VXLAN, flags [I] (0x08), vni 14445326</pre><h3>Reference</h3><p>[1] <a href="https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-how-it-works.html">https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-how-it-works.html</a></p><p>[2] <a href="https://tcpdump101.com/">https://tcpdump101.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a129e8a0132e" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/amazon-vpc-deep-dive-on-vpc-traffic-mirroring-feature-a129e8a0132e">Amazon VPC — Deep Dive on VPC Traffic Mirroring feature</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IDS/IPS on AWS — Part I — An overview of available solutions]]></title>
            <link>https://towardsaws.com/ids-ips-on-aws-part-i-an-overview-of-available-solutions-2896ee7c6d27?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2896ee7c6d27</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[intrusion-detection]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Mon, 14 Mar 2022 11:27:13 GMT</pubDate>
            <atom:updated>2022-04-19T13:13:01.771Z</atom:updated>
            <content:encoded><![CDATA[<h3>IDS/IPS on AWS — Part I — An overview of available solutions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tgv3qqcCFQtVgPjFjsDlOA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@bernardhermant?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bernard Hermant</a> on <a href="https://unsplash.com/collections/87460454/computer-security-basics?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Prevention vs Detection</h3><p>Intrusion Detection System (IDS) and Intrusion Prevention System (IPS) are both systems that analyze network traffic looking for specific signatures, behaviours or anomalies that indicated an intrusion. The main difference between an IDS and an IPS is how the system reacts to intrusions attempts. An <strong>IDS</strong> is designed to detect a potential intrusion, generate an alert and register the incident to a database (in the meantime, the traffic keeps flowing). On the other hand, an <strong>IPS</strong> is designed to recognize an intrusion attempt and block it immediately leveraging a set of pre-configured rules. IDS and IPS both have their advantages and disadvantages but there is an important feature that drives the choice:<em> the IDS is a passive monitoring system, it doesn’t block the traffic, the IPS is an active monitoring system, it blocks the traffic!</em> So when selecting one of two systems it is important to consider the tradeoffs between the availability and security of our service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ve5_-2tZQxUI6d24iCFZdQ.png" /><figcaption>IDS/IPS Difference</figcaption></figure><h3>Intrusion Detection/Prevention on AWS Cloud</h3><p>Traditional IDS/IPS conduct detection at the network layer (usually by <a href="https://en.wikipedia.org/wiki/Network_tap">NTAP</a> or <a href="https://en.wikipedia.org/wiki/Port_mirroring">SPAN</a>) or host level. In a Cloud environment, the network is virtualized — a VPC is a virtual network dedicated to your account and logically isolated from other virtual networks in the AWS space — then the available options are:</p><ul><li><strong>Network Based — Cloud Native IDS/IPS systems</strong>: are managed services that make it easy to deploy network protections for our VPCs.</li><li><strong>Network Based — Virtualized IDS/IPS systems</strong>: are virtualized appliances provided by the market leaders that leverage cloud resources.</li><li><strong>Host Based — Agent IDS/IPS systems: </strong>are agents installed on VMs or containers that analyze local traffic and react to an intrusion attempt</li></ul><h4><strong>Cloud Native IDS/IPS systems</strong></h4><p>A Cloud native IDS/IPS system is a managed service that makes it easy to deploy intrusion protections for our VPCs. The service can be setup with just a few clicks and scales automatically with the network traffic without worry about deploying and managing any infrastructure. On AWS we have the following options:</p><p><a href="https://aws.amazon.com/it/network-firewall"><strong>AWS Network Firewall</strong></a></p><p>AWS Network Firewall is a managed IDS/IPS system based on <a href="https://suricata.io/">Suricata</a> open source threat detection engine. Network Firewall filter traffic at the perimeter of your Amazon VPC: you must create a <strong>firewall endpoint</strong> on a subnet, route traffic symmetrically to this endpoint using subnet route table and create a <strong>firewall policy</strong> (a set of criteria for inspecting and handling network traffic that cross the endpoint— the <strong>rules</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*-EAGioJfxVHhk-2A7o8_vA.png" /><figcaption>Basic North-South deployment of AWS Network Firewall</figcaption></figure><p>AWS Network Firewall is used to protect North-South / East-West traffic. For example in North-South Outbound traffic the workload subnet has a route to the NAT gateway, the public subnet has a route to the firewall endpoint in the corresponding AZ and the firewall subnet has a route to TGW. In North-South Inbound traffic, we can inspect traffic to Application Load Balancer (ALB).</p><p><a href="https://aws.amazon.com/it/guardduty/"><strong>Amazon GuarDuty</strong></a></p><p>Amazon GuardDuty is a cloud native IDS service that uses traffic data coming from VPC Flow Logs to detect threat behaviours. It uses threat intelligence feeds and <strong>machine learning</strong> models to identify malicious activity within our AWS environment. For example, GuardDuty can detect compromised EC2 instances serving malware or mining bitcoin. All GuardDuty findings are associated with a <strong>detector</strong>, which is a regional entity that analyzes traffic coming from different <strong>data source </strong>(VPC flow logs, DNS logs, Cloudtrail logs, Kubernetes logs). If a potential security issue was detected within your network Guarduty generate a <strong>finding</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERqj8GpqdE40qR4w2-KnfA.png" /><figcaption>GuardDuty EC2 finding example</figcaption></figure><p>As GuardDuty spans the entire VPC, it monitors North-South traffic as well as East-West. Amazon GuardDuty is extremely simple to deploy and don’t require specialised skills to operate. It is a good first level of defence but covers a limited set of threat signatures and attack behaviour [2]</p><h4><strong>Virtualized IDS/IPS systems</strong></h4><p>Often the customer prefers to move to cloud the IDS/IPS solutions that they already have on-premises. In this case, we have two options: the first one is to look on <a href="https://aws.amazon.com/marketplace/search?searchTerms=IDS%2BIPS">AWS Marketplace</a> hoping to find the same (virtualized) solution, the second one is to try to replicate as-is the on-premises architecture in the cloud installing the IDS/IPS software on EC2, configuring the network and trying to enable HA feature hoping it doesn’t collide with VPC limitations. In both cases Amazon provides two capabilities that support this configuration:</p><ul><li><strong>Gateway Load Balancer</strong> Service: a service, in the family of Amazon Elastic Load Balancers, launched at the end of 2020. It combines a transparent network layer 3 gateway with a load balancer. The Gateway Load Balancer listens for all IP packets across all ports and forwards traffic to the target group that’s specified in the listener rule. The most important feature of this kind of load balancer is the ability to maintain stickiness of flows to a specific target appliance using the tuple (for TCP/UDP flows): source IP address, source port, destination IP address, destination port, transport protocol.</li><li><strong>Gateway Load Balancer Endpoint:</strong> an Amazon VPC endpoint that provides private connectivity between virtual appliances in the service provider VPC (a partner that provides IDS/IPS service) and application servers in the service consumer VPC (you). Gateway Load Balancers use Gateway Load Balancer endpoints to securely exchange traffic across VPC boundaries.</li><li><strong>Appliance Mode VPC</strong>: an Amazon VPC feature that we must enable if we would inspect traffic that goes through a Transit Gateway — usually used in <em>Spoke-and-Hub</em> VPC configuration. When enabled, Transit Gateway create an association between the ENI of Transit Gateway in a specific Availability Zone and the ENI of EC2 Instances on the same Availability Zone for the lifetime of traffic flow. This feature avoids asymmetric routing and guarantees persistence on the same VMs firewall[3]</li><li><strong>VPC Traffic Mirroring</strong>: an Amazon VPC feature that copies inbound/outbound traffic from/to an Elastic Network Interface (ENI) and sends it to an Elastic Network Interface or Network Load Balancer (NLB) for content inspection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PS-vau2aJVeLuRKPR1zI7w.png" /><figcaption>IDS/IPS Multi Account Architecture with Gateway Load Balancer</figcaption></figure><h4><strong>Agent IDS/IPS systems</strong></h4><p>Agent IDS/IPS or Host Based Intrusion Detection System (HIDS/HIPS) monitor inbound and outbound packets from/to the EC2 instance thanks to an agent installed onboard. A host based solution have pros and cons:</p><ul><li><strong>Pros</strong>: can detect a change in system files, can inspect system memory, can inspect encrypted data.</li><li><strong>Cons</strong>: more complex to manage, require a centralized server for data collection, the attacker can compromise the host and shut down the agent.</li></ul><p>On AWS, a solution agent-based is simple to deploy and require two things: an EC2 instance for agent management and a service for collecting data that come from the agent. For example, on AWSLabs there is a Cloudformation template that implements a solution with Amazon Cloudwatch Logs, Amazon Elasticsearch and Kibana [4].</p><p><strong>A solid security sonfiguration should include both systems</strong> — a HIDS and a NIDS — as they work together in a way meant to be complementary.</p><h3>References:</h3><p>[1] <a href="https://aws.amazon.com/it/blogs/networking-and-content-delivery/deployment-models-for-aws-network-firewall/">https://aws.amazon.com/it/blogs/networking-and-content-delivery/deployment-models-for-aws-network-firewall/</a></p><p>[2]<a href="https://d1.awsstatic.com/certifications/foregenix_amazon_guardduty_security_review_07-2020.pdf">https://d1.awsstatic.com/certifications/foregenix_amazon_guardduty_security_review_07-2020.pdf</a></p><p>[3]<a href="https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-appliance-scenario.html">https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-appliance-scenario.html</a></p><p>[4]<a href="https://github.com/awslabs/hids-cloudwatchlogs-elasticsearch-template/blob/master/README.md">https://github.com/awslabs/hids-cloudwatchlogs-elasticsearch-template/blob/master/README.md</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2896ee7c6d27" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/ids-ips-on-aws-part-i-an-overview-of-available-solutions-2896ee7c6d27">IDS/IPS on AWS — Part I — An overview of available solutions</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced customization of AWS Elastic Beanstalk — Environment Configu]]></title>
            <link>https://awstip.com/advanced-customization-of-aws-elastic-beanstalk-environment-configu-ceff37228bce?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceff37228bce</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[elastic-beanstalk]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Thu, 02 Dec 2021 13:35:07 GMT</pubDate>
            <atom:updated>2022-04-06T09:11:10.845Z</atom:updated>
            <content:encoded><![CDATA[<h3>Advanced customization of AWS Elastic Beanstalk — Environment Configuration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooPbZ8Q5zzvPC_OfDlqSog.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Kelly Sikkema</a> on <a href="https://unsplash.com/s/photos/custom?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Elastic Beanstalk is not my favourite service, but …</h3><p>I would like to start this story by saying that Elastic Beanstalk is not my favourite AWS service to deploy and manage applications in Cloud — I prefer to use AWS <a href="https://aws.amazon.com/it/cloudformation/">Cloudformation</a> for Infrastructure automation, Ansible or Chef to automate EC2 instances configuration and AWS <a href="https://aws.amazon.com/it/codedeploy">CodeDeploy</a> to deploy and manage applications. However Elastic Beanstalk is the right tool if we would quickly deploy and manage applications in the AWS Cloud without having to learn details of the infrastructure that runs those applications. Elastic Beanstalk becomes very interesting if we start to customize the application platform (ex. Java8 with Apache Tomcat on Amazon Linux AMI) and/or related environment’s resources (EC2, RDS, ELB, etc).</p><h3>Customize Elastic Beanstalk Environment</h3><p>When you deploy an <strong>application version</strong>, all AWS resources required to run and support this application version are defined by an environment. An <strong>environment</strong> is a collection of AWS resources (EC2, ELB, RDS, etc) that Elastic Beanstalk automatically provide and configure for us. We can customize the resources created during creation / running of an environment using the environment configuration feature. An <strong>environment configuration</strong> identifies a collection of parameters and settings that you pass to the service to define how the environment must be created.</p><h4>Configuration options</h4><p>Configuration options are directives related to a specific AWS resource that tells to Elastic Beanstalk how that resource will be created. Configuration options are organized as below:</p><pre>option_settings:   <br>  - namespace:  <em>namespace</em>     <br>  - option_name:  <em>option name</em>     <br>  - value:  <em>option value</em></pre><p>We can set configuration option by Web console, <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cmd-commands.html">EB CLI</a> or <a href="https://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/index.html">AWS CLI</a> during environment creation or after the environment was created. Configuration option value can be passed in saved configurations, configuration files or as command line parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swrwR4OiITosJlFRiyoVKQ.png" /><figcaption>Elaastic Beanstalk Configuration options by stage and client</figcaption></figure><p>If the same option is set in multiple locations, the value used is determined by the following order of precedence:</p><ol><li>settings specified during a create/update environment API</li><li>settings loaded from a saved configuration.</li><li>settings loaded from configuration files in the .ebextensions folder</li><li>settings loaded as default value</li></ol><p>When you update an environment, Elastic Beanstalk automatically applies the changes to existing resources or recreate new resources (depending on the type of change) — Elastic Beanstalk use AWS Cloudformation to create and update environment’s resources</p><h4>Configuration files (.ebextensions)</h4><p>You can specify configuration options by configuration files (.ebextensions) that you bundle on your application&#39;s source code. Configuration files are YAML or JSON documents with a .config file extension that you place in a folder named .ebextensions in the root of your source bundle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O86PH6eXbJoTu0oao4vEfA.png" /><figcaption>option_settings section in a configuration file</figcaption></figure><p>In the example above we are customizing autoscaling group of our Elastic Beanstalk environment using aws:autoscaling:asg namespace and related launch configuration using aws:autoscaling:launchconfiguration namespace.</p><p>In a .ebextensions file we can customize the natiive resources (for example the EC2 instance type) or we can create new resources (for example an Amazon ElastiCache cluster):</p><ul><li>Using option_settings section in a configuration file we can customize configuration of a AWS resource natively supported by Elastic Beanstalk. Here an example of this configuration: <a href="https://github.com/PaoloL/aws-elasticbeanstalk/blob/main/PythonHelloWorld/.ebextensions/autoscaling.config">https://github.com/PaoloL/aws-elasticbeanstalk/blob/main/PythonHelloWorld/.ebextensions/autoscaling.config</a></li><li>Using Resourcesand Parameterssection in a configuration file we can define additional AWS resources (any supported by CloudFormation). Here an example of this configuration: <a href="https://github.com/PaoloL/aws-elasticbeanstalk/blob/3dfaa75f54c0427db0030d941c7c1c49cbc240d3/PythonHelloWorld/.ebextensions/resources.config">https://github.com/PaoloL/aws-elasticbeanstalk/blob/main/PythonHelloWorld/.ebextensions/resources.config</a></li></ul><p>For example in the <a href="https://github.com/PaoloL/aws-elasticbeanstalk/tree/main/PythonHelloWorld">PythonHelloWorld</a> repository we create two custom security groups: one for the Elastic Load Balancer and one for the EC2 Instances and tell Elastic Beanstalk to use these two security groups during environment configuration [1].</p><h4>Saved Configuration</h4><p>After an environment was created we can save the configuration in a JSON file and reuse it later to create a new environment with the same configuration.</p><p>To <strong>save</strong> a configuration using EB CLI or AWS CLI</p><pre><strong>EB CLI:</strong> eb config save <em>environment-name</em> <strong>--cfg <em>saved-config-name</em></strong></pre><pre><strong>AWS CLI:</strong> aws elasticbeanstalk create-configuration-template --environment-id <em>env-id</em> --application-name <em>app-name</em> <strong>--template-name <em>saved-config-name</em></strong></pre><p>Obviously saved configurations don’t include settings applied with configuration files (.ebextensions) in your application’s source code.</p><p>To <strong>create</strong> an Elastic Beanstalk environment using a saved configuration by EB CLI or AWS CLI</p><pre><strong>EB CLI:</strong> eb create <em>environment-name </em><strong>--cfg <em>saved-config-name</em></strong></pre><pre><strong>AWS CLI:</strong> aws elasticbeanstalk create-environment --environment-name <em>env-name</em> --application-name <em>app-name </em><strong>--template-name </strong><strong><em>saved-config-name</em></strong></pre><p>To <strong>update</strong> an Elastic Beanstalk environment using a saved configuration by EB CLI or AWS CLI</p><pre><strong>EB CLI:</strong> eb update <em>environment-name</em> <strong>--cfg <em>saved-config-name</em></strong></pre><pre><strong>AWS CLI: </strong>aws elasticbeanstalk update-environment --environment-name <em>env-name</em> <strong>--template-name <em>saved-config-name</em></strong></pre><h4>Options in Command Line</h4><p>Elastic Beanstalk command line and AWS command line permit to specify the configuration option as parameters in the command string.</p><p>The EB CLI eb createcommand accept options during environment creation. We can use these options to add an RDS database or specify the VPC configuration or override value already specified in the configuration file.</p><pre>eb create <em>environment-name </em><strong>--database</strong> <strong><em>--</em>vpc.id</strong> <em>vpc-id</em> <strong>--vpc.elbsubnets</strong> <em>subnet-1a,subnet-1b</em> <strong>--vpc.ec2subnets</strong> <em>subnet-2a,subnet-2b</em></pre><p>The AWS CLI aws elasticbeanstalk create-environmentcommand accept options during environment creation. We can specify the options as a json statement in the string command</p><pre>aws elasticbeanstalk create-environment --environment-name <em>env-name</em> --application-name <em>app-name</em> <strong>--option-settings </strong><strong><em>&#39;json statement&#39;</em></strong></pre><p>We can also specify the options as a json file</p><pre>aws elasticbeanstalk create-environment --environment-name <em>env-name</em> --application-name <em>app-name </em><strong>--option-settings file://myoptions.json</strong></pre><p>The AWS CLI aws elasticbeanstalk update-environmentcommand accept options after environment creation. We can specify the options as a json statement in the string command or we can specify a json file.</p><h3>Links and references</h3><p>[1] On date 02/12/2021 there is an <a href="https://github.com/aws/elastic-beanstalk-roadmap/issues/44">open issue</a> on AWS because Elastic Benstalk continue to create the default security groups for ASG.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceff37228bce" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/advanced-customization-of-aws-elastic-beanstalk-environment-configu-ceff37228bce">Advanced customization of AWS Elastic Beanstalk — Environment Configu</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part II — Automate everything]]></title>
            <link>https://towardsaws.com/let-your-builders-manage-their-dns-in-aws-cloud-with-amazon-route53-part-ii-automate-everything-38327a67c48e?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/38327a67c48e</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Tue, 27 Apr 2021 12:56:13 GMT</pubDate>
            <atom:updated>2022-09-19T10:43:34.366Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part II — Automate everything</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wC3BdUQo2uZwNiZ_lsRFbg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lennykuhne?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Lenny Kuhne</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Cloud Agility — DNS Configuration</h3><p>To improve their Cloud agility<strong>, </strong>the companies must adopt a new operating model, decentralized and based on DevOps principles, that <strong>permit our builders to experiment and innovate quickly and safely [1]. </strong>The DNS delegation using Amazon Route53 features is an example of how we can make our builders autonomous in creating and update DNS record during a release of new features or products. In <a href="https://platella.medium.com/let-your-builders-manage-their-dns-in-aws-cloud-with-amazon-route53-part-i-delegate-dns-9c77b561c560">Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part I — Delegate DNS Management</a>, I describe how to leverage Route53 features to delegate setup and management of DNS to our builders. This new story will describe <strong>how to set up a new AWS account with DNS delegation already in place</strong> using AWS Service Catalog, Cloudformation and Lambda.</p><h4>Networking services in a multi-account environment</h4><p>Use a multi-account environment is an AWS best practice that offers several benefits [2]. In a multi-account environment, the networking services such as Amazon Route53, AWS Transit Gateway and Network firewall usually works on a shared account while the builders develop and test their applications launching resources on different accounts, dedicated to the project. In terms of separation of duties, the shared networking services account is managed by CCoE team while our builders are free to experiment (inside the guardrails that CCoE has defined) on the project accounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*yufbDcinP4LtV-UQRwKP3A.png" /><figcaption>Multi-Account Architecture and Shared Network Services</figcaption></figure><p><strong>A decentralized model of governance works fine only if the CCoE simplifies the job of our builders and allows the company to speed up the release of new products and services.</strong> This means that we must define an account provisioning process that:</p><ol><li><em>Automate account creation</em> — permit our builders to create their own project account when the business requires a new product.</li><li><em>Launches a pre-approved set of configurations</em> — permit our builders to start with a set of resources pre-approved and already configured.</li></ol><p>This means, that when AWS Control Tower create a new account the automation process must also configure resources, such as the Route53 public/private hosted zones.</p><h3>Automate Everything</h3><p>There are several ways to automate account provisioning and related resources configurations. In this story, we will use the account factory feature of <a href="https://aws.amazon.com/it/controltower/">AWS Control Tower</a> that’s, in truth, part of the <a href="https://aws.amazon.com/it/servicecatalog/">AWS Service Catalog.</a> Keeping in minds that in this story we would like to automate DNS delegation, the account factory process must:</p><ol><li>Create the project account and configure public/private hosted zone.</li><li>Automate the delegation of DNS in a multi-account environment</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rOs_qczKbJfDDxVCe_Qxeg.png" /><figcaption>Account factory process with DNS delegation</figcaption></figure><h4><strong>AWS Service Catalog</strong></h4><p>AWS Service Catalog enables organizations to create and manage catalogs (portfolios) of pre-approved IT services (products). These IT services can include everything from virtual machine images to complete multi-tier application architectures. In this case, our portfolio is an account vending machine and our product is the AWS account. To guarantee the separation of duties, AWS Service Catalog supports the following types of users:</p><ul><li><strong>Catalog Administrators (CCoE)</strong>— Manage a catalog of IT service organizing them into portfolios and granting access to end-users.</li><li><strong>End users (Builders)</strong>— Use the AWS Management Console to launch products to which they have been granted access.</li></ul><p>The CCoE, as catalogue administrator, writes a Cloudformation template that creates an AWS account and configures related resources, then upload on the service catalogue and grants accesses to our builders. The builders, as end-users, launch the AWS account creation product that will create the resources stack. The CCoE must also configure the right IAM roles to permits cross-account actions [3].</p><h4>Automate the account creation</h4><p>The account creation process leverage AWS Cloudormation <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html">custom resources</a> to invoke AWS Organization API through a Lambda function.</p><pre>AWSTemplateFormatVersion: 2010-09-09<br>Description: Customized Account Builder Template.<br>[...]</pre><pre>Parameters:<br><br>  AccountEmail:<br>   Description: &quot;Account Email address&quot;<br>   Type: String<br>   <br>  AccountName:<br>    Description: &quot;Name of the new AWS Account Name&quot;<br>    Type: String<br>  [...]</pre><pre>Resources:<br>  AccountBuilderLambda:<br>    Type: &quot;AWS::Lambda::Function&quot;<br>    Properties:<br>      <strong>Handler: &quot;AccountCreationLambda.main&quot;</strong><br>      [...]<br>      Environment:<br>        <strong>Variables:<br>          &#39;account_email&#39; : !Ref AccountEmail<br>          &#39;account_name&#39; : !Ref AccountName</strong></pre><pre>LambdaExecuteRole:<br>    Type: &quot;AWS::IAM::Role&quot;<br>    Properties:<br>      [...]<br><br><strong>  TriggerAccountBuilderLambda:<br>    Type: &quot;Custom::TriggerAccountBuilderLambda&quot;<br>    DeletionPolicy: Retain<br>    DependsOn:<br>    - AccountBuilderLambda<br>    - LambdaExecuteRole<br>    Properties:<br>      ServiceToken: !GetAtt AccountBuilderLambda.Arn</strong></pre><pre>Outputs:<br>  AccountID:<br>    Description: ID of the new account<br>    Value: !GetAtt &#39;TriggerAccountBuilderLambda.AccountID&#39;<br>  [...]</pre><p>The property <em>Handler: “AccountCreationLambda.main”</em><strong> </strong>of resource <em>AccountBuilderLambda</em> is the method in your function code that processes events. When your function is invoked, Lambda runs the handler method. The Cloudformation parameters <em>AccountName</em> and <em>AccountEmail </em>can be passed as environment variables in the Lambda function. The handler method gets the environment variable and creates the account.</p><pre>def main(event,context):<br>    account_name = os.environ[&#39;account_name&#39;]<br>    account_email = os.environ[&#39;account_email&#39;]<br>    [...]<br>    <strong>if (event[&#39;RequestType&#39;] == &#39;Create&#39;):</strong><br>        <em>#Create the new account using CreateAccount API</em><br>        respond_cloudformation(event, &quot;SUCCESS&quot;, { &quot;Message&quot;: &quot;Resource created successful!&quot; })<br>    [...]</pre><p>The <a href="https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreateAccount.html">CreateAccount</a> API of AWS Organization creates the new AWS account and preconfigures an IAM role in the member account. When the account creation operation is completed we can assume this role to execute any operation on member account (the role has administrator permissions in the new member account). Here an example using Boto3</p><pre>response <strong>=</strong> client_to_organization<strong>.</strong>create_account(<br>    Email=account_email,<br>    AccountName<strong>=</strong>account_name,<br>    RoleName<strong>=</strong>&#39;<strong>AdministrationFromOrganization</strong>&#39;<br>)</pre><p>About how to create a new account using AWS Organization API and Python3, please look at <a href="https://github.com/PaoloL/account-automation">https://github.com/PaoloL/account-automation</a></p><p>Now we can get back to Cloudformation with information related to our new AWS Account. On <em>Data </em>we can put values that Lambda as custom resource return to Cloudformation as properties of the resource.</p><pre>def respondTocloudformation(event, status, data=None):<br>    responseBody = {<br>        &#39;Status&#39;: SUCCESS,<br>        &#39;<strong>Data&#39; : {<br>           &#39;Message&#39;: &#39;Account Created!&#39;, <br>           &#39;LoginURL&#39; : &quot;https://&quot;accountid.signin.aws.amazon.com&quot;, <br>           &#39;AccountID&#39; : account_id, <br>           &#39;Username&#39; : username, <br>           &#39;Role&#39; : newrole, <br>           &#39;Stackregion&#39;: stackregion</strong><br>            }<br>     }<br>    requests.put(event[&#39;ResponseURL&#39;],data=json.dumps(responseBody))</pre><h4><strong>Automate the delegation process — Synchronous mode</strong></h4><p>When the account creation is completed, in order to set up the DNS delegation we need to make configurations on both the member account (CCMD-EUCOM-SixthFleet) and shared services account (CCMD-TRANSCOM).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwFhoTV-uMfMIGGn1idIRg.png" /><figcaption>Workflow for DNS delegation (<strong>Synchronous</strong>)</figcaption></figure><p>This means that we need to add three more Lambda functions on our Cloudformation template (as custom resources) to implement the workflow above. This workflow is <strong>synchronous</strong> which means that the login URL and credential for the new account will be available only at the end of the entire creation process.</p><p><strong>Create Private Hosted Zone</strong></p><p>The first step of our delegation process is the creation of a private hosted zone in the CCMD-EUCOM-SixthFleet account and associate this zone with the project VPC. This step takes place adding a dedicated custom resource (Lambda function) on AWS Cloudormation.</p><pre>AWSTemplateFormatVersion: 2010-09-09<br>Description: Customized Account Builder Template.<br>[...]</pre><pre>Parameters:</pre><pre>  PrivateHostedZoneName:<br>   Description: &quot;Private Hosted Zone Name&quot;<br>   Type: String<br>   <br>  AccountName:<br>    Description: &quot;Name of the project account&quot;<br>    Type: String</pre><pre>  VPCId:<br>    Description: &quot;ID for VPC association&quot;<br>    Type: String<br>  [...]</pre><pre>Resources:</pre><pre>CreatePrivateHostedZoneLambda:<br>    Type: &quot;AWS::Lambda::Function&quot;<br>    Properties:<br>      Handler: &quot;PrivateHostedZoneCreationLambda.main&quot;<br>      [...]<br>      Environment:<br>        Variables:<br>          &#39;phz_name&#39; : !Ref PrivateHostedZoneName<br>          &#39;account_name&#39; : !Ref AccountName<br>          &#39;vpc_id&#39; : !Ref VPCId</pre><pre>TriggerCreatePrivateHostedZoneLambda:<br>    <strong>Type: &quot;Custom::TriggerCreatePrivateHostedZoneLambda&quot;</strong><br>    DeletionPolicy: Retain<br>    DependsOn:<br>    - CreatePrivateHostedZoneLambda<br>    - LambdaExecuteRole<br>    Properties:<br>      ServiceToken: !GetAtt CreatePrivateHostedZoneLambda.Arn</pre><p>The Lambda function <em>CreatePrivateHostedZoneLambda</em> must assume the role <em>AdministrationFromOrganization</em> on account CCMD-EUCOM-SixhtFleet [4] before executing the creation of the private hosted zone and attach it to the VPC.</p><pre>def assumeRoleInMemberAccount(self, role_arn):<br>    try:<br>        role_session_name = &quot;SessionFromManagementAccount&quot;<br>        assumed_role_object = <strong>self.client_to_sts.assume_role(RoleArn=role_arn, RoleSessionName=role_session_name)</strong><br>        return assumed_role_object<br>    except Exception as e:<br>        print(e)</pre><pre>[...]</pre><pre>def createPrivateHostedZone(self, phz_name, vpc_id):<br>    try:<br>        response <strong>=</strong> <strong>client_to_r53.create_hosted_zone(Name=phz_name,VPC={<br>        &#39;VPCRegion&#39;:&#39;eu-west-1&#39;,<br>        &#39;VPCId&#39;: vpc_id },<br>        CallerReference=&#39;request-&#39;+time.time()<br>        HostedZoneConfig=<br>        {<br>            &#39;Comment&#39;: &#39;Private Hosted Zone for project A&#39;,<br>            &#39;PrivateZone&#39;: True<br>        })</strong><br>    except Exception as e:<br>        print(e)</pre><p><strong>Create Authorization Association</strong></p><p>The second step of our delegation process authorizes the CCMD-TRANSCOM account to receive association from VPC in CCMD-EUCOM-SixthFleet account. This step takes place by adding a dedicated custom resource (Lambda function) on AWS Cloudormation.</p><pre>AWSTemplateFormatVersion: 2010-09-09<br>Description: Customized Account Builder Template.<br>[...]</pre><pre>Parameters:</pre><pre>  PrivateHostedZoneName:<br>    Description: &quot;Private Hosted Zone Name&quot;<br>    Type: String<br>   <br>  AccountName:<br>    Description: &quot;Name of the project account&quot;<br>    Type: String</pre><pre>  VPCId:<br>    Description: &quot;ID for VPC association&quot;<br>    Type: String</pre><pre>[...]</pre><pre>Resources:<br>CreateAuthorizationAssociationLambda:<br>    Type: &quot;AWS::Lambda::Function&quot;<br>    Properties:<br>      Handler: &quot;AuthorizationAssociationLambda.main&quot;<br>      [...]<br>      Environment:<br>        Variables:<br>          &#39;phz_name&#39; : !Ref PrivateHostedZoneName<br>          &#39;accountname&#39; : !Ref account_name</pre><pre>TriggerAuthorizationAssociationLambda:<br>    <strong>Type: &quot;Custom::TriggerAuthorizationAssociationLambda&quot;</strong><br>    DeletionPolicy: Retain<br>    DependsOn:<br>    - AuthorizationAssociationLambda<br>    - LambdaExecuteRole<br>    Properties:<br>      ServiceToken: !GetAtt AuthorizationAssociationLambda.Arn</pre><p>The Lambda function <em>CreateAuthorizationAssociationLambda</em> must assume a role on account CCMD-TRANSCOM that permit the creation of the VPC authorization association.</p><pre>def assumeRoleInSharedAccount(self, role_arn):<br>    try:<br>        role_session_name = &quot;SessionFromSharedAccount&quot;<br>        assumed_role_object = self.client_to_sts.assume_role(RoleArn=role_arn, RoleSessionName=role_session_name)<br>        return assumed_role_object<br>    except Exception as e:<br>        print(e)</pre><pre>[...]</pre><pre><strong>def createAssociationAuthorization(self, phz_id, vpc_id):<br>    try:<br>       response = self.client_to_r53.create_vpc_association_authorization(<br>    HostedZoneId=phz_id,<br>    VPC={<br>        &#39;VPCRegion&#39;: &#39;eu-west-1&#39;,<br>        &#39;VPCId&#39;: vpc_id<br>    })<br>    except Exception as e:<br>        print(e)</strong></pre><p><strong>Submit association</strong></p><p>The third step of our delegation process creates an association between the private hosted zone in the CCMD-TRANSCOM account and the VPC in CCMD-EUCOM-SixthFleet account. This step takes place by adding a dedicated custom resource (Lambda function) on AWS Cloudormation.</p><pre>SubmitAssociationLambda:<br>    Type: &quot;AWS::Lambda::Function&quot;<br>    Properties:<br>      Handler: &quot;SubmitAssociationLambda.main&quot;<br>      [...]<br>      Environment:<br>        Variables:<br>          &#39;phz_name&#39; : !Ref account_email<br>          &#39;accountname&#39; : !Ref account_name</pre><pre>TriggerSubmitAssociationLambda:<br>    <strong>Type: &quot;Custom::TriggerSubmitAssociationLambda&quot;</strong><br>    DeletionPolicy: Retain<br>    DependsOn:<br>    - AuthorizationAssociationLambda<br>    - LambdaExecuteRole<br>    Properties:<br>      ServiceToken: !GetAtt AuthorizationAssociationLambda.Arn</pre><p>The Lambda function <em>SubmitAssociationLambda</em> must assume the role <em>AdministrationFromOrganization </em>on account CCMD-EUCOM-SixhtFleet before to associate the VPC with private hosted zone in CCMD-TRANSCOM</p><pre>def assumeRoleInMemeberAccount(self, role_arn):<br>    try:<br>        role_session_name = &quot;SessionFromSharedAccount&quot;<br>        assumed_role_object = self.client_to_sts.assume_role(RoleArn=role_arn, RoleSessionName=role_session_name)<br>        return assumed_role_object<br>    except Exception as e:<br>        print(e)</pre><pre>[...]</pre><pre><strong>def createVPCAssociation(self, phz_id, vpc_id):<br>    try:<br>       response = client_to_r53.associate_vpc_with_hosted_zone(<br>    HostedZoneId=phz_id,<br>    VPC={<br>        &#39;VPCRegion&#39;: &#39;eu-west-1&#39;,<br>        &#39;VPCId&#39;: vpc_id<br>    },<br>    Comment=&#39;Private Hosted Zone for project A&#39;<br>)<br>    except Exception as e:<br>        print(e)</strong></pre><h4>Automate the delegation process — Asynchronous mode</h4><p>We can move out of the account builder Cloudformation template the Lambda functions (CreatePrivateHostedZone, CreateAuthorizationAssociation and SubmitAssociation) that implement Route53 configuration and add Cloudwatch Events (aka Amazon Eventbridge) to decouple the account creation from the rest of the configuration. In this case, when the first Lambda function complete the account creation, Cloudformation come back to AWS Control Tower that will send the event <em>CreateManagedAccount </em>to an SNS topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIHq3RYZCqjwEIvWkwnVSA.png" /><figcaption>Example of Cloudwatch event with SNS topic</figcaption></figure><p>Attaching an AWS Step Function to SNS topic we can intercept the <em>CreateManagedAccount</em> event and launch an automation (serverless) workflow that will configure the resources on new member account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZlSyMN8kP5n3hJB8GFFZw.png" /><figcaption>Workflow for DNS delegation (<strong>Asynchronous</strong>)</figcaption></figure><p>Introducing AWS Step Function, the account configuration process is more flexible and totally <strong>asynchronous. </strong>We can create workflows very complex that configure all resources necessary for our builders in the new account.</p><h3>Conclusions</h3><p>A decentralized model of governance works fine only if the CCoE simplifies the job of our builders and allows the company to speed up the release of new products and services. This means that we must define an account provisioning process that <strong>automates account creation and launches a pre-approved set of configurations</strong>. The DNS delegation using Amazon Route53 features is an example of pre-approved configuration that speed up the release of new features or products — Agility. At the same time, the CCoE is responsible for defining and applying the right guardrails on accounts that developers create for their projects — Safety. The same process described here can be used to automate guardrails activation.</p><p>[1] <a href="https://aws.amazon.com/it/blogs/apn/governance-in-the-aws-cloud-the-right-balance-between-agility-and-safety/">https://aws.amazon.com/it/blogs/apn/governance-in-the-aws-cloud-the-right-balance-between-agility-and-safety/</a></p><p>[2] <a href="https://aws.amazon.com/it/organizations/getting-started/best-practices/">https://aws.amazon.com/it/organizations/getting-started/best-practices/</a></p><p>[3]<a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html">https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html</a></p><p>[4] <a href="https://aws.amazon.com/it/premiumsupport/knowledge-center/lambda-function-assume-iam-role/">https://aws.amazon.com/it/premiumsupport/knowledge-center/lambda-function-assume-iam-role/</a></p><p>[5] <a href="https://docs.aws.amazon.com/controltower/latest/userguide/lifecycle-events.html">https://docs.aws.amazon.com/controltower/latest/userguide/lifecycle-events.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38327a67c48e" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/let-your-builders-manage-their-dns-in-aws-cloud-with-amazon-route53-part-ii-automate-everything-38327a67c48e">Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part II — Automate everything</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part I — Delegate DNS]]></title>
            <link>https://towardsaws.com/leave-our-builders-to-manage-their-dns-in-aws-cloud-with-amazon-route53-part-i-delegate-dns-9c77b561c560?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c77b561c560</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Fri, 16 Apr 2021 18:12:47 GMT</pubDate>
            <atom:updated>2022-04-05T11:05:48.344Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part I — Delegate DNS management</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5xbE6hQ_iHlGHGYSfWT0g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@mvdheuvel?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Maarten van den Heuvel</a> on <a href="https://unsplash.com/s/photos/self-service?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Experiment and innovate quickly and safely</h3><p>The right cloud operating model permits our builders to experiment quickly and safely, leveraging best practices and design principles that the <strong>Cloud Center of Excellence (CCoE)</strong> has defined for our organization. In order to speed up the release of new products or services, the companies must adopt a model of governance that permits our builders to create their account and configure the DNS autonomously (<strong>Agility</strong>) maintaining control over cost, compliance and security (<strong>Safety</strong>) [1]. In this story — Part I — I will describe how to leverage Route53 features to delegate setup and management of DNS to our builders. In the next stories, I will describe how to automate and control this delegation procedure— Part II.</p><h3>Delegate Route53 public/private hosted zone management to our builders</h3><p>Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. You can use Route 53 to perform three main functions in any combination: domain registration, DNS routing, and health checking. Route53 provides Public and Private Hosted Zones.</p><ul><li><em>Public hosted zones </em>contain records that specify how you want to route traffic on the internet.</li><li><em>Private hosted zones</em> contain records that specify how you want to route traffic in an Amazon VPC.</li></ul><p>When a new project start, usually we need to configure a DNS to test and publish new services or features. Most of the companies resolve this requirement putting a resource broker team between the builder and Cloud resources. This approach guarantees maximum controls but reduces agility. <strong><em>We have to delegate to our builder the setup and management of the DNS under standard and design principles that the CCoE has defined and maintain a separation of duties between DNS owner and builders.</em></strong></p><h4>Reference architecture</h4><p>Use a multi-account environment is an AWS best practice that offers several benefits [2]. For example, we can create an account for shared infrastructure services such as networking or logging services and connect to the project’s accounts in a <em>hub-and-spoke</em> model. Use of shared services permits, also, builders to inherit standardized architectures during the development of new services. The DNS is a typical service that usually works on a shared infrastructure/account. In this story we have:</p><ol><li>Account CCMD-TRANSCOM is a shared account where we will put shared networking resources as the DNS Public/Private Hosted Zone. In terms of separation of duties, this account is managed by CCoE team.</li><li>Account CCMD-EUCOM-SixtFleet is an account that host the project’s resources. In terms of separation of duties on this account our builders are completely autonomous (inside the guardrails that CCoE has defined</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*rurdfFZ0o34maayryCs9rw.png" /><figcaption>Reference Architecture</figcaption></figure><h4>Delegate Public Hosted Zone</h4><p>Delegation of a public hosted zone on Route53 it’s pretty simple. Look at the architecture reference above and suppose that the top level of our DNS is <em>ccmd.cloud. </em>Now suppose that we would delegate to our builders the setup and management of domain <em>sixtfleet.eucom.ccmd.cloud </em>on project’s account<em>. </em>The right approach to delegate the management is the following:</p><p><em>Step-1</em>: on account CCMD-EUCOM-SixtFleet create <em>sixtfleet.eucom.ccmd.cloud p</em>ublic hosted zone and take note of NS records generated by Route53</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vhvcsaSVFx_iC3wbk2Egg.png" /><figcaption>Route53 Records on CCMD-TRANSCOM</figcaption></figure><p><em>Step-2</em>: on account CCMD-TRANSCOM under the <em>ccmd.cloud</em> public hosted zone create a NS record with record name <em>sixthfleet.eucom.ccm.cloud</em> and with values of name servers of the step above</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgNzT0i0lJ_FibJf6kGpww.png" /><figcaption>Route53 Records on CCMD-EUCOM-SixthFleet</figcaption></figure><p>Now on the account CCMD-EUCOM-SixtFleet our builders are able to create any records under the <em>sixtfleet.eucom.ccmd.cloud</em> zone. For example, we can create the record <em>r53demo.sixthfleet.eucom.ccmd.cloud</em> that point to an EC2 instance. <strong>This configuration work because the authoritative name servers for <em>sixtfleet.eucom.ccmd.cloud </em>zone are that of our <em>ccmd.cloud</em> zone.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMgPzAqayYSUu1eZ4opCsg.png" /><figcaption>DIG output with Authority Section evidence</figcaption></figure><h4>Delegate Private Hosted Zone</h4><p>Delegation of a private hosted zone on Route53 is a little more complex also because there is no console section to configure this [3]. Suppose that on the private zone the top level of our DNS is <em>ccmd.local</em> and we would delegate to our builders the setup and management of <em>sixtfleet.eucom.ccmd.local </em>zone on project’s account<em>.</em> The right approach is the following:</p><p><em>Step-1:</em> on account CCMD-TRANSCOM create <em>ccmd.local</em> Private Hosted Zone and attach to VPC where in the future we will put the Route53 DNS Resolver endpoint (we will come back after on this).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5y0SPSoUWGv100-o1-zcEw.png" /><figcaption>Private Hosted Zone on CCMD-TRANSCOM</figcaption></figure><p><em>Step-2:</em> on account CCMD-EUCOM-SixhtFleet create <em>demo.sixthfleet.eucom.ccmd.local</em> Private Hosted Zone and attach it to the VPC where our builders will launch the resources for their project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85iSssUidIUL2cmRNRXdWg.png" /></figure><p><em>Step-3:</em> using the account CCMD-TRANSCOM authorize to receive association from VPC in CCMD-EUCOM-SixthFleet account</p><pre>aws route53 create-vpc-association-authorization --hosted-zone-id Z03913591TGMYSPO1UHXB --vpc VPCRegion=eu-west-1,VPCId=vpc-01b1bbcb17039fc42 --profile CCMD-TRANSCOM</pre><p><em>Step-4</em>: using the account CCMD-EUCOM-SixthFleet submit an <strong>AssociateVPCWithHostedZon</strong>e request using the following command</p><pre>aws route53 associate-vpc-with-hosted-zone --hosted-zone-id Z03913591TGMYSPO1UHXB --vpc VPCRegion=eu-west-1,VPCId=vpc-01b1bbcb17039fc42 --profile CCMD-EUCOM-SixthFleet</pre><p>The Private Hosted Zone of CCMD-TRANSCOM is now attached to two different VPCs. The first one is the VPC for the project’s resources and answer to <em>demo.sixthfleet.eucom.ccmd.local</em> resolution requests. The second one is the VPC where we can put the endpoints of (eventual) Route53 Resolver for hybrid architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UK0VtJ5RwcKHTp6mqwTrMQ.png" /><figcaption>Private Hosted Zone on CCMD-TRANSCOM with associated VPCs</figcaption></figure><p>We can repeat this procedure more times, for every account that we will create in the future and where we would make our builders autonomous on DNS configuration. Furthermore, we can automate this configuration in order to speed up the configuration during account provisioning.</p><h3><strong>Cross-Account Hybrid configuration</strong></h3><p>The delegation of zones management on the project’s account also works in the case of hybrid architectures (integration with on-premises DNS). In this case, we must introduce <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resolver.html">Route53 resolver endpoints</a> to route DNS resolution request between on-premises and cloud environments. We must then create forwarding rules using inbound/outbound endpoints in the shared VPC of CCMD-TRANSCOM account (VPC designed to host shared networking services)</p><ul><li><em>Inbound endpoint</em>: forwards DNS queries from on-premises to cloud.</li><li><em>Outbound endpoint</em>: forwards queries from cloud to on-premises.</li></ul><p><strong>Forwarding rules must be created only in the CCMD-TRANSCOM account where the CCoE is responsible for.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*jC9HoWMEhHQ7wzr8RWOn_g.png" /><figcaption>Inbound / Outbound endpoints and related rules</figcaption></figure><p>The builders can use these rules in their zone only if the CCoE has previously shared them with the project’s account. To share rules, the Route 53 Resolver console integrates with <a href="https://aws.amazon.com/ram/">AWS Resource Access Manager</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FwuRhNVwNab1xlh0yQzmuw.png" /><figcaption>Resource sharing invitation on CCMD-EUCOM-SixthFleet account</figcaption></figure><p>After the rules sharing request has been accepted the builders must associate the rules to their VPC. Now the resolver starts to forward DNS queries for the domain name that’s specified in the rule to the DNS resolvers that you specified in the rule using endpoint (outbound) created on CCMD-TRANSCOM account.</p><p>This configuration, which creates overlapping domains from multiple private hosted zones for the VPCs of the networking account, work because Route 53 resolver routes traffic based on the most specific match as described in the Developer Guide [4].</p><pre>If you have private and public hosted zones that have overlapping namespaces, such as example.com and accounting.example.com, Resolver routes traffic based on the most specific match</pre><h3>Conclusions</h3><p>In order to improve Agility we must define a new operating model, more decentralized, based on DevOps principles. The DNS delegation using Amazon Route53 features is an example of how we can make our builders autonomous in the DNS management and speed up the release of new features or products. <strong>The next step is to automate this configuration leveraging AWS Control Tower or AWS Service Catalog with the goal to make our builders totally independent.</strong></p><p>[1] <a href="https://aws.amazon.com/it/blogs/apn/governance-in-the-aws-cloud-the-right-balance-between-agility-and-safety/">https://aws.amazon.com/it/blogs/apn/governance-in-the-aws-cloud-the-right-balance-between-agility-and-safety/</a></p><p>[2] <a href="https://aws.amazon.com/it/organizations/getting-started/best-practices/">https://aws.amazon.com/it/organizations/getting-started/best-practices/</a></p><p>[3] <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zone-private-associate-vpcs-different-accounts.html">https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zone-private-associate-vpcs-different-accounts.html</a></p><p>[4] <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zone-private-considerations.html#hosted-zone-private-considerations-private-overlapping">https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zone-private-considerations.html#hosted-zone-private-considerations-private-overlapping</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c77b561c560" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/leave-our-builders-to-manage-their-dns-in-aws-cloud-with-amazon-route53-part-i-delegate-dns-9c77b561c560">Let your builders manage their DNS in AWS Cloud with Amazon Route53 — Part I — Delegate DNS</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[High Availability and Disaster Recovery with Amazon Aurora — Part I — fundamentals]]></title>
            <link>https://awstip.com/high-availability-and-disaster-recovery-with-amazon-aurora-part-i-fundamentals-d4a67d2ea3fc?source=rss-da8c94ce739b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4a67d2ea3fc</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aurora]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Paolo Latella]]></dc:creator>
            <pubDate>Sun, 03 May 2020 08:35:26 GMT</pubDate>
            <atom:updated>2022-09-19T14:55:31.188Z</atom:updated>
            <content:encoded><![CDATA[<h3>High Availability and Disaster Recovery with Amazon Aurora — Part I — fundamentals</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVuiFBt-nk72NsSgD1QJoA.jpeg" /><figcaption><a href="https://unsplash.com/@rojekilian">Sarah Kilian@rojekilian</a></figcaption></figure><h3>HA and DR in a Cloud world</h3><p>On classic IT infrastructures, the terms High Availability and Disaster Recovery are more clear, but in Cloud infrastructures often these terms are confused. This confusion, for example on AWS world, is because the entire infrastructure of Amazon is dislocated on more geographical locations (Regions) and every region has more groups of data center (Availability Zones — AZ). In this article, we will use the following terminology:</p><ul><li><strong>High availability (HA)</strong> describes the ability of a component (in this case a database) to recovery from failure using another AZ inside the same Region.</li><li><strong>Disaster recovery (DR)</strong> describes the ability of a component (in this case a database) to recovery from fail using another Region in the world.</li></ul><h3>Aurora</h3><p>Amazon Aurora is a fully managed database, offered as part of AWS services, that’s compatible with MySQL and PostgreSQL engine (May 2020). The high resilience and scalability features of Aurora database are achieved by decoupling compute from storage and offload log processing to the storage service.</p><h4>Replication</h4><p>Amazon Aurora divides (logically) our database into <strong>Protection Groups (PGs)</strong>. Each PG consists of 10GB segments replicated across three AZs, with two segments in each AZ, for a total of six replication. When the master node of an Amazon Aurora cluster receives a write operation, it writes the data on a specific chunk that resides in a well defined Protection Groups. The PG work on a distributed storage deployed on a cluster of EC2 across 3 AZs in each region. The replication inside the Protection Group is <em>synchronous</em>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*hC594jbGGNXkOmXnqqQoNQ.png" /></figure><p>At first glance, this mechanism looks similar to the mechanism used, for example, in a NDB Cluster [1], where each data node connects to every other data node (using a <em>synchronous</em> mechanism) and data is stored on multiple data nodes. It’s common knowledge that this replication model introduces some latencies in write operations.</p><p>Amazon Aurora improves this mechanism by <strong>writing only the <em>redo-log</em> records to storage</strong> and adopting a <strong>4/6 write quorum-based voting protocol.</strong></p><h4>The redo-log</h4><p>For ACID compliance, whenever a transaction is committed the engine write a <em>redo-log</em> on the disk. This log is a description of a change made to a single block in the database. But the <em>redo-log</em> maintain only some pieces of information, to replicate data between nodes we also need that the modified data (disk sector) are replicated — Yes, I’m simplifying!</p><p>On Amazon Aurora only the <em>redo-log</em> are written to the distributed storage layer, and the storage takes care of constructing page images from log records when necessary. The records of redo-log are small, and this reduces data transferred between nodes in the network.</p><h4>Durability — It’s all about quorum</h4><p>On Amazon Aurora the storage was built as an independent fault-tolerant and self-healing service across multiple AZs. Amazon Aurora automatically divides our database into more chunks (lower than 10GB) and every chunk is replicated <strong>six ways, across 3 Availability Zones</strong>. Amazon Aurora is designed to transparently handle the loss of up to two copies of data without affecting database write availability and up to three copies without affecting read availability. All this happens thanks to a <strong>4/6 quorum-based voting protocol</strong>, where consistency on write is guaranteed by these simple rules:</p><ol><li>the data is replicated six times (2 times for every AZ)</li><li>every copy of a replicated chunk has one vote</li><li>the data is consistent if we have a quorum of 4/6 on commit</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*sFquhefLy5Q7-znYqMt2zA.png" /></figure><p>This mechanism guarantees better fault tolerance and reduces performance jitter.</p><ul><li><strong>Better fault-tolerance</strong>: we could tolerate the loss of a single AZ with replication on 3 different nodes and a quorum of 2/3 on read and 2/3 on write. But this mechanism does not take care that fails of AZ can happen during the fault of a disk on another AZ (recovery of AZ may take time). In 4/6 quorum configuration, we can tolerate a loss of an entire AZ and one additional node (AZ+1) without impacting the ability to read data, and losing an entire AZ without impacting the ability to write data!</li><li><strong>Reduce performance jitter</strong>: if we want to maintain the replication in synchronous mode we don’t have to wait for <em>commit-ack</em> from all six replicas before closing the write operation. Furthermore, only the <em>redo-log</em> are transmitted on the network and only 4/6 nodes require <em>commit-ack</em>.</li></ul><h4>Durability — Self-repair</h4><p>Amazon Aurora divides our database into Protection Groups (PGs) and each PG consists of six 10GB segments spanned across three AZs, with two segments in each AZ. Aurora engine continuously scans all data blocks inside a PG and, if an error is detected, it immediately repairs the segment reading block from other chunks of the same PG (transfer 10 GB on a 10Gbps network link require 10 sec). Using the 4/6 quorum-based voting protocol Aurora <strong>can’t sustain</strong> two failures in the same 10 second window plus a failure of an AZ, but this eventuality is sufficiently unlikely.</p><h3>Reference:</h3><p>[1]<a href="https://dev.mysql.com/doc/refman/8.0/en/mysql-cluster.html">https://dev.mysql.com/doc/refman/8.0/en/mysql-cluster.html</a></p><p>[2]<a href="https://www.allthingsdistributed.com/files/p1041-verbitski.pdf">https://www.allthingsdistributed.com/files/p1041-verbitski.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4a67d2ea3fc" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/high-availability-and-disaster-recovery-with-amazon-aurora-part-i-fundamentals-d4a67d2ea3fc">High Availability and Disaster Recovery with Amazon Aurora — Part I — fundamentals</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>