Showing posts with label Advance AWS. Show all posts
Showing posts with label Advance AWS. Show all posts

Tuesday, August 4, 2026

Create CloudTrail

Ensure compliance with internal policies and regulatory standards, by providing a history of activity in aws account. Perform security analysis and detect user behaviour patterns.


1. click on create trail. Give name to your trail then apply for all the regions. then choose all the event read only or write only options.




2. In Data events click on S3, In storage location choose your S3 bucket or create new S3 bucket that will not make any differnce cloud trail is operating or encapsulating the logs.



3. If you have choose to create new S3 bucket then give your bucket name othwerwise you can use existing bucket. In advanced we can prefix the log file name.



4. You can Encrypt logs depanding upon your company pocilicy, then click on create. After some time you will see your trail as been setup and s3 bucket is also ready.




5. Go back to your S3 bucket you will see your cloud trail logs are stored. If you click and go inside you get logs of your pervious activities.

CloudWatch

 Firstly we create a dashboard-


Create a Dashboard-




Select number widget type-



Select Ec2-



Put running instance id-


Select CPU Utilization, Networkin & Netowrk out










AWS Creating Alarm

 Step1- Firstly create a cloudwatch dashboard


Create a Dashboard-




Select number widget type-



Select Ec2-


Copy runnig instance ID-


Browse with instance id-


Select CPU utilization & NetworkIn and NetowrkOut


Create an Alarm-
 
Condition-





Configure actions-

insert email id-


EC2 action- 

Stop instance



Add basic details-


Alarm Created-








Congretulations Alarm has been sucessefuly created.


Sunday, August 2, 2026

In AWS Connect EC2 instance through Filezilla

Who to connect your EC2 instance through Filezilla

Step 1. Open filezilla, click file tab, choose site manager.



Step 2. In host put public DNS ip address of EC2 instance.



Step 3. Select the option SFTP in Protocol.


Step 4. Click on logon , then click user key file put your user name in my case its ubantu user. Then browse file which ppk converted file.


Step 5. Give the permission to by ubuntu user by commands

sudo chown -R ubuntu:www-data /var/www/html
sudo chmod -R 755 /var/www/html



Step 6. At the end click connect button. If configure all setting correcting you should connect to your instance.





Step 7. Check uploded files by command ls /var/www/html/



In AWS EC2 Install and Setup apache, php and mysql in ubuntu OS of AWS EC2

Step 1. First you needs to start your Ubuntu EC2 instance then write command sudo apt-get update 

then type sudo apt-get install apache2.



Step 2. Ones you install apache2 restart it through sudo systemctl restart apache2.


Step 3. For databases, we needs to install mysql server in your EC2 instance by typing sudo apt-get install mysql-server then mysql_secure_installation.



Step 4. During the installsation it will ask your password, you can provide any password or leave it blank.


Step 5. If you wants to run PHP program on your instance then write command sudo apt-get install php. When its complete then type sudo nano /etc/apache2/mods-enabled/dir.conf. Here inside dir-config you needs to move index.php to the first position.


Step 6. Ones we install php and mysql then restart the server with sudo systemctl restart apache2.


Step 7. In order to check the status of apache2 you needs to write sudo systemctl status apache2

AWS IAM Identity and Access Management

Identity and Access Management (IAM) in AWS

IAM is another web service from Amazon that allows you to control access to aws resources.


Through it you can easily control who will access what resource without sharing your password or access key. You can grant different permissions to different people.


All you need to do is just create different user or group of users and grant them permission. To make you understand more clearly about how you can create user, I am giving a step by step process below:


Step 1: After login, on left side top corner click on Services and choose IAM in Security, Identify & Compliance category. or Serach IAM in the search box.




Step 2: This will lead you to IAM dashboard. First you will create user because you will give permission to some user or a group of users. Now here click on IAM Users in left side menu.




Step 3: At Users page, click on Create user button to add user. You can see a small form divided in two fields; first is Set User details in which you need to give user name and you can add multiple users here to give same permission. Here I am giving username “firstuser”.



Second is
Add Permissions in which you need to select 

1. Add User to group

2. Copy Permissions    

3. Attach Policies Directly

access type for those users you just added above. Here I select “Programmatic Access”.


Next: Permission


Step 4: Now you need to Set Permission for firstuser (Username). Here we have three options: Add user to group, Copying permissions from existing user, and Attach existing policies directly. You are creating user first time so you will add users to group so click on Create group button.


