Tuesday, April 22, 2025

New VPC Creation

 Create VPC Steps

Step1: Given CIDR 10.0.0.0/24 that means 32-24(8) =power(2,8)=256 Ip's

Step2:
Click Create VPN

After created VPC default one security group and one Route tables created automatically



Step3:Now we need divide the VPC IP's to subnets Public and private for dividing subnets,we have give CIDR range for them separately 
Step4:Create Subnets
  Goto subnet>Click create subnet

  • Select you VCP which created early yar ,every region has 3 available zones (i,e datacenter) you can choose any if not it will take automatically,
  • For subnet we need give ip address range(CIDR) 10.0.0.0 /24 (16-32 rage) (32-24)=8   2 power of 8 =256 IP’s
  • Need to CIDR range for the subnet ip’s which is you go to divide the subnet public and private
  • Netmask: 25 equal shared public and private 

 Created one Subnet as public name

as see here CIDR range block public subnet 128 Ip's automatically splitted



Create one more subnet Private, give same CDIR range for private subnet you see below screen shot getting error  subnet previous we have given public subnet 10.0.0.0/25,  that means
We have these ip for public subnet 10.0.0.0.. 10.0.0.128 reserved ,now already occupied for them,
So we need give different range 10.0.0.128..10.0.0.256

After change CIDR range 10.0.00.128/24 automatically created  Private subnet,Please find the screen shot below

 We have created 256 IP Private subnet(128),Public subnet(128) 


As we see above Available Ips address assigned 123 only128-5(5 was reduced, by Aws for internal requirement in each subnet ,those are all first 4 and last one ip’s) remaining showing 123 available







EC2 Service Aws

 Class 9th S3 Ec2 service   Apr22nd

EC2 Elastic Compute cloud: Simple called it has 2 C, EC2 

What is Ec2?

  • AWS EC2 is a core service within Amazon Web service (AWS) that provides resizable  compute capacity in the cloud.
  • It run from the Ec2 host servers(also called physical servers) residing in the AWS datacenter 
  • These hosts servers are large hardware units that are divide into smaller chunks ,each chunk functions as a virtual server(instance)
  • We can use these host server as shared server or dedicated servers 
  • Users can launch these servers with required OS setup in Pay-as-You-Go model 

Key feature of Ec2
 1.Scalabilty (We can change the Ec2 server whenever required)
 2.Flexibility(We can able upgrade downgrade whenever required)
 3.Customizable (Load balance we can install whatever required) 
 4.Pay-as-you-go pricing (How much you can use pay that much only)
 5.Global reach (We access any where Globally )
 6.Integration with other Aws services (Given permission we will communicate other aws services)

Ec2 Architecture
 Ec2 is region specific ,each region has there availability zone (data center)
 Instance has (Ip address,security group,key value pair)
 Ec2 Free limit per month 750 hrs(12 free)
On-Demand instances :Whenevery you required it will give you new ip
Dedicate Instances: reserved instance for dedicated ip

Amazon Linux:AWS build the own Linux using Linux kernel,All Linux system in AWS Command Window access no GUI Access
Amazon Machine Image(AMI):
  • Used to create/launch the Ec2 instances.
  • AMI are available with various o/s for different requirements 
  • AMI's regional,each AMI Contains a unique ID Which is different form region to region 
  • Users can design own AMI and sell in the AWS market place.
  • AMIs are immutable :once you create an AMI,it remains unchanged, Any changes made to the instance after the AMI Creation won't affect the image.
Amazon Machine Image: AWS Provided, Community, Market place 

VM Creation Steps:
Step1: Choose Amazon Linux ,Generate Keypair you see below RSA, ED25519 more Strong Secure compared to RSA ,RSA will support window/Linux both ED22519 
will support Linux only,Give key pair name "VM-LINUX_FIRST"


.pem file it has private key ,while creating instance it has public key ,both the combination match and it will you authenication password and generate and give you
.ppk is putty based to connect ,third party service you can use
Step2:In the network section need vpc which we created,Auto -assigned public always be enable to connect public ,else Elastic Ip is chargeable


 Linux storage by  default 8 gb ,for Windows 30 gb 
Advance option User data, Placement group not covered 
just click launch instance 

Step3:Connect AWS ,you can use SSH key which you have download 
VM-LINUX_FIRST.Pem key place directory and connect in local cmd prompt 

Ec2-user is default user limited permission 
root - has supermium permission admin for ec2 instance 

                                                   
Simple Website Creation 
Two types of website 1.Static Website (Unchangable), 2.Dynamic Website (dynamical change and store info in Database  level Change in periodically automictically) Now we are static website hosting using Linux instance.

