<?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[Serverless Platform Architecture - Medium]]></title>
        <description><![CDATA[Build platform with serverless component - Medium]]></description>
        <link>https://medium.com/serverless-platform-architecture?source=rss----456f76ef2825---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Serverless Platform Architecture - Medium</title>
            <link>https://medium.com/serverless-platform-architecture?source=rss----456f76ef2825---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:47:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/serverless-platform-architecture" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Sending Custom Metrics to CloudWatch Using Lambda]]></title>
            <link>https://medium.com/serverless-platform-architecture/sending-custom-metrics-to-cloudwatch-using-lambda-9ef8f5af4504?source=rss----456f76ef2825---4</link>
            <guid isPermaLink="false">https://medium.com/p/9ef8f5af4504</guid>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[cloudwatch]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Mohammad Naimur Rahman]]></dc:creator>
            <pubDate>Wed, 30 Jun 2021 22:11:59 GMT</pubDate>
            <atom:updated>2021-07-15T22:27:04.726Z</atom:updated>
            <content:encoded><![CDATA[<p>Create custom metrics in CloudWatch and add them to the dashboard as a widget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*uaqyPWyVO6uBk9Bs0StsYw.jpeg" /><figcaption>Sending Custom Metrics to CloudWatch Using Lambda</figcaption></figure><h3><strong>Introduction:</strong></h3><p>In this article, we will discuss how custom metrics can be collected and sent to CloudWatch, and add that widget in the CloudWatch dashboard. Here, lambda is used to collect the metrics, and then those metrics are sent to CloudWatch. A dashboard can be created where we can add all those widgets to it. Here, lambda is triggered periodically using the event bridge. However, a lambda can be triggered based on the event as well.</p><h3><strong>Description:</strong></h3><p>In this demonstration, a lambda is created to collect the data which would be pushed to CloudWatch to show as custom metrics on the dashboard. When a lambda is created from the AWS console, and create a new execution IAM role is selected then that role gives lambda permission to send logs to Amazon CloudWatch as default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-LUjnB3D9qJCMyta9VpTew.png" /><figcaption><strong>Lambda creation with new IAM as the execution role</strong></figcaption></figure><p>The role has a policy that can perform the below actions to CloudWatch by default.</p><ul><li>logs:CreateLogGroup</li><li>logs:CreateLogStream</li><li>logs:PutLogEvents</li></ul><p>Additional permission is needed to add to the JSON policy document to perform the <strong>PutMetricData </strong>action on the CloudWatch.</p><ul><li>logs:PutMetricData</li></ul><p>The figure shows the policy for added to the lambda execution role to send metrics to CloudWatch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLUyn-Imwm8xidxe-8MjOA.png" /><figcaption><strong>Policy to push custom metrics to CloudWatch</strong></figcaption></figure><h3><strong>Code:</strong></h3><p>The lambda function runs the code given below that pushes the metrics to the CloudWatch. In this demonstration, we are collecting data for IoT devices that are online, and the number of total devices/controllers connected to the platform. Also, it is collecting the net number of alerts sent by the devices.</p><p>In order to create a metric in CloudWatch, there are several fields that are necessary. Those fields are provided below with details for each metric data.</p><ul><li><strong>Namespace</strong>: This entity name will appear on the Metric tab in CloudWatch.</li><li><strong>MetricData</strong> <br> — <strong>MetricName</strong>: This is the metric name that will appear on the chart (A MetricData can have multiple MetricName representing different metrics)<br> — <strong>Dimension</strong>: This is a list of dictionary datatype as “Name” and “Value”. This allows multiple “Name” &amp; “Value” for a single entity.<br> — <strong>Unit</strong>: This is the Unit that will appear on the top of the Y-axis.<br> — <strong>Value</strong>: This is the actual value of the data plotted on the Y-axis.</li></ul><pre>import boto3<br>import random</pre><pre>cloudwatch = boto3.client(&#39;cloudwatch&#39;)</pre><pre>def publishing_metrics(num,total,alarm):<br>    response = cloudwatch.put_metric_data(<br>        MetricData = [<br>            {<br>                &#39;MetricName&#39;: &#39;OnlineDevices&#39;,<br>                &#39;Dimensions&#39;: [<br>                    {<br>                        &#39;Name&#39;: &#39;LastMessages&#39;,<br>                        &#39;Value&#39;: &#39;With-in-one-hour&#39;<br>                    },<br>                    {<br>                        &#39;Name&#39;: &#39;APP_VERSION&#39;,<br>                        &#39;Value&#39;: &#39;1.0&#39;<br>                    },<br>                    ],<br>                    &#39;Unit&#39;: &#39;Count&#39;,<br>                    &#39;Value&#39;: num<br>            },<br>            {<br>                &#39;MetricName&#39;: &#39;TotalDevices&#39;,<br>                &#39;Dimensions&#39;: [<br>                    {<br>                        &#39;Name&#39;: &#39;LastMessages&#39;,<br>                        &#39;Value&#39;: &#39;With-in-one-year&#39;<br>                    },<br>                    {<br>                        &#39;Name&#39;: &#39;APP_VERSION&#39;,<br>                        &#39;Value&#39;: &#39;1.0&#39;<br>                    },<br>                    ],<br>                    &#39;Unit&#39;: &#39;Count&#39;,<br>                    &#39;Value&#39;: total<br>            },<br>            ],<br>            Namespace = &#39;ConnectedControllers&#39;)<br>    response = cloudwatch.put_metric_data(<br>        MetricData = [<br>            {<br>                &#39;MetricName&#39;: &#39;OnlineDevices&#39;,<br>                &#39;Dimensions&#39;: [<br>                    {<br>                        &#39;Name&#39;: &#39;LastMessages&#39;,<br>                        &#39;Value&#39;: &#39;With-in-one-hour&#39;<br>                    },<br>                    {<br>                        &#39;Name&#39;: &#39;APP_VERSION&#39;,<br>                        &#39;Value&#39;: &#39;1.0&#39;<br>                    },<br>                    ],<br>                    &#39;Unit&#39;: &#39;Count&#39;,<br>                    &#39;Value&#39;: num<br>            },<br>            {<br>                &#39;MetricName&#39;: &#39;TotalDevices&#39;,<br>                &#39;Dimensions&#39;: [<br>                    {<br>                        &#39;Name&#39;: &#39;LastMessages&#39;,<br>                        &#39;Value&#39;: &#39;With-in-one-year&#39;<br>                    },<br>                    {<br>                        &#39;Name&#39;: &#39;APP_VERSION&#39;,<br>                        &#39;Value&#39;: &#39;1.0&#39;<br>                    },<br>                    ],<br>                    &#39;Unit&#39;: &#39;Count&#39;,<br>                    &#39;Value&#39;: total<br>            },<br>            {<br>                &#39;MetricName&#39;: &#39;AlarmReportedDevice&#39;,<br>                &#39;Dimensions&#39;: [<br>                    {<br>                        &#39;Name&#39;: &#39;LastMessages&#39;,<br>                        &#39;Value&#39;: &#39;With-in-one-hour&#39;<br>                    },<br>                    {<br>                        &#39;Name&#39;: &#39;APP_VERSION&#39;,<br>                        &#39;Value&#39;: &#39;1.0&#39;<br>                    },<br>                    ],<br>                    &#39;Unit&#39;: &#39;Count&#39;,<br>                    &#39;Value&#39;: alarm<br>            },<br>            ],<br>            Namespace = &#39;ControllersAlarm&#39;)</pre><p>The unit must be a value in the set below.</p><p>[ Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None ].</p><p>In the code above, it is sending data to the CloudWatch with custom Namespace (“ConnectedControllers”, “ControllersAlarm”) that appear under Custom Namespace in the CloudWatch Metric tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vzY9id4yFvbKyvFhsZF5wQ.png" /><figcaption><strong>Custom Metrics for CloudWatch</strong></figcaption></figure><p><strong>ConnectedControllers </strong>widget<strong> </strong>shown in the figure below contains two metrics (OnlineDevice, TotalDevices).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FrM1qBCZnytLJrEZVt7PHw.png" /><figcaption><strong>ConnectedControllers Widget</strong></figcaption></figure><p><strong>ControllersAlarm </strong>widget is shown in the figure below contains three metrics (AlarmReportedDevice, OnlineDevice, TotalDevices).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iO_tm1EbFZEFyrvc33phzQ.png" /><figcaption><strong>ControllersAlarm Widget</strong></figcaption></figure><p>Those widgets can be added to different CloudWatch dashboards.</p><h3><strong>Conclusion:</strong></h3><p>This article covered how custom metrics can be sent to CloudWatch and how to add those metrics to the CloudWatch dashboard.</p><p>Thank you for reading the article. Please feel free to provide feedback and/or post questions in the comment section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ef8f5af4504" width="1" height="1" alt=""><hr><p><a href="https://medium.com/serverless-platform-architecture/sending-custom-metrics-to-cloudwatch-using-lambda-9ef8f5af4504">Sending Custom Metrics to CloudWatch Using Lambda</a> was originally published in <a href="https://medium.com/serverless-platform-architecture">Serverless Platform Architecture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a custom domain without migrating the parent domain and certificates in AWS for APIs]]></title>
            <link>https://medium.com/serverless-platform-architecture/create-a-custom-domain-without-migrating-the-parent-domain-and-certificates-in-aws-for-apis-3c471019504b?source=rss----456f76ef2825---4</link>
            <guid isPermaLink="false">https://medium.com/p/3c471019504b</guid>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[domain-names]]></category>
            <category><![CDATA[serverless-architecture]]></category>
            <category><![CDATA[ssl-certificate]]></category>
            <dc:creator><![CDATA[Mohammad Naimur Rahman]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 21:22:22 GMT</pubDate>
            <atom:updated>2021-02-03T21:24:34.595Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*3N3hD4GZA18VFXjM7FzAVw.jpeg" /><figcaption><strong>Fig 1. API gateway as an entry point for API</strong></figcaption></figure><h3><strong>Introduction</strong></h3><p>In this article, we are going to discuss how we can create custom domains for web and API microservices without migrating the parent domain and SSL certificates in AWS. Also, this is useful when your parent domain and DNS service is not managed by AWS (AWS DNS entry can be used to manage only DNS at the parent domain managed side).</p><h3>Managing Certificates through ACM</h3><p>AWS Certificate Manager (ACM) allows requesting public certificates for domains trusted by the browser and operating systems. You can request certificates for your domain or import an existing certificate without requesting a new one. Here, we will explain how we can request a public certificate for your domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lrOkaVi-vuBva4cfPoRDow.png" /><figcaption><strong>Fig 2. ACM service to request a certificate</strong></figcaption></figure><p>Add the domain name for which you need the certificate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RcZjIMDvKp2yvgKVZRQSxw.png" /><figcaption><strong>Fig 3. Add domain name</strong></figcaption></figure><p>Now the domain validation can be performed in two ways. DNS validation will provide a CNAME entry that needs to be added to the DNS entry for the parent domain. Email validation requires providing the email address of the contact address of the domain owner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2d7-o3laslwJ1tcxdzqiw.png" /><figcaption><strong>Fig 4. Validation method (DNS/ Email)</strong></figcaption></figure><p>Once the validation is completed, you can use Amazon issued certificate for our domain with AWS services like API Gateway.</p><h3>Create custom domain</h3><p>A subdomain for the parent domain can be created from the custom domain tab under the API gateway service. Provide the preferred domain name and choose the certificate from the ACM tab as shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Ty0zC34Ts2imCWOfv8-1Q.png" /><figcaption><strong>Fig 5. Create Custom Domain</strong></figcaption></figure><p>Once the custom domain is created it will provide a CloudFront endpoint as an entry. Now this record needs to be added as a CNAME in the parent domain DNS entry. e.g. api.example.com -&gt; CNAME (Record Type) -&gt; Cloudfront URL. Those are marked in the figure below with red boxes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dV5BOZ0Wn91ax2eXvS_77g.png" /><figcaption><strong>Fig 6. Endpoint Configuration for Custom Domain Names</strong></figcaption></figure><p>Now in the API mapping section, the custom domain can be mapped to API created from the API gateway. Users requesting resources to the custom domain will route to the corresponding API.</p><h3>Conclusion</h3><p>In this article, we covered ACM to issue a certificate for a domain and use it for the custom domain. Also, the Custom domain can be mapped to the API gateways. API gateway can be used as a single point of entry for the web applications and API microservices hosted in AWS. This is really useful when the parent domain is not owned by AWS and DNS is also not managed by AWS Route 53 service.</p><p>Please provide feedback/post questions in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c471019504b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/serverless-platform-architecture/create-a-custom-domain-without-migrating-the-parent-domain-and-certificates-in-aws-for-apis-3c471019504b">Create a custom domain without migrating the parent domain and certificates in AWS for APIs</a> was originally published in <a href="https://medium.com/serverless-platform-architecture">Serverless Platform Architecture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>