Step-By-Step Process to create SQS topic in aws using terraform
Step 1: Launch An Instance
- Launch EC2 instance with Amazon Linux2 Kernel 5.10(AMI) along with port numbers set SSH – 22, HTTP 8o and select storage t2.micro.
- Now connect with git bash terminal by using SSH Client
Step 2: Install Terraform
Now install terraform packages from official site of hashicorp or follow below commands
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
sudo yum -y install terraform
Step 3: Create A File And Write Terraform Script for to create SQS topic
Create a file with .tf extension in that file write a script by using following command
vi <filename.tf> “.tf” is a extension of terraform without this extension we cannot create a terraform file
Provider configuration
This section specifies the AWS provider and sets the region to “us-east-1”. The provider block configures the authentication details and default settings for interacting with AWS.
provider "aws" {
region = "us-east-1" # Specify your desired AWS region
}
Create SQS topic
Define the SQS topic resource in your Terraform configuration file, specifying the name for the topic.
resource "aws_sqs_queue" "my_queue" {
name = "my-sqs-topic"
}
Step 4: Now Initialize Terraform And Execute Terraform Commands
Now initialize terraform by using following command
terraform init
- Now execute terraform execution commands by using following commands
terraform fmt
terraform validate
terraform plan
- Now execute terraform apply command by using following command
terraform apply --auto-approve
The following screenshot shows that we successfully created a sqs in aws using terraform
How To Create SQS In AWS Using Terraform ?
Amazon Simple Queue Service (SQS) is a completely managed message queuing service provided by AWS, offering scalable and reliable message conveyance between distributed parts of an application. It fills in as a fundamental building block for building event driven, microservice-based models, empowering consistent communication and coordination between unique parts of a system. SQS topics, a critical component of SQS, take into consideration the association and the board of related SQS queues, working with the execution of pub/sub informing designs.
In this guide, we’ll investigate how to make SQS topics in AWS using Terraform, a infrastructure as-code tool that enables the definition and provisioning of cloud resources in a revelatory way. By utilizing Terraforms capacities, DevOps developers and engineers can automate the sending and the executives of SQS topics, streamlining out the most common way of building scalable and resilient applications in the cloud.
Through step-by-step instructions, meanings of key terminologies, and practical examples, this guide expects to give a complete comprehension of creating SQS topics with Terraform. Additionally, many frequently asked questions (FAQs) will address common queries and concerns, ensuring a careful handle of the topic.