Step1: After launch the instance amazon Linux  for host website need install some software in Linux ,Apache and https package using sudo user

[ec2-user@ip-10-0-0-31 ~]$  sudo yum install httpd

Installed:
  apr-1.7.5-1.amzn2023.0.4.x86_64                                apr-util-1.6.3-1.amzn2023.0.1.x86_64
  apr-util-openssl-1.6.3-1.amzn2023.0.1.x86_64                   generic-logos-httpd-18.0.0-12.amzn2023.0.3.noarch
  httpd-2.4.62-1.amzn2023.x86_64                                 httpd-core-2.4.62-1.amzn2023.x86_64
  httpd-filesystem-2.4.62-1.amzn2023.noarch                      httpd-tools-2.4.62-1.amzn2023.x86_64
  libbrotli-1.0.9-4.amzn2023.0.2.x86_64                          mailcap-2.1.49-3.amzn2023.0.3.noarch
  mod_http2-2.0.27-1.amzn2023.0.3.x86_64                         mod_lua-2.4.62-1.amzn2023.x86_64

Complete!

Step2:After install ,We can the httpd status using command  sudo systemctl status httpd

Step3: using command for start sudo systemctl start httpd checking the status again active and running 
Step4: After installation Apache path default path is  /var/www/html 
If you want launch simple website,the default page is index.html 
After installation httpd, just check public ip is working or not ,it connect direct direct default page (index.html)


See below Default page open successfully
Step5:
[ec2-user@ip-10-0-0-31 html]$ sudo vi index.html
[ec2-user@ip-10-0-0-31 html]$ cat index.html
<h1> Welcome to Blog </h1>
Step6:
Step7: Once you stop instance ,automatically public ip will change and apache httpd will inactive 
you make manually start, Instead of manually start every time  after instance restart 
use below command enabled it will automatically start .

[ec2-user@ip-10-0-0-31 html]$ sudo systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.


                                Instance Image Copy and Launch instance with image
    if you want copy the same Instance image Below Steps
Step1: Select insance >Image and templated and create image
Step2: Just give image name VM-Image Click Create Image ,it will take some time to complete


Step3:Amazon machine image take some time 



Image now available(next time while you want create new instance ,take above image launch the instance the image Apache default), This is help you not required to install same softwares again

Step4:Launch new instance this time using our image 


Note: we can able change Linux version here, you can able to Change network setting and Security key pair and then Click launch the instance 
Step5:See below successfully created new second instance using image it the instance automatically 
has default software apache, just check once default page opened or not using public ip url


Step6:          

Step7: while connect using sshkey copy here see root default need change ec2-user and connect
ssh -i "VM-LINIX-SECOND.pem" root@34.240.205.112
PS C:\Users\Administrator> ssh -i "VM-LINIX-SECOND.pem" root@34.240.205.112
The authenticity of host '34.240.205.112 (34.240.205.112)' can't be established.
ED25519 key fingerprint is SHA256:c6LhEFgi2mMaPT1L3kE2/9dL+a12diUWugaxgzJHcNs.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '34.240.205.112' (ED25519) to the list of known hosts.
Please login as the user "ec2-user" rather than the user "root".

Connection to 34.240.205.112 closed.
PS C:\Users\Administrator> ssh -i "VM-LINIX-SECOND.pem" ec2-user@34.240.205.112
Last login: Sat Apr 26 09:50:32 2025 from 5.204.1.73
[ec2-user@ip-10-0-0-101 ~]$

Immutability means after image take any change one instance that change not carry to new instance that is called immutable 
                                    Instance Launch with Condition User data option
                                     install Apache using commands

Step1:Create Instance give name VM-LINIX-THIRD, additonal setting going to User data setting 



After give below lines in the User data section and click launch Instance

#!/bin/bash -xe

# STEP1 -Updates
yum -y update

# STEP2 -Begin Configuration
yum -y install httpd
systemctl enable httpd
systemctl start httpd

# STEP3 -Customer Web Page
echo "<h1> Welcome to Blog VM Third Instance</h1>" >> /var/www/html/index.html


Step2: See here automatically Apache installed and index setup done 


Step3:After completed work need Deregister AMI image which we have created
Click AMIs, due cost related clear that

Thanks





Monday, April 21, 2025

S3 Simple Storage service AWS

Class 8th S3 Storage Service Apr21st

Simple Storage Service: Simple called S3 it has three S, S3 as Service we can create Buckets for storing data ,Bucket is nothing but folders.

  • Stores data in Objects format, under buckets 
  • Flat Structured Storage (That means we can edit on the file storage level, we can download and edit  and upload)
  • It is Region specific (S3 Service is Global and buckets are regional specific)
  • Allows unlimited amount of data (Highly scalable - up to 5 TB per file)
  • For Free tier 5GB is limited after storage payable
  • Difference between normal storage Drives(Google Drive, One drive) though the s3 server we can able host the website.