A small form displays to create group, Give group name, here I am giving “Developers" and select the policy type you want to attach to the group. Select “AmazonEC2FullAccess”, you can select other policies too based on your requirement.





So user has been added to the “Developers” group.


Next: Review


Step 5: Please Review all the details here and if needed, edit them.




Create user


Step 6: You successfully created user now you can see Access Key and Secret Access Key. Either copy & paste them at appropriate place where from you can access them easily because your user will login with these credentials or you can download them directly by click on Download.csv button.









Step 7: login with IAM user
Account ID:- 029552764553




Now you are looking a fresh dashboard, you can use it with limited access.















AWS EC2 Instance

EC2 in AWS

  • EC2 (Elastic Compute Cloud) is an AWS service that provides virtual computers/servers in the cloud.
  • You can use EC2 to run websites, applications, APIs, databases, and other software.
  • You can start, stop, restart, or terminate EC2 servers whenever you need them.
  • You generally pay for the AWS resources you use, with pricing depending on the instance and other resources.

What is an EC2 Instance?

  • An EC2 Instance is a virtual server/computer created using Amazon EC2.
  • It has CPU, RAM, storage, networking, and an operating system.
  • You choose an AMI to decide the operating system, such as Ubuntu or Amazon Linux.
  • You choose an Instance Type to decide how much CPU and RAM the server gets.
  • A Security Group acts like a firewall and controls incoming/outgoing network traffic.
  • You can connect to a Linux instance using SSH.
  • Each instance can have a private IP, and it can have a public IP when internet access is required.

Simple Example

EC2 = AWS service that provides virtual servers
Instance = One virtual server created inside EC2

How to Create an EC2 Instance in AWS

Think of an EC2 instance as a computer/server that you rent from AWS.

For example:

Your laptop has Windows and you install software on it.
Similarly, an EC2 instance is a computer in the AWS cloud where you can install Linux, Apache, websites, databases, Docker, etc.

Step 1 — Login to AWS

Go to the Amazon Web Services Management Console and log in to your AWS account.

AWS Management Console



Choose Root user or IAM user-

Root User?

The Root User is the main AWS account owner with full access to all AWS resources and account settings. It should be used only for tasks that specifically require root-level access.

IAM User?

An IAM User is a separate AWS identity created for a person or application with specific permissions. It is safer and recommended for everyday AWS activities.


After logging in, you will see the AWS Management Console. 


Step 2 — Open EC2

In the AWS Console:

  1. Click the Search bar at the top.
  2. Type EC2.
  3. Select EC2 from the results.



You will now be inside the EC2 Dashboard.

Step 3 — Choose the AWS Region

At the top-right corner, you will see the current Region.

For example:

  • Mumbai — ap-south-1
  • Singapore — ap-southeast-1
  • US East — us-east-1


For a website serving users in India, Mumbai (ap-south-1) is usually a sensible choice.

Important: EC2 instances are created inside a specific Region. Make sure you remember which Region you used.

Step 4 — Click "Launch Instance"

On the EC2 dashboard:

Instances → Launch instances

You will now see the Launch an instance page.

This is where you tell AWS what kind of virtual computer you want. 


Step 5 — Give Your Instance a Name

Under Name and tags, enter a name.


The name is mainly for your own identification.

Step 6 — Choose an Operating System

Now you need to choose an AMI.

AMI means Amazon Machine Image.

Think of an AMI as:

A ready-made operating system/template for your new server.

You may see options such as:

  • Amazon Linux
  • Ubuntu
  • Windows Server
  • Red Hat
  • Debian

For learning Linux/AWS

I recommend:

Ubuntu Server LTS


Step 7 — Choose Instance Type

Next you'll see Instance type.

This determines the CPU and RAM available to your virtual server.

For example:

t3.micro

or other current eligible instance types.

For learning and small practice workloads, choose a Free Tier-eligible/low-cost option shown by AWS for your account, rather than assuming a particular instance type is free.



Think of it like buying a computer:


For AWS practice, start small.

Step 8 — Create/Login Using a Key Pair

This is a very important step.

AWS needs a secure way for you to log in to your Linux EC2 server.



Under Key pair, choose:

Create new key pair

Give it a name such as: my-aws-key

Choose:

RSA

For Linux/SSH, download the .pem file.

For example: my-aws-key.pem


 

Important warning-

Do not lose this file.

Do not upload it publicly to:

  • GitHub
  • GitLab
  • WhatsApp
  • Public websites

