Understanding of SES-SQS
Are you looking for SaaS Application Development Services that build a highly scalable and resilient app for better business and app security? DEV IT nurtures high-quality cloud application development using AWS. There are two major AWS features that enhance your app quality and take it to the next level. They are SES & SQS – let’s understand more about what they are and how they can be very helpful.
- The full form of AWS SES is Simple Email Services.
- To send email with SES is too straightforward.
- To prevent spamming by default it only provides us with a sandbox environment.
- In a free tier (sandbox) account, you can send and receive emails from verified email addresses only.
- Please find below the steps to configuration with a screenshot.
- You can send simple text emails or emails with specific templates.
- We are using Node AWS SDK to show you sample code to send emails with AWS SES and NodeJs.
Installation
– npm install node-ses
Small Example
var ses = require('node-ses'); let client = ses.createClient({ key: 'key', secret: 'secret' }); // Give SES the details and let it construct the message for you. client.sendEmail({ to: ‘Email Address’ , from: Email Address’ , cc: ‘Email Address' , bcc: [' Email Address’, ' Email Address’'] , subject: 'AWS SES TEST EMAIL' , message: 'your <b>message</b> goes here' , altText: 'plain text' }, function (err, data, res) { }); //OR use sendRawEmail client.sendRawEmail({ , from: 'somewhereOverTheR@inbow.com' , rawMessage: rawMessage }, function (err, data, res) { // ... });
Send Email Params Description
- from` – email address from which to send (required)
- `subject` – string (required). It must be encoded as UTF-8
- `message` – if simple html is required.
- `altText` – simple plain text version of the message.
- `to` – Here you can pass a single email or an array of email addresses
- `cc` – Here you can pass a single email or an array of email addresses
- `bcc` – Here you can pass a single email or an array of email addresses
- `replyTo` – Single email address
ToAddresses: Here it should contain an array of email addresses where you want to send an email.
Body.Html.Data: Here it should contain an HTML message template. Here we have to set all styles as inline.
Body.Subject.Data: Here it should contain the subject of the email.
Source: Here it should contain the email address of the sender.
ConfigurationSetName: If you want to receive a notification then you have to configure the name of the SNS topic.
SQS(Simple Queue Service)
- The full form of SQS is a Simple Queue Service.
- SQS is used to send, store, and receive messages between software components, without losing messages or it’s not requiring other services to be available.
- Queuing service enables you to decouple and scale distributed systems, microservices and serverless applications.
Benefits
- Eliminate Administrative Overhead
- Reliably Deliver Messages
- Keep Sensitive Data Secure
- Scale Elastically And Cost-Effectively
Types of Queue
- Standard Queue
- FIFO Queue
Standard Queue
- TPS(Transaction Per Limit) is nearly unlimited.
- Message will be delivered at least once, occasionally it might be delivered in an order different from which they were sent.
Send data between applications when the throughput is important, for example:
- It will decouple live user requests from intensive background work: and let users upload media while resizing or encoding it.
- Allocate tasks to multiple worker nodes: process a high number of credit card validation requests.
- Batch messages for future processing: schedule multiple entries to be added to a database.
FIFO Queue
- This type of queue supports up to 300 messages per second (receive, send, or delete).
- When you batch 10 messages per operation (maximum), FIFO queues can support up to 3,000 messages per second.
- You can raise a support request to increase the limit.
- The order is strictly preserved for messages sent and received.
- Once a message is delivered remains available until a consumer processes and deletes it.
- Send data between applications when the order of events is important, for example:
- Need to ensure that commands are executed in the right order.
- Display the correct product price by sending price modifications in the right order.
- Prevent a student from enrolling in a course before registering for an account.