S3 buckets naming rules.
  • General Purpose Bucket (We choose only region, availability zone aws will taken care)
  • Directory Bucket (it give you additionally availability zone also)
  • Table Bucket (Huge data calculating dynamically change automatically we can use this bucket)
General Purpose Bucket 
  • General purpose bucket name is unique for Globally, it should not same across Aws. 
  • AWS give you S3 highly availability (by default Aws has three availability zone it will automatically assigned by aws)
  • By default our bucket is private 
AWS S3 Security  :

  • Service level: Forex :-(Compound wall) Public by default
  • Bucket level: Forex :-(Main door)  (Private by default) For accessing bed room files the bucket should be public access.
  • Object level: Forex :-(Bedroom door ) Private by default


Creation steps:
Step1: S3 >Bucket >create Bucket
   

Step2: Created Successfully

Step 3: Uploaded three files Successfully
Step 4: As see below S3 backet Object url the file we can access through https protocol ,need to provide, access to file public prior to that we need provide access public bucket first 

Step 5:Bucket Permission need to change Uncheck Block all public access and  click save changes

Step6:Go to Bucket Permission  Object ownership change ACL disable to enable check enabling turn off, it will give permission to Objects control access, click save changes
Step 7:Make the object public  ,so that every once can able view the object in the bucket Click Make pubic

Step8: As you see below screen shot previous while accessing bucket object getting error
Step 9: After make pubic Object see below the file is accessible globally


Note: If you are delete the same file and upload ,ACL permission of the file will be revoked 
  you need to give permission make public again for public access


Bucket Policy:
We can called resource based policy ,this will give you access permission for the files in the bucket 
Step1: Bucket Permission ,go to Bucket Policy and Policy generator ,ARN(Amazon Resource name)
Every resource has this name in aws




Step2: Give below change and give bucket ARN name /*  here given permission inside all bucket file ,all actions,Click Add statements ->Generate Policy

Step3: Copy the Json script content past to Bucket policy 
Step4: Past Json script and Click Save changes


Step5:Now testing delete the all files in the bucket ,Give confirmation permanently delete Click delete objects
Step6:Upload the files again and check the access public access for the objects using https urls 
Iam able access public using url with given any additional permission, all Objects got permission using bucket policy

Step7:
            For Single File "Resource": "arn:aws:s3:::backetapr-2125/1.png"

            For All .ng Files "Resource": "arn:aws:s3:::backetapr-2125/*.png"

 
PresignedUrl: it will give you temporary access to the object 

AWS Actual 
https://backetapr-2125.s3.eu-west-1.amazonaws.com/1.png
Presigned assigned with token --Temporary give access to any one

https://backetapr-2125.s3.eu-west-1.amazonaws.com/1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIATFBMO7H4DSDUIOTJ%2F20250424%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20250424T200101Z&X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tLK1X3ApA%2B2QfwDd17QMGXUYsgsjouY3dt7A%3D%3D&X-Amz-Signature=43205cb6e6eb5096e004325dab363acdd5f4b00cf9950e6877a6eabc97f2d0e5&X-Amz-SignedHeaders=host&response-content-disposition=inline


We can give 1 minutes to 720 mints 
                     1 hr to 12 hrs



                                                               S3 Version 
Create testfile.txt  write Hello and upload to S3 bucket
If write and rewrite same text file and upload it will overwrite in S3 backet, to over come this issue  
need enable version it will help you maintained version and recovery if accidently delete the file 

Step1: by default Version of backet disable click enable and save
Step2: Write addition text and upload same file ,see old and new file versions are exists

Step3: I have deleted the file ,we can able recovery from version 

Step4: Delete marker  file delete the file permanently ,it will recovery automatically restore in the bucket.


--END-



 




Friday, April 18, 2025

AWS VM Creation Steps

AWS Virtual Machine(windows) creation steps, we can called as instances  

Prior you need have Aws Free tier account 

Step1: Login to Rootuser 

Goto >Ec2>Launch Instances

Need to give of the vm

Name and tags :Ec2VM-First

Step1:

Step2:

   Key Pair : In this session
   Add name for Private key and click  create key pair,Downloaded private key in your laptop Ec2VM-First.pem file


Step3:



Step4:After launch Security>Getpassword upload your Private key Ec2VM-First.pem,this will combined together your private key and VM ware public key decrypated click generate new password.
Step5:Get password save your local , you Should need connect RDP with those credentials, use public ip to connect RDP 

Step6: Successfully Launch RPD machine

Completed successfully