b. Setup SNS topic

First, create an SNS topic, then you publish a message directly to the topic to test that you have properly configured it

  1. In the AWS Cloud9 terminal login to the head node of your cluster as below:

    pcluster ssh perflab-yourname -i ~/.ssh/lab-4-key

To set up an SNS topic

  1. Configure your email address and AWS region

    • Enter your email address where you would like to receive the SNS notifications

      MY_EMAIL_ADDRESS=<your-email-address>
    • Identify your AWS Region using the command below

      REGION=`curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}'`
  2. Create the topic using the create-topic command as follows.

    MY_SNS_TOPIC=$(aws sns create-topic --name slurm-job-completion --region $REGION --output text)
    echo $MY_SNS_TOPIC

Subscribe to your created SNS topic

  1. Subscribe your email address to the topic using the subscribe command. If the subscription request succeeds, you receive a confirmation email message.

    aws sns subscribe --topic-arn $MY_SNS_TOPIC --protocol email --notification-endpoint $MY_EMAIL_ADDRESS --region $REGION
    • Amazon SNS returns the following:

SNS TOPIC

  1. From your email application, open the message from AWS Notifications and confirm your subscription.

SNS TOPIC

  1. Your web browser displays a confirmation response from Amazon Simple Notification Service.

SNS TOPIC

Next, we will check the subscription and publish a test message to the topic.