<?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: Amine AIT AAZIZI</title>
    <description>The latest articles on DEV Community by Amine AIT AAZIZI (@aaitaazizi).</description>
    <link>https://dev.to/aaitaazizi</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%2F249077%2Fed67c81a-399c-44b8-aaea-dc3766f0de27.png</url>
      <title>DEV Community: Amine AIT AAZIZI</title>
      <link>https://dev.to/aaitaazizi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aaitaazizi"/>
    <language>en</language>
    <item>
      <title>Automated EKS Cost Optimization with AWS Config</title>
      <dc:creator>Amine AIT AAZIZI</dc:creator>
      <pubDate>Tue, 06 Jan 2026 12:19:03 +0000</pubDate>
      <link>https://dev.to/aaitaazizi/automated-eks-cost-optimization-with-aws-config-51mg</link>
      <guid>https://dev.to/aaitaazizi/automated-eks-cost-optimization-with-aws-config-51mg</guid>
      <description>&lt;p&gt;Through the past years, I helped a number of organizations to optimize cloud costs in AWS, more particularly additional EKS costs. I mainly used &lt;a href="https://aws.amazon.com/config/" rel="noopener noreferrer"&gt;AWS config&lt;/a&gt; that assesses, audits, and evaluates the configurations of your resources in your AWS account. &lt;/p&gt;

&lt;p&gt;How did I use this service for cost optimization? Well consider a scenario where we can be alerted if a specific EKS cluster is deployed in the account. If this EKS cluster goes to extended support, you will be paying 6x the cost of a regular EKS cluster with a supported version.&lt;/p&gt;

&lt;p&gt;This blog post demonstrates how to implement a custom rule in AWS Config, to optimize cost by monitoring EKS cluster. The custom AWS Config rule monitors the account checking the version of EKS cluster running. Then when a deprecated EKS version is deployed, AWS Config will flag it as non-compliant.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Overview of solution
&lt;/h2&gt;

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

&lt;p&gt;The AWS Config custom rule invokes the AWS Lambda function that detects if an EKS cluster is in a non-supported version. The invocation of this function occurs every time there is a new EKS cluster detected in the account. &lt;/p&gt;

&lt;p&gt;The AWS Config custom rules invoke a Lambda function that contains the logic to evaluate whether the EKS cluster is either Compliant or Noncompliant. For this we will be relying on &lt;a href="https://endoflife.date/api/v1/products/amazon-eks/" rel="noopener noreferrer"&gt;endoflife&lt;/a&gt;  that provides an API to fetch deprecation data directly. &lt;br&gt;
Nothing will happen if the resource is evaluated as compliant. However, If the resource is evaluated as non-complaint, then the lambda function will send an alert through an AWS Simple Notification Service (Amazon SNS) topic to the administration team which will allow the account administrators to take the corrective action.&lt;/p&gt;

&lt;p&gt;An alternative solution would have been to use the AWS managed config rule to manage &lt;a href="https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-supported-version.html" rel="noopener noreferrer"&gt;supported EKS clusters&lt;/a&gt; … But there are 2 issues with this solution:&lt;/p&gt;

&lt;p&gt;1- This rule requires regular updates each 3/6 months to update the &lt;code&gt;oldestVersionSupported&lt;/code&gt; parameter as EKS releases and deprecates versions regularly.&lt;br&gt;
2- If you don’t specify the oldestVersionSupported parameter, AWS will evaluate and consider all the versions including the ones on extended support as compliant … and this is exactly what we are trying to avoid.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;: You must have setup AWS credentials in your environment&lt;/p&gt;

&lt;p&gt;Clone repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/aaitaazizi/custom-aws-config-rules-for-eks.git &amp;amp;&amp;amp; cd custom-aws-config-rules-for-eks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate cloudformation template using &lt;a href="https://github.com/aws-cloudformation/rain" rel="noopener noreferrer"&gt;rain&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rain pkg aws-config-eks-version-rule/template.yaml --output aws-config-eks-version-rule/template.out.yaml 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deploy&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudformation deploy \
--template-file custom-eks-version-rule.out.yaml \
--stack-name aws-config-eks-version-rule-stack \
--parameter-overrides NotificationEmail=YOUR_EMAIL  \
--region eu-west-1 \
--capabilities CAPABILITY_IAM \
--no-cli-pager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h3&gt;
  
  
  Multi-account deployment
&lt;/h3&gt;

&lt;p&gt;In an organization and multi-account context, you may have to consider options such as using &lt;a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/what-is-cfnstacksets.html" rel="noopener noreferrer"&gt;Cloudformation stacksets&lt;/a&gt; or AWS config &lt;a href="https://docs.aws.amazon.com/config/latest/developerguide/conformance-packs.html" rel="noopener noreferrer"&gt;conformance packs&lt;/a&gt; to adapt the current template to your needs. This will deploy your AWS config rule across all the accounts and enable EKS cost efficient governance inside your AWS organization.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  An additional rule for non-critical workloads
&lt;/h2&gt;

