<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AWS Archives - Blog IT</title>
	<atom:link href="https://blogit.create.pt/tag/aws/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogit.create.pt/tag/aws/</link>
	<description>Create IT blogger community</description>
	<lastBuildDate>Wed, 15 Mar 2023 12:52:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>Performing broker migrations on your Kafka consumers</title>
		<link>https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/</link>
					<comments>https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/#respond</comments>
		
		<dc:creator><![CDATA[João Rafael]]></dc:creator>
		<pubDate>Wed, 15 Mar 2023 12:44:45 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Kafka]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[MSK]]></category>
		<category><![CDATA[Streaming]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=12805</guid>

					<description><![CDATA[<p>When using Kafka for communication between systems, you may find yourself having to change your consumer configuration. This may happen due to the publisher changing topic, or a new message broker being created and a company-wide mandate that everyone switch until a set date. Doing this sort of migration isn&#8217;t very complicated, but any errors [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/">Performing broker migrations on your Kafka consumers</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When using Kafka for communication between systems, you may find yourself having to change your consumer configuration. This may happen due to the publisher changing topic, or a new message broker being created and a company-wide mandate that everyone switch until a set date. Doing this sort of migration isn&#8217;t very complicated, but any errors may prove to be costly. If we re-consume a new topic from the beginning, for example, we may accidentally fill up our database, for example. We want to start consuming the new topic at around the same time we stopped consuming the old one (with a buffer of a few minutes preferably, just to be safe).</p>



<p>The first step here is to ensure that your consumer code is idempotent, but that’s something that you should always ensure &#8211; just imagine that you have to re-consume a couple of messages, in that case lacking idempotency may result in your system getting strange data and bugs.</p>



<h2 class="wp-block-heading">Setting up Kafka on your machine</h2>



<p><em>(Feel free to skip this section if you have everything set up.)</em></p>



<p>Kafka releases aren’t included in most package managers, except for Homebrew in Mac systems. They should be available, however, in the <a href="https://kafka.apache.org/downloads" target="_blank" rel="noreferrer noopener">official download page</a>. For Unix systems (Mac, Linux, WSL, *BSD), simply get one of the binary downloads and extract it wherever you prefer. Then, make sure to add the bin folder to your $PATH, so that you can use these scripts in any folder. In my case, I put the extracted archive in $HOME/.local/share/kafka, so I edit my .zshrc (or .bashrc in a plainer Linux/WSL system) and add:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
export PATH=$HOME/.local/share/kafka/bin:$PATH
</pre></div>


<p><br>Now we can use the official kafka scripts in any directory. That is, unless we have some form of authentication. We can add additional configs to a file somewhere, and include that file in our commands. Let’s put a file called <code>dev.cfg</code> in <code>$HOME/.config/kafka/</code> (the exact directory doesn’t matter, but .config is the appropriate directory for configs), and write the following on it:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
    username=&quot;me&quot; \
    password=&quot;noneofyourbusiness&quot;;
</pre></div>


<p>This is just an example, your broker&#8217;s security config may vary. After doing this, just add to any of the Kafka commands you use:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
--command-config $HOME/.config/kafka/dev.cfg
</pre></div>


<h2 class="wp-block-heading">Checking consumer offsets</h2>



<p>Before migrating topics, it&#8217;s best if we make sure that the old topic consumer is totally up-to-date. We can use this command to check the consumption lag:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kafka-consumer-groups.sh \
	--bootstrap-server=&#039;&lt;your broker endpoints, separated by commas&gt;&#039; \
	--describe \
	--group=&#039;&lt;your consumer group&gt;&#039;

</pre></div>


<p>This should yield something like the output below:</p>



<pre class="wp-block-code"><code>TOPIC      PARTITION   NEWEST_OFFSET   OLDEST_OFFSET     CONSUMER_OFFSET     LEAD         LAG
your-topic 0           30000000        0                 30000000            30000000     0
your-topic 1           23900000        0                 23900000            23900000     0

CLIENT_HOST      CLIENT_ID         TOPIC          ASSIGNED_PARTITIONS
/128.0.0.0       your-consumer     your-topic     0
/128.0.0.1     	 your-consumer     your-topic     1</code></pre>



<p>From this we can see that there is zero lag, since the newest offset is equal to the consumer offset on both partitions. We can also see that our consumers are still running (they&#8217;re the clients with ID &#8220;your-consumer&#8221;).</p>



<h2 class="wp-block-heading">Performing the Kafka consumer migration</h2>



<p>Before switching topics or brokers, we should first create a consumer group for the new configuration. This will allow us to change the offsets <em>before</em> beginning the message consumption proper. The easiest way to do this is to use <a href="https://github.com/edenhill/kcat"><code>kcat</code></a>, a simple command-line tool that allows us to consume and produce Kafka messages. To create a consumer group, you must consume messages, so it&#8217;s a matter of setting up <code>kcat</code> (check the install guide on the kcat repo) and consuming a few messages from the new topic:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kcat \
	-C \
	-b &#039;&lt;your brokers&gt;&#039; \
	-t new-topic \
	-G new-consumer-group

# If you have authentication, just add: 

	-X security.protocol=SASL_SSL \
	-X sasl.mechanisms=SCRAM-SHA-512 \
	-X sasl.username=&quot;me&quot; \
	-X sasl.password=&quot;noneofyourbusiness&quot;

</pre></div>


<p>Just run this for a second, check that messages come out, and then run the describe command for the new group:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kafka-consumer-groups.sh \
	--bootstrap-server=&#039;new-broker&#039; \
	--describe \
	--group=&#039;new-group&#039;


TOPIC     PARTITION   NEWEST_OFFSET   OLDEST_OFFSET     CONSUMER_OFFSET     LEAD         LAG
new-topic 0           12387000        0                 12                  12           12386988
new-topic 1           12360000        0                 38                  38           12359962

CLIENT_HOST      CLIENT_ID         TOPIC          ASSIGNED_PARTITIONS
</pre></div>


<p>We have huge lag here, but that&#8217;s fine, as we&#8217;re going to reset the offsets anyway. Stop the workers consuming from the older topic by whatever means you can and note down the time at which they stopped. We will now reset the consumer group offset for this new group. Just a note: in this case, we don&#8217;t have any consumers connected to this group, but if we did we&#8217;d also have to turn them off. You <strong>cannot</strong> reset a consumer group offset if there are clients connected to it.</p>



<p>To reset the offsets, just run the following command (here we&#8217;ll assume that we stopped the previous consumers at 10:00 of March 15th, 2023, and subtract ten minutes just to be safe):</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kafka-consumer-groups.sh \
	--bootstrap-server=&#039;new-brokers&#039; \
	--group=&#039;new-group&#039; \
	--topic=&#039;new-topic&#039; \
	--reset-offsets \
	--to-datetime 2023-03-15T09:50:00.000 \
	--dry-run
</pre></div>


<p>Running this dry run will not make any changes, It will only show you the new offsets for the consumer group, e.g.:</p>



<pre class="wp-block-code"><code>TOPIC     PARTITION   NEWEST_OFFSET   OLDEST_OFFSET     CONSUMER_OFFSET     LEAD         LAG
new-topic 0           12387000        0                 12386998            12386988     2
new-topic 1           12360000        0                 12369951            12369951     49

CLIENT_HOST      CLIENT_ID         TOPIC          ASSIGNED_PARTITIONS</code></pre>



<p>If nothing looks strange to you, go ahead, substitute <code>--dry-run</code> with <code>--execute</code> and run the command. Afterwards, deploy the new consumer configuration, turn on the worker, and let it run.</p>
<p>The post <a href="https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/">Performing broker migrations on your Kafka consumers</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Send Email In AWS Using SQS, SNS and Lambda Function</title>
		<link>https://blogit.create.pt/guilhermeperuzzi/2019/10/21/send-email-in-aws-using-sqs-sns-and-lambda-function/</link>
					<comments>https://blogit.create.pt/guilhermeperuzzi/2019/10/21/send-email-in-aws-using-sqs-sns-and-lambda-function/#respond</comments>
		
		<dc:creator><![CDATA[Guilherme Peruzzi]]></dc:creator>
		<pubDate>Mon, 21 Oct 2019 16:08:29 +0000</pubDate>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Lambda]]></category>
		<category><![CDATA[SNS]]></category>
		<category><![CDATA[SQS]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=11611</guid>

					<description><![CDATA[<p>This post explains how to build an AWS infrastructure so you can send an email from AWS to a subscribed email account. We will use SQS, SNS and Lambda Function for this example. Introduction In AWS the main ways that we have to send an email are: Using Amazon Simple Email Service (SES) Using Amazon [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/guilhermeperuzzi/2019/10/21/send-email-in-aws-using-sqs-sns-and-lambda-function/">Send Email In AWS Using SQS, SNS and Lambda Function</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This post explains how to build an AWS infrastructure so you can send an email from AWS to a subscribed email account. We will use SQS, SNS and Lambda Function for this example.</p>



<h2 class="wp-block-heading">Introduction</h2>



<p>In AWS the main ways that we have to send an email are:</p>



<ul class="wp-block-list"><li>Using Amazon Simple Email Service (SES)</li><li>Using Amazon Simple Notification Service (SNS)</li></ul>



<p>For this example we are going to use Amazon Simple Notification Service.</p>



<p>You can check the main differences between SES and SNS <a href="https://chaosgears.com/aws-ses-and-sns-your-first-notification-service/">here</a></p>



<h2 class="wp-block-heading">The components</h2>



<p>Now i&#8217;m going to explain the components that we are going to use.</p>



<h3 class="wp-block-heading">Amazon Simple Queue Service (SQS)</h3>



<p style="text-align:justify">Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available. </p>



<p>More Info: <a href="https://aws.amazon.com/sqs/">SQS</a></p>



<h3 class="wp-block-heading">Amazon Simple Notification Service (SNS)</h3>



<p style="text-align:justify">Amazon Simple Notification Service (SNS) is a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications. Amazon SNS provides topics for high-throughput, push-based, many-to-many messaging. Using Amazon SNS topics, your publisher systems can fan out messages to a large number of subscriber endpoints for parallel processing, including Amazon SQS queues, AWS Lambda functions, and HTTP/S webhooks. Additionally, SNS can be used to fan out notifications to end users using mobile push, SMS, and email.</p>



<p>More Info: <a href="https://aws.amazon.com/sns/">SNS</a></p>



<h3 class="wp-block-heading">AWS Lambda</h3>



<p style="text-align:justify">AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume &#8211; there is no charge when your code is not running.</p>



<p style="text-align:justify">With Lambda, you can run code for virtually any type of application or backend service &#8211; all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.</p>



<p>More Info:  <a href="https://aws.amazon.com/lambda/">Lambda</a></p>



<h2 class="wp-block-heading">Objective</h2>



<p style="text-align:justify">We are going to build a system using a SQS queue where we are going to send the body of the email. The lambda that long pools the queue will be triggered when the message is sent to the queue and will publish the message to the SNS topic so we can send an email with the message body. </p>



<p>More Info:<a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html#sqs-long-polling"> Long Pooling</a></p>



<h2 class="wp-block-heading">Lets Go</h2>



<p style="text-align:justify">Create a SQS Queue where we are going to send the email body message. This queue will be a Standard Queue. This example will not have a deadletter queue configurated, but is always good to have one.</p>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="1892" height="690" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image.png?fit=696%2C254&amp;ssl=1" alt="queue" class="wp-image-11623" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image.png 1892w, https://blogit.create.pt/wp-content/uploads/2019/10/image-300x109.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-768x280.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1024x373.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-696x254.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1068x389.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1152x420.png 1152w" sizes="(max-width: 1892px) 100vw, 1892px" /></figure>



<p>We need to create a SNS Topic. An Amazon SNS topic is a logical access point which acts as a communication channel.</p>



<figure class="wp-block-image"><img decoding="async" width="1853" height="676" src="https://i0.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-1.png?fit=696%2C254&amp;ssl=1" alt="topic" class="wp-image-11624" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-1.png 1853w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1-300x109.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1-768x280.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1-1024x374.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1-696x254.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1-1068x390.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-1-1151x420.png 1151w" sizes="(max-width: 1853px) 100vw, 1853px" /></figure>



<figure class="wp-block-image"><img decoding="async" width="1842" height="665" src="https://i2.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-2.png?fit=696%2C251&amp;ssl=1" alt="topic" class="wp-image-11625" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-2.png 1842w, https://blogit.create.pt/wp-content/uploads/2019/10/image-2-300x108.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-2-768x277.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-2-1024x370.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-2-696x251.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-2-1068x386.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-2-1163x420.png 1163w" sizes="(max-width: 1842px) 100vw, 1842px" /></figure>



<p style="text-align:justify">Create a subscription to that topic. The subscription resource subscribes an endpoint to an Amazon Simple Notification Service (Amazon SNS) topic. For a subscription to be created, the owner of the endpoint must confirm the subscription. The protocol of the subscription will be Email. The endpoint will be the email address that will receive the email. For this example i used a temporary mail so that i didn&#8217;t fill my personal inbox with emails. </p>



<p>More Info: <a href="https://temp-mail.org/en/">Temp-Mail</a></p>



<figure class="wp-block-image"><img decoding="async" width="1834" height="747" src="https://i0.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-3.png?fit=696%2C283&amp;ssl=1" alt="subscription" class="wp-image-11626" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-3.png 1834w, https://blogit.create.pt/wp-content/uploads/2019/10/image-3-300x122.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-3-768x313.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-3-1024x417.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-3-696x283.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-3-1068x435.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-3-1031x420.png 1031w" sizes="(max-width: 1834px) 100vw, 1834px" /></figure>



<p style="text-align:justify">After you configure the subscription you will receive an email with a link to confirm the subscription.</p>



<figure class="wp-block-image"><img decoding="async" width="1127" height="734" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-4.png?fit=696%2C453&amp;ssl=1" alt="email" class="wp-image-11627" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-4.png 1127w, https://blogit.create.pt/wp-content/uploads/2019/10/image-4-300x195.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-4-768x500.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-4-1024x667.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-4-696x453.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-4-1068x696.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-4-645x420.png 645w" sizes="(max-width: 1127px) 100vw, 1127px" /></figure>



<p>When you click on the link you will be redirected to the subscription confirmation page</p>



<figure class="wp-block-image"><img decoding="async" width="844" height="442" src="https://blogit.create.pt////wp-content/uploads/2019/10/image-5.png" alt="confirmed" class="wp-image-11628" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-5.png 844w, https://blogit.create.pt/wp-content/uploads/2019/10/image-5-300x157.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-5-768x402.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-5-696x364.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-5-802x420.png 802w" sizes="(max-width: 844px) 100vw, 844px" /></figure>



<p style="text-align:justify">Create the lambda that will use long pooling to check if there are new messages in the queue and publish the messages to the SNS Topic.</p>



<p style="text-align:justify">In this example i used Python to develop the lambda and called it &#8220;EmailLambda&#8221;. Note: you need to set the role of the lambda so that the lambda has permissions to long pool the sqs queue and publish a message to the SNS topic.</p>



<p>More Info: <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonsns.html">SNS IAM Roles</a>  <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-using-identity-based-policies.html">SQS IAM Roles</a> </p>



<figure class="wp-block-image"><img decoding="async" width="1849" height="870" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-6.png?fit=696%2C328&amp;ssl=1" alt="lambda" class="wp-image-11629" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-6.png 1849w, https://blogit.create.pt/wp-content/uploads/2019/10/image-6-300x141.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-6-768x361.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-6-1024x482.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-6-696x327.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-6-1068x503.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-6-893x420.png 893w" sizes="(max-width: 1849px) 100vw, 1849px" /></figure>



<p>Here is the lambda code that i used.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
#!/usr/bin/python3
import json
import boto3
import os

def lambda_handler(event, context):
    batch_processes=&#x5B;]
    for record in event&#x5B;&#039;Records&#039;]:
        send_request(record&#x5B;&quot;body&quot;])
		

def send_request(body):
    # Create an SNS client
    sns = boto3.client(&#039;sns&#039;)

    # Publish a simple message to the specified SNS topic
    response = sns.publish(
        TopicArn=os.environ&#x5B;&#039;email_topic&#039;],    
        Message=body,    
    )

    # Print out the response
    print(response)
 
</pre></div>


<p>Set the lambda enviroment variable email_topic to the ARN of the SNS Topic we created earlier.</p>



<figure class="wp-block-image"><img decoding="async" width="1687" height="409" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-7.png?fit=696%2C169&amp;ssl=1" alt="topic" class="wp-image-11631" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-7.png 1687w, https://blogit.create.pt/wp-content/uploads/2019/10/image-7-300x73.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-7-768x186.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-7-1024x248.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-7-696x169.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-7-1068x259.png 1068w" sizes="(max-width: 1687px) 100vw, 1687px" /></figure>



<p>Add the lambda trigger and set it with the sqs queue that will receive the body of the email.</p>



<figure class="wp-block-image"><img decoding="async" width="1859" height="875" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-8.png?fit=696%2C328&amp;ssl=1" alt="trigger" class="wp-image-11632" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-8.png 1859w, https://blogit.create.pt/wp-content/uploads/2019/10/image-8-300x141.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-8-768x361.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-8-1024x482.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-8-696x328.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-8-1068x503.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-8-892x420.png 892w" sizes="(max-width: 1859px) 100vw, 1859px" /></figure>



<h3 class="wp-block-heading">Lets Test it !!!</h3>



<p>Now the only thing that we need to do is send a new message to the SQS queue with the email body that we want.</p>



<figure class="wp-block-image"><img decoding="async" width="1917" height="875" src="https://i0.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-9.png?fit=696%2C317&amp;ssl=1" alt="send message" class="wp-image-11633" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-9.png 1917w, https://blogit.create.pt/wp-content/uploads/2019/10/image-9-300x137.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-9-768x351.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-9-1024x467.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-9-696x318.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-9-1068x487.png 1068w, https://blogit.create.pt/wp-content/uploads/2019/10/image-9-920x420.png 920w" sizes="(max-width: 1917px) 100vw, 1917px" /></figure>



<figure class="wp-block-image"><img decoding="async" width="980" height="898" src="https://blogit.create.pt////wp-content/uploads/2019/10/image-10.png" alt="Send message" class="wp-image-11634" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-10.png 980w, https://blogit.create.pt/wp-content/uploads/2019/10/image-10-300x275.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-10-768x704.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-10-696x638.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-10-458x420.png 458w" sizes="(max-width: 980px) 100vw, 980px" /></figure>



<p>Now we will receive an email from  no-reply@sns.amazonaws.com with the body of the queue message.</p>



<figure class="wp-block-image"><img decoding="async" width="1101" height="407" src="https://i0.wp.com/blogit.create.pt/wp-content/uploads/2019/10/image-11.png?fit=696%2C258&amp;ssl=1" alt="Email" class="wp-image-11635" srcset="https://blogit.create.pt/wp-content/uploads/2019/10/image-11.png 1101w, https://blogit.create.pt/wp-content/uploads/2019/10/image-11-300x111.png 300w, https://blogit.create.pt/wp-content/uploads/2019/10/image-11-768x284.png 768w, https://blogit.create.pt/wp-content/uploads/2019/10/image-11-1024x379.png 1024w, https://blogit.create.pt/wp-content/uploads/2019/10/image-11-696x257.png 696w, https://blogit.create.pt/wp-content/uploads/2019/10/image-11-1068x395.png 1068w" sizes="(max-width: 1101px) 100vw, 1101px" /></figure>



<p>And there you have it. An email notification in AWS using SQS, SNS and Lambda.</p>



<p>Thanks for reading this post and have an&#8230;</p>



<figure class="wp-block-image"><img decoding="async" src="https://d2cnjxvu6pstmv.cloudfront.net/2016/03/14165712/awesomeday1.jpg" alt="Image result for aws awesome day" /></figure>



<p></p>
<p>The post <a href="https://blogit.create.pt/guilhermeperuzzi/2019/10/21/send-email-in-aws-using-sqs-sns-and-lambda-function/">Send Email In AWS Using SQS, SNS and Lambda Function</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/guilhermeperuzzi/2019/10/21/send-email-in-aws-using-sqs-sns-and-lambda-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
