So let's practice using SNS.
So we're going to go into the simple notification service
and create our first topic.
So I'll just call this my first topic
and then click on the next step.
So we have two options for creating a topic.
It can either be a standard topic
and this will be creating
which is best effort message ordering
at least once message delivery, highest reboot
in terms of publishers per second
and SQS Lambda HTTP, SMS, email
and mobile application endpoints can read
from this SNS topic, or we've seen
that we could create an SNS FIFO topic.
And this is to get a strictly preserved message ordering
exactly once message delivery.
High-throughput up to 300 publishes per second.
And the only thing that can subscribe
to a FIFO SNS topic is an SQS FIFO queue.
In this case, if we are FIFO, we can see
that the name of the topic has to end with dot FIFO.
So we'll just go with standard
and then we'll use my first topic as the name.
We can encrypt the messages in our topic.
We can set up an access policy
and the excess policy is going to define who
and what can right to the SNS topics.
So this is similar to an S3 bucket policy
and this is similar to also an SQS access to policy, okay?
The idea is that with this access policy, for example
we could set up an S3 buckets
to write events into an SNS topic.
And then as SNS topic can send data to SQS and so on.
So the access policy will be needed
to allow the extra buckets to write to our SNS topic.
So for now just use basic
because we don't need to do anything fancy
and then we are not going to set up any of these
and then we'll just click on create topic.
So my first topic is created
and as we can see right now, we have zero subscriptions.
So we need to create our first subscription.
So I'm going to create one and winters sort protocol.
So it could be Kinesis Data Firehose, SQS,
Lambda, email, email, Jason HTTP, HTTPS and SMS, okay?
And you have to remember those going into the exempt
but to make it very simple, we're first going to use email
and actually only going to use email in this hands-on.
Now we need to use an endpoint.
So an email address
I will use stephantheteacher@mailinator.com
And this is just a service for me to get a temporary email.
So if I type Stephantheteacher and press on go,
then I'm getting a public inbox
and that will receive emails from this address, okay?
So we're going to create this.
As we can see right here,
we could set up a subscription filter policy.
This is optional, but with this policy
we could filter the messages that will be sent
to the subscription, which can be really helpful.
If you have many subscribers
there's just needs to get only a subsets of the messages
sent into your sq or your SNS topic
but we will not set it up right now.
So we'll create this subscription
and now we need to validate the subscription.
So as we can see right now, it is pending confirmation.
And so to confirm it, I'm going to go
into my mailinator and I've received an email.
And by clicking on this confirm subscription
I'm going to confirm a subscription.
So here we go.
And now if I refresh this page, what I should be seeing
is that my subscription right here is confirmed.
So this is perfect.
So and again, if I click on my subscription,
I can look at it,
see that is going to send an email to this end point.
And if I wanted to do it
I could have a subscription filter policy
but right now we don't have any
because we want all messages send to my SNS topic
to go there directly into the subscription.
So now let's do a test.
We're going to publish a message.
And I'm going to just enter a message structure.
I'll say hello world which is very common
when we test some services and then publish the message.
So the message has been published into my first topic.
And so what I should be seeing
is that if I go back to my emails
and go to my public messages
so back to my inbox, I should be seeing yes
an AWS notification message coming straight from SNS
saying hello world.
So they're easy, very cool.
And we just show that SNS is working for us.
So this is perfect, we're good to go.
If we wanted to implement the SQS fan-out pattern
we would need to choose SQS and set up
many, many different cues as the receivers
of the subscription for our SNS topic.
So, yep, that's it for SNS.
When you're done, delete the subscription
and then go back to the topic on the left hand side
and then click on delete
to delete the topic by tapping delete me.
And if you go, that's it for SNS
I hope you liked it and I will see you in the next lecture.