&lt;p&gt;One of the rules that you could additionally add for non-critical workload is to force EKS cluster to have the &lt;code&gt;STANDARD&lt;/code&gt; upgrade policy instead of the &lt;code&gt;EXTENDED&lt;/code&gt; upgrade policy which is the default value.&lt;/p&gt;

&lt;p&gt;So technically, what you can do is to create a new config rule that considers any EKS cluster with &lt;code&gt;EXTENDED&lt;/code&gt; support policy as non compliant. Then, you can add a remediation action in order to force the update of this cluster into a &lt;code&gt;STANDARD&lt;/code&gt; policy. This will ensure that all the clusters will auto upgrade as soon as they reach the standard end of support period of the EKS cluster.&lt;/p&gt;

&lt;p&gt;It’s important to note that it should be deployed to non-critical and/or non-production environments. Here’s an example of solution you can deploy in your account directly to assess the compliance of EKS cluster upgrade policy (without the remediation for now) accessible via this &lt;a href="https://github.com/aaitaazizi/custom-aws-config-rules-for-eks/tree/main/aws-config-eks-upgrade-policy-rule" rel="noopener noreferrer"&gt;folder repository&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases and benefits
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Reduce EKS control-plane spend&lt;/strong&gt; by avoiding Extended Support premium charges through early detection and timely upgrades.​&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Improve security posture&lt;/strong&gt; by keeping clusters on supported versions that continue receiving fixes and security updates.​&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standardize platform governance&lt;/strong&gt; by applying one consistent policy to every EKS cluster in the organization. This will strengthen ownership and accountability by making version drift visible to the right service owners via tags, reports and dashboard such as &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/cluster-dashboard.html" rel="noopener noreferrer"&gt;the EKS dashboard&lt;/a&gt;.​&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enable proactive lifecycle planning&lt;/strong&gt; by surfacing clusters nearing end-of-support early enough to schedule maintenance windows.​&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next ?
&lt;/h2&gt;

&lt;p&gt;Automating cost governance is the most effective way to prevent EKS budget overruns before they happen. I suggest you give this solution a try and/or adapt it with your own business requirements and let me know what you think. If you have any feedbacks or thoughts, please feel free to submit comments.&lt;/p&gt;

</description>
      <category>eks</category>
      <category>kubernetes</category>
      <category>aws</category>
      <category>finops</category>
    </item>
    <item>
      <title>AWS simplified Cloudtrail events monitoring using Cloudwatch Logs</title>
      <dc:creator>Amine AIT AAZIZI</dc:creator>
      <pubDate>Tue, 23 Dec 2025 18:28:06 +0000</pubDate>
      <link>https://dev.to/aaitaazizi/aws-simplified-cloudtrail-events-monitoring-using-cloudwatch-logs-2a6m</link>
      <guid>https://dev.to/aaitaazizi/aws-simplified-cloudtrail-events-monitoring-using-cloudwatch-logs-2a6m</guid>
      <description>&lt;p&gt;Most AWS environments have AWS CloudTrail enabled, but very few teams actually detect critical events in real time. The recent &lt;a href="https://aws.amazon.com/about-aws/whats-new/2025/12/key-enhancements-cloudtrail-events-cloudwatch/" rel="noopener noreferrer"&gt;announcement&lt;/a&gt; from AWS Re-invent simplified CloudWatch integration for CloudTrail.&lt;/p&gt;

&lt;p&gt;So instead of just recording history, you can now react to every sensitive API call within seconds by streaming CloudTrail events directly into CloudWatch Logs for alerts, dashboards, and automation.&lt;/p&gt;

&lt;p&gt;In this article, I will try to share some interesting insights regarding this topic by answering these following questions&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Why is Cloudtrail alone not enough for monitoring ?
&lt;/h2&gt;

&lt;p&gt;CloudTrail is excellent at answering “who did what, where, and when” for AWS API calls. But its main purpose is auditing, not operational monitoring.​&lt;/p&gt;

&lt;p&gt;It’s true that the CloudTrail console is optimized for compliance investigations but not continuous detection. Why ? because it doesn't provide native real-time alerting, metrics, or rich dashboards. This is exactly why you still need another service for that and that’s what CloudWatch Logs is designed for.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How was cloudwatch monitoring done before the announcement ?
&lt;/h2&gt;

&lt;p&gt;Before this update, achieving observability of CloudTrail events in CloudWatch required a multi-step configuration.&lt;br&gt;
Firstly, you had to create a Trail and explicitly configure it to push events to an S3 bucket primary and CloudWatch Logs log group optionally using an IAM role&lt;/p&gt;

&lt;p&gt;Secondly, you had to explicitly create an IAM Role with a trust policy allowing the cloudtrail principal to assume it, and the required permission policies.&lt;/p&gt;

&lt;p&gt;In addition, enabling this across an Organization often mean complex StackSets or Control Tower customizations to ensure every new account had this Trail-to-CloudWatch configuration.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How can you achieve it now after the update ?
&lt;/h2&gt;

