AWS DAY 3

SWAYAM JILLA
6 min readDec 5, 2023

--

WHAT IS EC2 INSTANCE:

EC2 stands for Elastic cloud compute , elastic represents the nature of virtual computer in which its size can be reduced or increased as per requirements , compute represents the combination of CPU,DISK AND DISK . EC2 instances are virtual computers you rent in the cloud. You can customize their size, start or stop them as needed, and pay only for what you use. It’s like having a flexible and scalable computer that you don’t own physically but can easily control and adapt to your needs.

WHY AWS???

  1. Scalability: AWS provides scalable and flexible resources, allowing you to easily adjust computing power, storage, and other services to match your needs as they change.
  2. Cost-Efficiency: With a pay-as-you-go model, you only pay for the computing power and resources you actually use. This can be more cost-effective than investing in and maintaining physical infrastructure.
  3. Global Presence: AWS has data centers in multiple regions around the world, allowing you to deploy applications and services close to your users for better performance and lower latency.
  4. Wide Range of Services: AWS offers a vast array of services, including computing power, storage, databases, machine learning, analytics, and more. This allows you to build and deploy a variety of applications without having to manage the underlying infrastructure.
  5. Reliability and Security: AWS has a robust and secure infrastructure with data centers designed for high availability and redundancy. They also provide tools and features to help you secure your applications and data.
  6. Innovation: AWS continually introduces new services and features, staying at the forefront of technology trends. This allows businesses to leverage the latest innovations without the burden of managing their own infrastructure.
  7. Elasticity: AWS services can automatically scale up or down based on demand. This elasticity ensures that your applications can handle varying workloads without manual intervention.
  8. Community and Support: AWS has a large and active community of users and provides comprehensive documentation and support. This community can be a valuable resource for sharing knowledge and solving problems.

In summary, AWS offers a reliable, scalable, and cost-effective cloud computing platform with a broad range of services, making it a popular choice for individuals and organizations looking to build and deploy applications in the cloud.

DIFFERENT TYPES OF EC2 INSTANCES:

Amazon EC2 instances come in various types, each optimized for different use cases and workloads. As of my last knowledge update in January 2022, here are some of the main types of EC2 instances:

  1. General Purpose Instances (T3, T4g, T3a): Balanced CPU, memory, and networking resources suitable for a variety of applications.
  2. Compute Optimized Instances (C5, C6g): Ideal for compute-bound applications that benefit from high-performance processors.
  3. Memory Optimized Instances (R6g, R5, X1e): Designed for memory-intensive applications such as databases, in-memory analytics, and real-time big data processing.
  4. Storage Optimized Instances (I3, I4, D2): Optimized for high, sequential read and write access to very large data sets on local storage.
  5. Accelerated Computing Instances (P4, P3, F1, Inf1): Equipped with specialized hardware, such as GPUs or FPGAs, to accelerate specific types of computations, including machine learning and high-performance computing.

It’s essential to consider your specific application requirements, performance needs, and budget constraints when choosing an EC2 instance type. Additionally, AWS regularly introduces new instance types and updates existing ones, so it’s a good idea to check the AWS documentation for the most up-to-date information.

# BUT IN THIS ENTIRE SERIES WE ARE GOING TO USE GENERAL PURPOSE INSTANCES

WHAT ARE REGIONS IN AWS???

A region refers to a geographical area where a cloud provider, like Amazon Web Services (AWS), has multiple data centers. Each data center within a region is known as an Availability Zone (AZ). Regions are entirely independent of each other, and they are designed to provide fault tolerance and high availability. AWS has regions all over the world, and examples include US East (North Virginia), EU West (Ireland), Asia Pacific (Tokyo), etc.

Latency: Latency is the time delay between the moment something is initiated and the moment it begins to produce results. In the context of cloud computing and regions, latency typically refers to the time it takes for data to travel between a user’s device and the data center hosting the application or service.

  • Low Latency: When the distance between the user and the data center is short, the latency is low. This is desirable for applications that require quick response times, such as online gaming or real-time communication.
  • High Latency: When the distance is greater, or there are network bottlenecks, latency increases. High latency can result in slower response times and less responsive user experiences.

HOW TO DEPLOY JENKINS ON AWS:

STEP 1 : CREATING AN EC2 INSTANCES

#KEEP ALL THE SETTINGS SAME AS GIVEN IN BELOW IMAGES

KEY PAIR ALLOW US TO LOGIN TO AWS ACCOUNT FROM OUR LOCAL SYSTEM

STEP 2 : CLICK ON CREATE NEW KEY PAIR

STEP 3 : CLICK ON LAUNCH INSTANCE

STEP 4 : NOW TO LOGIN IN FROM YOUR LOCAL MACHINE, COPY THE PUBLIC IPV4 ADDRESS AND OPEN YOUR TERMINAL

BROWSE TO THE FOLDER WHERE YOUR PEM FILE IS DOWNLOADED

ssh -i (name of your pem file with extension) ubuntu@(public ip address)

STEP 5: RUN COMMAND SUDO APT UPDATE

STEP 6 : INSTALL JAVA

apt install openjdk-11-jdk

#IF THE ABOVE COMMAND WONT RUN ADD SUDO AT THE BEGINNING OF THE COMMAND

TO VERIFY WHETHER JAVA IS INSTALLED OR NOT ,RUN COMMAND

java --version

STEP 7 : INSTALL JENKINS

Linux (jenkins.io) — LINK TO DOWNLOAD JENKINS ON LINUX

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

COPY THIS CODE AND PASTE IT IN TERMINAL TO DOWNLOAD JENKINS

STEP 8: TO VERIFY JENKINS IS INSTALLED OR NOT

systemctl status jenkins

#JENKINS RUN ON PORT 8080 SO TO ACCESS JENKINS YOU NEED TO ALLOW INBOUND RULES FROM YOUR EC2 INSTANCE

STEP 9 : GO TO SECURITY — — -> SECURITY GROUPS — — ->EDIT INBOUND RULES

STEP 10 : TO ACCESS JENKINS

http://(your EC2 instance public url ):8080

TO ACCESS THE PASSWORD

sudo cat  /var/lib/jenkins/secrets/initialAdminPassword

--

--