In this use case we are going to perform a task where we will configure the Amazon SNS service that will be configured with Amazon EC2 Auto Scaling service. in case any instance is added or terminated then notification will be generated. For notification we are going to use the Email service.

Before going to start the use case lets understand what is AWS SNS service and how it works.

  • You can manage the notifications of the resources for your cloud environment using Amazon Simple Notification Service.
  • One can get notified when the resources are added or get terminated by the user.
  • This is a managed service that provides message delivery from the publishers to the subscribers.

SNS features:

  • Application-to-application messaging
  • Application-to-person messaging
  • Standard and FIFO topics
  • Message security and many more

Objective:

  • Create SNS topic from AWS console.
  • Subscribe an end point for the SNS topic.
  • Create a template to launch ec2 instances.
  • Set up an auto scaling group(ASG).
  • which will launch and terminate the ec2 instances
  • Configure SNS topic with ASG to generate notifications.

Below are the steps which will give you an idea how we can perform the above task.

  1. Go to the Amazon Console, browse SNS service and go to the SNS dashboard.
  1. Create an Amazon SNS topic, this SNS topic is a logical access point which is a communication channel point to your service Auto Scaling Group uses to send notifications.
  1. Subscribe an endpoint to the Amazon SNS topic to receive notification to your Auto Scaling group. In the options, for an endpoint, specify an email address where you want to receive the notifications from Amazon EC2 Auto Scaling. 
  1. Confirm your Amazon SNS subscription, Amazon SNS will send a confirmation mail on the email address you specified. You have to open an email from AWS notification and choose the confirmation link for the subscription. 

After successful confirmation, you will receive an acknowledgement message from AWS.

After Subscription is confirmed, your status will show as ‘confirmed’ on a Console.

  1. In this step we are going to configure the Amazon EC2 Auto Scaling group. Click on the create auto scaling group.
  1. Before configuring the auto scaling group, we will launch an template for different services. In a launch template box click on the ‘create a launch template’.
  1. Enter a launch template name and description
  1. Enter ‘Launch Template Content’ like Amazon Machine Image, Instance type
  1. Now we have to create a key pair which will be attached to our instances or can select an existing key pair in a ‘key pair login’ option.
  1. Network Settings:
  • Under network setting select ‘Virtual Private Cloud’ as a networking platform.
  • For Security group you can select already created security group or default one.
  • here we have selected the default security group.
  1. In storage volume, select ‘Volume 1 (AMI root) (8 GiB, EBS, General purpose SSD (gr2))
  1. After configuring all the above options we have successfully created the launch template.
  1. As our template is created we can select that template while creating the auto scaling group which will show all the configuration.
  1. Auto scaling group configuration settings: choose ‘adhere to launch template’ option in ‘instance purchase options’
  1. Under network info select default VPC and subnet.
  1. In a configure advance option, you can choose different options like ‘No load balancer’, ‘Attach to an existing load balancer’, ‘attach to a new load balancer’. Here I am continuing with ‘no load balancer’.
  1. In step 4 configure group size and scaling policies, select desired capacity, minimum capacity, maximum capacity as 1, 1, 1.
  1. Under “add notifications” settings select the SNS topic that was created in above step.
  2. Select an event choose all the four options ‘Launch’, ‘Terminate’, ‘Fail to launch’, ‘Fail to terminate’.
  1. Then click on next button and add tag for ASG.
  1. It will a create Auto scaling group.
  1. After performing all the above steps, we have successfully configured an Amazon SNS with Amazon EC2 auto scaling group and get the notification over the email as I get from the Amazon SNS service for launching an EC2 instance.

Kindly comment here or mail us support@data-stats.com and edugenixcloud@gmail.com in case of any doubts. We will reach you as soon as possible.

Categories: AWS

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Insert math as
Block
Inline
Additional settings
Formula color
Text color
#333333
Type math using LaTeX
Preview
\({}\)
Nothing to preview
Insert