<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Devam Parikh</title>
    <description>The latest articles on DEV Community by Devam Parikh (@devamparikh).</description>
    <link>https://dev.to/devamparikh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1110609%2Fd7405a68-8311-4b31-847d-522a6b0b0c95.jpeg</url>
      <title>DEV Community: Devam Parikh</title>
      <link>https://dev.to/devamparikh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devamparikh"/>
    <language>en</language>
    <item>
      <title>Testing Application Resilience: How to Stop Amazon ElastiCache Cluster and Manage Traffic</title>
      <dc:creator>Devam Parikh</dc:creator>
      <pubDate>Fri, 13 Oct 2023 06:02:29 +0000</pubDate>
      <link>https://dev.to/devamparikh/testing-application-resilience-how-to-stop-amazon-elasticache-cluster-and-manage-traffic-58ep</link>
      <guid>https://dev.to/devamparikh/testing-application-resilience-how-to-stop-amazon-elasticache-cluster-and-manage-traffic-58ep</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As developers, it is crucial to test the resiliency of our applications and understand how they handle failures or disruptions. In this blog post, we will explore a scenario where we need to stop an Amazon ElastiCache cluster to see how our application behaves when Redis is unavailable. Although ElastiCache clusters cannot be stopped, we will discuss alternative approaches to achieve our testing objective.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Amazon ElastiCache
&lt;/h2&gt;

&lt;p&gt;Amazon ElastiCache for Redis is a powerful in-memory data structure service that provides real-time performance for modern applications. It serves as a cache or a data store, delivering high-speed access to data. ElastiCache uses a synchronous replication mechanism to maintain data consistency across its nodes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges with Stopping ElastiCache Cluster
&lt;/h2&gt;

&lt;p&gt;Stopping an ElastiCache cluster is not possible due to the synchronous replication mechanism. If we stop a node, the cluster's redundancy is compromised, potentially leading to instability or complete failure. However, we can explore other methods to create scenarios where our application experiences Redis unavailability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blocking Incoming Traffic using Security Groups
&lt;/h2&gt;

&lt;p&gt;To simulate Redis unavailability, we can block incoming traffic to the ElastiCache cluster. Security groups act as virtual firewalls, controlling inbound and outbound traffic. By removing all the inbound rules for the ElastiCache cluster, we can prevent any incoming requests from reaching it. &lt;/p&gt;

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

&lt;p&gt;However, it is essential to understand that security groups are stateful[1]. This means that existing connections are not interrupted when security group rules are changed. Thus, our application may still be connected to the ElastiCache cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Addressing the Issue
&lt;/h2&gt;

&lt;p&gt;Two methods can be used to tackle this issue:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Restarting the Application:&lt;/strong&gt; By restarting the application, existing connections will be terminated, forcing the application to establish new connections. This can validate the application's ability to handle Redis unavailability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Using Network ACLs:&lt;/strong&gt; Network Access Control Lists (ACLs)[2] operate at the subnet level and allow or deny specific inbound or outbound traffic. Unlike security groups, network ACLs are stateless, meaning they don't automatically allow response traffic. Introducing a network ACL that blocks traffic in either direction can break existing connections.&lt;/p&gt;

&lt;h2&gt;
  
  
  Network ACL in Depth
&lt;/h2&gt;

&lt;p&gt;You can either use the default VPC network ACL or create a custom one with rules similar to security groups for extra VPC security at no extra cost.&lt;/p&gt;

&lt;p&gt;The following diagram depicts a VPC with two subnets, each having its network ACL. When traffic enters the VPC (such as from a peered VPC, VPN connection, or the internet) the router directs it to its destination.&lt;/p&gt;

&lt;p&gt;Network ACL A controls which traffic can enter subnet 1 and leaves it to destination outside subnet 1. Similarly, network ACL B regulates traffic entering and leaving subnet 2.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Creating a Custom Network ACL
&lt;/h2&gt;

&lt;p&gt;As illustrated in the figure below, this is how I've configured the denial of incoming traffic from my application to the ElastiCache cluster.&lt;/p&gt;

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

&lt;p&gt;A network ACL comprises both inbound and outbound rules, each capable of allowing or denying traffic. These rules are numbered from 1 to 32766.&lt;/p&gt;

&lt;p&gt;When determining whether to allow or deny traffic, we evaluate the rules sequentially, starting with the lowest numbered rule. If a rule matches the traffic, it is applied, and no further rules are assessed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Testing application resilience is essential to ensure smooth operation in challenging scenarios. While stopping an ElastiCache cluster is not feasible due to its replication mechanism, alternative approaches such as blocking incoming traffic using security groups or employing network ACLs can help simulate Redis unavailability. By understanding the statefulness of security groups and the statelessness of network ACLs, we can effectively test our application's behaviour when critical resources are not available.&lt;/p&gt;