&lt;p&gt;Now with the new update, you can now configure everything directly from the Cloudwatch console.&lt;/p&gt;

&lt;p&gt;You no longer need to create or manage a CloudTrail "Trail" object just to get logs into CloudWatch. The integration uses Service-Linked Channels (SLCs), which acts as background pipes that AWS services use to communicate securely.&lt;/p&gt;

&lt;p&gt;One of the advantages of using Service-Linked Channels and Service-Linked Roles, the IAM permissions are managed automatically by AWS. You do not need to manually create and maintain an IAM role for this ingestion pipeline.&lt;/p&gt;

&lt;p&gt;After these Re-invent &lt;a href="https://aws.amazon.com/about-aws/whats-new/2025/12/amazon-cloudwatch-unified-management-analytics/" rel="noopener noreferrer"&gt;updates&lt;/a&gt;, The workflow is now consistent with other AWS native logs such as VPC, EKS … providing a simplified way for configuring all telemetry ingestion in one place.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What are the key benefits of cloudtrail monitoring ?
&lt;/h2&gt;

&lt;p&gt;Monitoring CloudTrail events in CloudWatch Logs can have several benefits:&lt;/p&gt;
&lt;h4&gt;
  
  
  Real-time alerts and automation
&lt;/h4&gt;

&lt;p&gt;You can turn log patterns into metrics and then create CloudWatch alarms that notify via SNS, PagerDuty, etc., or trigger remediation via Lambda.​&lt;/p&gt;
&lt;h4&gt;
  
  
  Single pane for all logs
&lt;/h4&gt;

&lt;p&gt;CloudWatch Logs can centralize app logs, OS logs, VPC Flow Logs, and CloudTrail in one place, with a consistent query language and dashboards.​ This makes correlation like “API call happened here, app error happened there” much easier. More details are available in this &lt;a href="https://aws.amazon.com/about-aws/whats-new/2025/12/amazon-cloudwatch-unified-management-analytics/" rel="noopener noreferrer"&gt;announcement&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Powerful querying and visualization
&lt;/h4&gt;

&lt;p&gt;CloudWatch Logs Insights lets you run ad‑hoc queries, aggregate, group, and visualize CloudTrail events alongside other logs.​ This can be done in the cloudwatch console or using tools such as AWS managed Grafana with cloudwatch plugin.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  A real-world Use case
&lt;/h2&gt;

&lt;p&gt;Let suppose that you want to get alerted when some critical IAM changes happen such as &lt;code&gt;CreateAccessKey&lt;/code&gt;. CloudTrail records this as a management event with eventSource = "iam.amazonaws.com" and eventName = "CreateAccessKey".&lt;/p&gt;

&lt;p&gt;After configuring CloudTrail events to be delivered to a CloudWatch Logs log group using the new cloudwatch console -&amp;gt; Log management -&amp;gt; Data source -&amp;gt; Select Cloudtrail, You need to create a metric filter using this filter pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ ($.eventSource = "iam.amazonaws.com") &amp;amp;&amp;amp; ($.eventName = "CreateAccessKey") }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This matches any CloudTrail event where IAM’s &lt;code&gt;CreateAccessKey&lt;/code&gt; API was called.&lt;/p&gt;

&lt;p&gt;Now every time &lt;code&gt;CreateAccessKey&lt;/code&gt; appears in the logs, CloudWatch increments your metric by 1. Now the only thing left to do is to configure you alarm so that If at least one access key was created in the last 5 minutes as an example, go into ALARM state … and sends a notification (and/or executes remediation if needed)&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Do I still need to use trails or Cloudtrail Lake ?
&lt;/h2&gt;

&lt;p&gt;The answer is Yes. Using CloudTrail Lake or Trails with S3 will always be useful for long-term audit, compliance and data storage.&lt;/p&gt;

&lt;p&gt;Trails are a foundational system of records with continuous capturing management events and writing them to hardened S3 buckets with long retention. Organization trails centralize activity from all accounts and regions so you can prove to auditors that logging is consistent across the entire organization.&lt;/p&gt;

&lt;p&gt;On the other side, CloudTrail Lake builds on that stream as an audit analytics warehouse, storing events in dedicated event data stores with multi‑year, policy‑driven retention and letting you run SQL queries that are more efficient than searching raw S3 logs.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next ?
&lt;/h2&gt;

&lt;p&gt;By streaming events into CloudWatch Logs using the new simplified integration, you unlock real-time detection of threats like failed logins, IAM escalations, and access key creations, turning passive audit logs into active defenses.&lt;/p&gt;

&lt;p&gt;You can start and implement this today in your AWS account. From a FinOps perspective, there is no difference as you will still be charged for both &lt;a href="https://aws.amazon.com/cloudtrail/pricing/" rel="noopener noreferrer"&gt;CloudTrail event delivery charges&lt;/a&gt;  and &lt;a href="https://aws.amazon.com/cloudwatch/pricing/" rel="noopener noreferrer"&gt;CloudWatch Logs ingestion fees&lt;/a&gt; based on custom logs pricing.&lt;/p&gt;

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