<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Caleb Yeboah</title>
    <description>The latest articles on DEV Community by Caleb Yeboah (@calebyeboah).</description>
    <link>https://dev.to/calebyeboah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F861468%2F0af5e5cd-ae93-4da6-b93c-09f9a34b4c58.png</url>
      <title>DEV Community: Caleb Yeboah</title>
      <link>https://dev.to/calebyeboah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/calebyeboah"/>
    <language>en</language>
    <item>
      <title>Automating the deployment of Docker Containers on Amazon EC2 with Infrastructure as Code (IaC) tool - Terraform</title>
      <dc:creator>Caleb Yeboah</dc:creator>
      <pubDate>Mon, 13 Nov 2023 21:38:01 +0000</pubDate>
      <link>https://dev.to/calebyeboah/deploying-docker-containers-on-amazon-ec2-with-infrastructure-as-code-iac-tool-terraform-4imn</link>
      <guid>https://dev.to/calebyeboah/deploying-docker-containers-on-amazon-ec2-with-infrastructure-as-code-iac-tool-terraform-4imn</guid>
      <description>&lt;h1&gt;
  
  
  Introduction:
&lt;/h1&gt;

&lt;p&gt;Docker has revolutionized the way applications are deployed and run, providing a lightweight and consistent environment across different platforms. Amazon EC2, a popular cloud computing service, allows users to deploy virtual servers in the cloud. In this guide, we'll walk you through the process of pulling a Docker image from Docker Hub and running a container on an EC2 instance using Infrastructure as Code (IaC).&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites:
&lt;/h2&gt;

&lt;p&gt;Before you begin, ensure you have the following prerequisites in place:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account with the necessary permissions to create EC2 instances.&lt;/li&gt;
&lt;li&gt;The AWS CLI installed on your local machine.&lt;/li&gt;
&lt;li&gt;Terraform installed on your local machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Create an EC2 Key Pair
&lt;/h2&gt;

&lt;p&gt;To securely access your EC2 instance, you'll need an SSH key pair. If you don't have one, create a new key pair using the AWS Management Console or the AWS CLI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 create-key-pair --key-name YourKeyName --query 'KeyMaterial' --output text &amp;gt; YourKeyName.pem
chmod 400 YourKeyName.pem

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can use ssh-keygen to create the key-pair on your computer.&lt;/p&gt;

&lt;h4&gt;
  
  
  Generate SSH key pair
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -b 2048 -f YourKeyName

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Set appropriate permissions
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 400 YourKeyName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace YourKeyName with a preferred name for your key pair.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Create a main.tf file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch main.tf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Update main.tf
&lt;/h3&gt;

&lt;p&gt;Modify the aws_instance resource block in main.tf to include the key_name parameter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~&amp;gt; 4.16"
    }
  }

  required_version = "&amp;gt;= 1.2.0"
}

provider "aws" {
  region = "us-west-2"
}


resource "aws_vpc" "main" {
  cidr_block = var.vpc_cidr_block

  tags = {
    "Name" = "Production ${var.main_vpc_name}"
  }
}

# Create a subnet
resource "aws_subnet" "web" {
  vpc_id            = aws_vpc.main.id
  cidr_block        = var.web_subnet
  availability_zone = var.subnet_zone

  tags = {
    Name = "Web Subnet"
  }
}


resource "aws_internet_gateway" "my_web_igw" {
  vpc_id = aws_vpc.main.id

  tags = {
    Name = "${var.main_vpc_name} IGW"
  }
}

resource "aws_default_route_table" "main_vpc_default_rt" {
  default_route_table_id = aws_vpc.main.default_route_table_id

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.my_web_igw.id
  }

  tags = {
    Name = "my-default-rt"
  }
}

resource "aws_default_security_group" "default_sec_group" {
  vpc_id = aws_vpc.main.id

  ingress {
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port   = 8080
    to_port     = 8080
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port   = 5000
    to_port     = 5000
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1" # any protocol
    cidr_blocks = ["0.0.0.0/0"]
  }

  tags = {
    "Name" = "Default Security Group"
  }
}