Anyone who obtains your private key may potentially be able to authenticate to your server, depending on your security configuration. 

Step 9 — Configure Network Settings

AWS will now show Network settings.

You will normally see:

  • VPC
  • Subnet
  • Auto-assign Public IP
  • Security Group

For a beginner, AWS's default VPC settings can be used for basic practice.

Network Settings — Key Points

The Network Settings section controls how your EC2 instance connects to the network and how users can access it.

  • VPC: The virtual network where your EC2 instance will be placed.
  • Subnet: A smaller network inside the VPC where the instance is launched.
  • Auto-assign Public IP: Gives the instance a public IP so it can communicate with the internet.
  • Security Group: Acts as a firewall and controls which traffic can reach your EC2 instance.
  • SSH (Port 22): Allows you to remotely connect to a Linux EC2 instance.
  • HTTP (Port 80): Allows normal web traffic to your website.
  • HTTPS (Port 443): Allows secure web traffic to your website.
  • Source — Anywhere (0.0.0.0/0): Allows access from any IPv4 address. Use carefully, especially for SSH.
  • My IP: Restricts access to your current public IP, which is generally safer for SSH during practice.

Easy way to remember

VPC = Network → Subnet = Area → Public IP = Internet → Security Group = Firewall → SSH/HTTP/HTTPS = Access Rules.





Public IP-

If you want to connect to your server from your computer over the internet, make sure the instance has a suitable public IPv4 address.

Step 10 — Configure the Security Group

This is one of the most important concepts in EC2.

A Security Group is like a firewall for your EC2 server.





For example:

Internet
    ↓
Security Group
    ↓
EC2 Server

You may see options such as:

SSH-

Type: SSH
Port: 22

SSH is used to remotely log in to a Linux server.

HTTP-

Type: HTTP
Port: 80

HTTP is used when you want people to access your website.

HTTPS-

Type: HTTPS
Port: 443

HTTPS is used for secure websites.



For basic Linux practice

You can initially allow:

SSH - Port 22

For a web server, you would typically also allow:

HTTP  - Port 80
HTTPS - Port 443

Security recommendation

For SSH, avoid opening port 22 to Anywhere (0.0.0.0/0) unless you have a specific reason.

For learning, you can restrict SSH to My IP when available.

Step 11 — Configure Storage

You will see something like:

Root volume
8 GiB
gp3


This is the disk space of your EC2 server.

For basic practice, the default storage is usually enough.

Think of it like:

Your laptop has a hard disk.
EC2 also needs disk storage.

Step 12 — Review All Settings

Before launching, check:

 


Step 13 — Launch the Instance 

Everything looks good?

Click:

Launch instance

AWS will now create your virtual server.

You should see a message similar to:

Successfully initiated launch of instance


 

Step 14 — Check Your Instance

Go to:

EC2 → Instances → Instances

You should see your instance.

Initially, the status may be: Pending

After a short time it should become: Running

You can also see:

  • Instance ID - i-0daef3fed8dcd588b
  • Instance type- t3.micro
  • Public IPv4 address- 13.233.150.88
  • Private IPv4 address- 172.31.3.72
  • Availability Zone- ap-south-1b
  • Status checks- Initializing   >>   3/3 passed

Step 15 — Get the Public IP Address

Select your EC2 instance.

Look for:

Public IPv4 address

For example:

13.xxx.xxx.xxx

This is the internet-facing address you can use to

connect to your server, provided the networking/security

configuration allows it

Step 16 — Connect to Your EC2 Server

For Ubuntu/Linux, you can connect using SSH.

On Windows, you can use

  • Windows Terminal
  • PowerShell
  • WSL Ubuntu
  • SSH client
Examples-

ssh -i my-aws-key.pem ubuntu@YOUR_PUBLIC_IP

ssh -i my-aws-key.pem ubuntu@13.xxx.xxx.xxx

The exact username depends on the AMI you selected. For Ubuntu, it is commonly:Ubuntu

Step 17 — You Are Inside Your AWS Server

If everything works, you will see something similar to:

ubuntu@ip-172-31-xx-xx:~$

Congratulations! 🎉

You are now controlling a Linux computer running inside AWS.

Try:

pwd

Then:

ls

Then:

whoami

And:

sudo apt update




Step 18 — Stop instance, Reboot instance,

Terminate instance    







Linux vs Windows System Administration Roadmap | Common Skills Guide

 Common Roadmap for Linux & Windows System Administrators Linux System Administration and Windows SystemAdministration have many commo...