&lt;p&gt;In summary, remember these key points:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;ElastiCache clusters cannot be stopped and rely on synchronous replication for real-time performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security groups are stateful, meaning existing connections persist when rules are modified.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Network ACLs are stateless and can be used to block traffic, potentially breaking existing connections.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Reference: &lt;br&gt;
[1] &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>networking</category>
      <category>devops</category>
    </item>
    <item>
      <title>Demystifying DDoS Attacks and CloudFront: A DevSecOps Guide</title>
      <dc:creator>Devam Parikh</dc:creator>
      <pubDate>Fri, 21 Jul 2023 10:49:11 +0000</pubDate>
      <link>https://dev.to/devamparikh/demystifying-ddos-attacks-and-cloudfront-a-devsecops-guide-50jb</link>
      <guid>https://dev.to/devamparikh/demystifying-ddos-attacks-and-cloudfront-a-devsecops-guide-50jb</guid>
      <description>&lt;p&gt;The IT industry is currently facing the worst crisis in its history, with numerous factors affecting its stability. One significant factor that demands attention is the rising number of DDoS attacks. According to the &lt;a href="https://www.radware.com/newsevents/pressreleases/2023/radware-full-year-2022-report-malicious-ddos-attacks/" rel="noopener noreferrer"&gt;reports&lt;/a&gt; available to me, there was a 150% increase in DDoS attacks in 2022 compared to 2021. Moreover, experts predict a continued upward trend in the upcoming years.&lt;/p&gt;

&lt;p&gt;Attacks such as DDoS can have a significant impact on organizations, causing service disruptions, financial losses, reputation damage, data loss, increased vulnerability to other attacks, and more.&lt;/p&gt;

&lt;p&gt;In today's digital landscape, understanding and mitigating DDoS attacks is crucial for DevSecOps professionals. In this blog post, we'll explore the intricacies of DDoS attacks and how CloudFront, Amazon Web Services' (AWS) content delivery network (CDN) service, can be a valuable tool in protecting your applications and infrastructure. By answering key questions along the way, we'll unravel the mysteries surrounding DDoS attacks and equip you with the knowledge to fortify your systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do you need to know about DDoS attackt as DevSecOps?
&lt;/h2&gt;

&lt;p&gt;A DDoS attack, or distributed denial-of-service attack, is a cyber-attack that targets a website or server by flooding it with so much traffic that it becomes unavailable to legitimate users. The goal of a DDoS attack is to disrupt the targeted website or server's services, making it inaccessible to users.&lt;/p&gt;

&lt;p&gt;There are two main types of DDoS attacks: volume-based attacks and application-layer attacks. Volume-based attacks flood the target with a large amount of traffic, overwhelming its resources and making it unable to handle legitimate requests. Application-layer attacks exploit vulnerabilities in the targeted website or server's applications, causing them to crash or malfunction.&lt;/p&gt;

&lt;p&gt;To launch a DDoS attack, the attacker first identifies the target website or server. Then, they gather a large number of infected computers, called "zombies," to flood the target with traffic. This overwhelms the website or server, making it unable to handle legitimate requests. As a result, users are unable to access the website or server.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can CloudFront help with hosting and DDoS attackts?
&lt;/h2&gt;

&lt;p&gt;CloudFront is a content delivery network (CDN) service that speeds up the delivery of your content to users all over the world by caching your content in edge locations. These edge locations are servers that are located close to your users. When a user requests your content, CloudFront delivers it from the edge location that is closest to them, which reduces latency and improves performance.&lt;/p&gt;

&lt;p&gt;As most requests are answered by the edge location (from the cache), this significantly reduces the load on the origin server. The edge location acts as an absorbing agent, preventing requests from reaching the origin server directly, as they only need to pass through the edge location.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do you need to have WAF protection enabled for CloudFront distribution?
&lt;/h2&gt;

&lt;p&gt;As discussed above, DDoS attacks rely on "zombies" to attack. Therefore, blocking the requests from IP addresses of zombie machines can help us to stop DDoS attacks.&lt;/p&gt;

&lt;p&gt;A web application firewall (WAF) serves as a protective layer in front of web applications, shielding them from common web exploits. WAFs function by inspecting HTTP requests and blocking those that match known attack patterns.&lt;/p&gt;

&lt;p&gt;CloudFront has a built-in integration with WAF, which implies that if WAF is enabled for any CloudFront distribution, AWS will automatically create and handle the WAF Rules for you. These rules include the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Protect against the most common vulnerabilities found in web applications.&lt;/li&gt;
&lt;li&gt;Protect against malicious actors discovering application vulnerabilities.&lt;/li&gt;
&lt;li&gt;Block IP addresses from potential threats based on Amazon internal threat intelligence.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After enabling WAF for a CloudFront distribution, it would appear similar to the below image.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  How to setup logging for CloudFront?
&lt;/h2&gt;

&lt;p&gt;Before delving into the process of setting up logging, let's first understand why logging is crucial. Logging plays a pivotal role in enabling you to identify the source of an attack, mitigate the attack, and prevent future attacks.&lt;/p&gt;

&lt;p&gt;You can easily set up logging with just one click to send your logs to CloudWatch, S3, or Kinesis Data Firehose. Among these options, S3 is the most cost-effective choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;Utilize Athena to query data from any S3 bucket. It is recommended to use separate S3 buckets for different environments as this will enhance Athena's performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By delving into the above subtopics, we've gained a comprehensive understanding of DDoS attacks and how CloudFront can fortify your DevSecOps practices. Armed with this knowledge, you're better equipped to protect your applications and infrastructure against potential threats. Stay vigilant, stay informed, and leverage the power of CloudFront to bolster your defenses.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>cloud</category>
      <category>security</category>
    </item>
  </channel>
</rss>