# Create a new Key Pair
resource "aws_key_pair" "terraform_ssh_pair" {
  key_name = "terraform_rsa" 
  public_key = file(var.ssh_public_key)
}


data "aws_ami" "latest_amazon_linux2" {
  owners = [ "amazon" ]
  most_recent = true
  filter {
    name = "name"
    values = ["amzn2-ami-kernel-*-x86_64-gp2"] 
  }

  filter {
    name = "architecture"
    values = [ "x86_64" ]
  }

}

resource "aws_instance" "web-server" {
  ami                         = data.aws_ami.latest_amazon_linux2.id 
  instance_type               = "t2.micro"
  subnet_id                   = aws_subnet.web.id
  vpc_security_group_ids      = [aws_default_security_group.default_sec_group.id]
  associate_public_ip_address = true
  user_data = file("script.sh")
  key_name                    = aws_key_pair.terraform_ssh_pair.key_name
  tags = {
    "Name" : "My Public Web Server"
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The user_data is contained in script.sh below. This installs an apache server (to confirm if everything worked correctly). It also installs docker, terraform and runs an nginx docker container as well. You can modify the script to suit your requirements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# update vm and install server
sudo yum -y update &amp;amp;&amp;amp; sudo yum -y install httpd
sudo systemctl start httpd &amp;amp;&amp;amp; sudo systemctl enable httpd
sudo echo "&amp;lt;h1&amp;gt;Deployed via Terraform&amp;lt;/h1&amp;gt;" &amp;gt; /var/www/html/index.html

# install terraform
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
sudo touch ~/.bashrc
sudo terraform -install-autocomplete

# install docker
sudo yum -y install docker
sudo systemctl start docker
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -aG docker ec2-user
sudo chkconfig docker on
sudo yum install -y git
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo systemctl enable docker
sudo docker run -d -p 8080:80 nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Create a variables.tf file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch variables.tf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Update variables.tf
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable "vpc_cidr_block" {
  type        = string
  description = "cidr block for the main vpc"
  default     = "10.0.0.0/16"
}

variable "web_subnet" {
  type        = string
  description = "cidr block for the web subnet"
  default     = "10.0.10.0/24"
}

variable "subnet_zone" {
  type        = string
  description = "availability zone for subnet zone"
  # subnet_zone was set as environment variable
}

variable "ssh_public_key" {
  type = string
  description = "public key that permits ssh connection to the ec2 instance"
}

variable "main_vpc_name" {
  type        = string
  description = "name of the main vpc"
}

variable "my_public_ip" {
  description = "my public ip address"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Create an output.tf file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch output.tf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update the output.tf file with the configuration below which provides the public IP address of the instance upon creation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;output "public_ip" {
  description = "The public IP address of the EC2 instance."
  value       = aws_instance.web-server.public_ip
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Usage
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Follow the previous steps to clone &lt;a href="https://github.com/CalebYeboah27/terraform-dev-environment"&gt;the repository&lt;/a&gt;, customize configurations, and run terraform apply.&lt;/li&gt;
&lt;li&gt;After the Terraform apply, you will find the public IP address and the path to the local SSH private key in the outputs.&lt;/li&gt;
&lt;li&gt;Use the following command to SSH into the EC2 instance:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i YourKeyName ec2-user@&amp;lt;public_ip&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace YourKeyName with the name of your private key file and  with the actual public IP address.&lt;/p&gt;

&lt;p&gt;Now, you can securely access your EC2 instance using the generated SSH key pair.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>docker</category>
      <category>terraform</category>
    </item>
    <item>
      <title>Automating Bulk WhatsApp Messaging for CRM: A Python Script</title>
      <dc:creator>Caleb Yeboah</dc:creator>
      <pubDate>Tue, 26 Sep 2023 21:13:22 +0000</pubDate>
      <link>https://dev.to/calebyeboah/automating-bulk-whatsapp-messaging-for-crm-a-python-script-1bii</link>
      <guid>https://dev.to/calebyeboah/automating-bulk-whatsapp-messaging-for-crm-a-python-script-1bii</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kvEjyD92--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vsqnau2g2y52tf3mjz8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kvEjyD92--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vsqnau2g2y52tf3mjz8.jpg" alt="Python Script Automation" width="640" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today's fast-paced world, communication is key for businesses looking to engage with their clients and customers effectively. For many, WhatsApp has become a preferred channel due to its popularity and accessibility. However, sending individual messages to a large contact list can be time-consuming and inefficient. To address this challenge, we've developed a Python script that automates bulk WhatsApp messaging, making it easy to reach out to clients and customers seamlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;WhatsApp is a powerful tool for connecting with clients and customers. However, sending messages to a long list of contacts manually can be a daunting task. Our Python script streamlines this process by allowing you to send bulk messages via WhatsApp. This script is designed to integrate seamlessly into a Customer Relationship Management (CRM) system, providing a more efficient way to communicate with your contacts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;p&gt;Our WhatsApp bulk messaging script comes with several key features:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Bulk Messaging:&lt;/strong&gt; Send messages to multiple contacts at once, reducing the time and effort required for communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Customizable Messages:&lt;/strong&gt; Personalize messages for each contact by using placeholders for contact information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Contact List:&lt;/strong&gt; Import a list of contacts from a CSV file, making it easy to manage your recipient list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Automated Messaging:&lt;/strong&gt; Schedule messages to be sent at specific times, allowing you to reach your contacts when it's most convenient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Logging:&lt;/strong&gt; Keep track of sent messages and any errors, ensuring transparency in your messaging process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you get started, you'll need a few things in place:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.6 or higher installed on your system.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;selenium&lt;/code&gt; library installed via &lt;code&gt;pip&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://chromedriver.chromium.org/downloads"&gt;Chrome WebDriver&lt;/a&gt; compatible with your Chrome browser version.&lt;/li&gt;
&lt;li&gt;A CSV file containing your contact list with at least two columns: &lt;code&gt;Name&lt;/code&gt; and &lt;code&gt;Phone&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Find starter code from my Github repo: &lt;a href="https://github.com/CalebYeboah27/whatsapp_send_bulk"&gt;https://github.com/CalebYeboah27/whatsapp_send_bulk&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;To begin automating your WhatsApp messaging, follow these steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Clone or Download the Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can find the script in our GitHub repository. Clone or download it to your local machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Install Dependencies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use &lt;code&gt;pip&lt;/code&gt; to install the required &lt;code&gt;selenium&lt;/code&gt; library.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;selenium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Run the Script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Execute the script using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python whatsapp_bulk_messaging.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script will guide you through the process of logging in to WhatsApp Web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Send Bulk Messages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Follow the on-screen instructions, and the script will begin sending messages to your contacts based on your settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage Tips
&lt;/h2&gt;

&lt;p&gt;Here are some tips to help you make the most of this script:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep your WhatsApp Web session open while the script is running.&lt;/li&gt;
&lt;li&gt;Adjust the &lt;code&gt;implicitly_wait&lt;/code&gt; to control the rate of message sending and avoid being flagged as spam.&lt;/li&gt;
&lt;li&gt;Customize the &lt;code&gt;contact.xlsx&lt;/code&gt; to include personalized information from your contact list.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  License and Disclaimer
&lt;/h2&gt;

&lt;p&gt;This project is open-source and licensed under the MIT License. Please use this script responsibly and ensure compliance with WhatsApp's terms of service and any applicable laws and regulations. The authors of this script are not responsible for any misuse or violation of WhatsApp's policies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Efficient communication with clients and customers is essential for businesses of all sizes. Our WhatsApp bulk messaging script simplifies the process, allowing you to reach out to your contacts in a more organized and time-effective manner. By automating bulk messaging, you can focus on building stronger relationships with your clients and customers while saving valuable time and effort. Give it a try, and streamline your CRM communication today!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
