In this post, I would like to show you how you can quickly spin up an Amazon EC2 instance with the Solace PubSub+ Event Broker deployed on it. Of course, you can always just use Solace Cloud and deploy on AWS through it in seconds but where is the fun in that?
I love AMIs and I cannot lie. Gone are the days when you had to read lengthy documentation and figure out how to manually install binaries. Gone are the days when you had to worry about installing different package managers to manually install all the required libraries via pip
or conda
.
We live in a brave new world where with just few clicks, we can spin up an Amazon EC2 instance with all the necessary binaries and libraries installed with proper configurations to quickly get started. Personally, as a developer who loves to try new technologies and who does a lot of demos, this is so convenient.
Solace PubSub+ Event Broker is “unified event broker technology available as run-anywhere software, purpose-built hardware, and a managed service that you can use together to stream events across your distributed enterprise”. PubSub+ Standard Edition is free to use, even in production.
Amazon Machine Image (AMI)
Amazon has AMI Marketplace where you can pick from numerous paid and free AMIs. In case you are not familiar with AMIs, they provide the information required to launch an EC2 instance; Solace also has an AMI available for PubSub+Event Broker: Software.
You will find necessary information on the AMI page about the instance and what it contains. In my opinion, the most important section is the Pricing Information section which tells you the estimated cost of launching an instance from this AMI.
As you can see, there is no cost to using the PubSub+ Event Broker: Software itself but there is cost involved for the underlying AWS infrastructure since you can’t use the free tier Amazon EC2 instance to run Solace PubSub+ Event Broker. Keep this in mind as you launch your own EC2 instance.
The Usage Information section is also very helpful. You can find links to several necessary resources there which help you get started.
Alright, let’s go ahead and launch an EC2 instance from the AMI. You can do it straight from the current page or you can go to the EC2 page and launch an instance from there. We will do it from the EC2 page.
Launching an Amazon EC2 instance from Solace PubSub+ Event Broker: Software AMI
Log in to your AWS account and go to the EC2 services page.
Once you are there, click the Launch instance button and select Launch instance.
Great, you will now be taken to a page where you can pick an AMI from which you will launch your EC2 instance.
Click the AWS Marketplace tab and search for Solace. You will see Solace’s PubSub+ AMI as the result of your query. Click Select to proceed.
On the next page, you will see the pricing and usage information which we saw earlier. Click Continue.
Then, you will be asked to pick the underlying EC2 instance. There are minimum requirements to use PubSub+ Event Broker software so you cannot use t2.micro (free tier). The recommended instance is General Purpose t2.large (2 vCPUs, 8 GiB Memory) so we will stick to that for this demo. Note that different instances cost differently, so pick wisely.
Click Configure Instance Details. On this page, you can select which VPC you would like to deploy your instance into and pick IAM role to attach to the instance among other details. For our purpose, we will stick with the defaults. The only thing I changed is that I assigned my existing admin IAM role to my EC2 instance.
Click Add Storage and leave it as it is and click Add Tags.
This is not mandatory but I like to add tags to my EC2 instances so I can easily recognize them later. I added the ‘Name’ tag to my EC2 instance.
Click Configure Security Group to configure your security settings. The default option is to create a new Security Group with the recommended rules, or you can pick an existing Security Group. For our use case, we will create a new group with the recommended settings. Click Review and Launch. Review the details and click Launch. You will be asked to select an existing Key Pair or create a new one. I have selected an existing Key Pair which I will be using to log in to this EC2 instance.
And, that’s it! We now have an EC2 instance spinning up from Solace’s PubSub+ Event Broker software AMI.
Next, we will take PubSub+ Event Broker for a spin.
Configuring PubSub+ Event Broker
There is not much to configure, which is the beauty of this whole setup, except for an admin user which we will use to later log in to PubSub+ Broker Manager.
First, let’s log in to our EC2 instance using the Key Pair which we selected when we launched our EC2 instance.
Go to your EC2 page and you should see your new EC2 instance there:
Select your EC2 instance and click Connect to get the ssh command. Note that you need to use the sysadmin user instead of root.
MacBook-Pro:Downloads hgupta$ ssh -i "himanshu-tokyo.pem" sysadmin@ec2-13-115-6-241.ap-northeast-1.compute.amazonaws.com Solace PubSub+ Standard
You can now see the Solace PubSub+ Event Broker instance running:
[sysadmin@ip-172-31-28-133 ~]$ solacectl cli Solace PubSub+ Standard Version 9.3.1.5 Operating Mode: Message Routing Node
This proves that we were able to successfully launch an Amazon EC2 instance with Solace PubSub+ Event Broker on it. We now need to create an admin user which we will use to log in to Solace PubSub+ Broker Manager. We can do so through Solace CLI.
First, let’s activate the CLI:
[sysadmin@ip-172-31-28-133 ~]$ solacectl cli Solace PubSub+ Standard Version 9.3.1.5 Operating Mode: Message Routing Node
Now, we can run the following commands to create a new user called admin with the password admin (obviously, don’t do it in production).
ip-172-31-28-133> enable ip-172-31-28-133# configure ip-172-31-28-133(configure)# create username admin password admin
That should do it.
Accessing PubSub+ Broker Manager
Now that we have our admin user created, we can use its credentials to log in to PubSub+ Broker Manager.
Go to the following URL on your browser: http://<ec2_public_ip>:8080
You will see the Solace PubSub+Event Broker Software Standard login page:
Log in with your admin credentials and you will be taken to the following page with your default Message VPN:
And that’s it! This whole process took me 5-10 minutes.
Once you are done playing around with PubSub+Event Broker, you can easily terminate your EC2 instance from your EC2 instance page. Make sure to do so to avoid any infrastructure charges.
I hope you found this post useful. For more information, visit PubSub+ for Developers. If you have any questions, post them to the Solace Developer Community.