Wednesday, March 27, 2019

AWS:- How to Create and Login to AWS OS Instance


How to Create and Login to Aws OS Instance

1. Click on Services   =>> Click on EC2 under compute
2. Click on Launch Instance
3. Click on Free Tier Only on the left hand side which only displays the OS instances
4. Select the Amazon Machine Image (AMI) you like.
5. Under Instance Type, select the t2.micro free tier eligible one. [ Redhat ]
6. Click configure Instance details
7. Under Configure Instance Details, leave as it is a click on Add storage from bottom right corner.
8. Do not add any storage, click on Next: Add Tags
9. On Add Tags page, look at the middle of the page, you will see Click to add a Name tag
10. On this key value pair section just type value as lxvm1 and click next
11. ssh is already enabled click on Review and Launch.
 12. Click on Launch, you will be prompting to select/create key pair.
13. Select create anew key pair and type the name of the key and save the key to your desktop
14. Click on launch and wait for another 4 minutes, server will be ready.


Login to AWS OS instancce.

1. Once you create an instance, click on the check box before the instance name.
2. Click on connect
3. You will get a link to connect,
ssh -i "mynewvm.pem" ec2-user@ec2-35-167-153-89.us-west-2.compute.amazonaws.com

4. Go to google and searcg for MobaXterm_Portable. Download on your desktop and open the application.
5. Copy the downloaded key to your drive. I kept it under e:\downloads\awskeys

 ➤ cd e:/
 ➤ cd dowloads
 ➤ cd awskeys/
 ➤ ls
mynewvm.pem

6. Now, login to your Amazon OS instance. You wil be login without prompting for password.
 ➤ ssh -i "mynewvm.pem" ec2-user@ec2-35-167-153-89.us-west-2.compute.amazonaws.com

ec2-user@ip-172-31-25-98:~> sudo su -
ip-172-31-25-98:~ #


You will have 750 hrs free for new account, Once instance is created and lab part is completed, terminate it. Do not use delete, there will be charge on storage even instance is down.

To Terminate,
=> Go to Services  -==> EC2 Instances  ==> Select the instance you want to terminate.
==>  Go to Action  ==> Instance state  =>> Terminate.

It will warn you about termination, click on Yes Terminate.

You are good to go.

Friday, March 22, 2019

AWS: - Create S3 Bucket and upload file from PC


Create S3 Bucket and upload file from PC
1.    Login to AWS management console and click on Amazon S3.

2.    Click on Create Bucket
3.    Here, the name should be unique FNS-compliant name which must be unique across all existing bucket names in Amazon S3.

Fields are
Bucket Name: YYYYMMDDBucketname
Region: US East
Click next

4.    Under configure option tag your Bucket.


Here, you can click on create or Click next. I click next for more options.

5.    Click next and review the setting. If it looks good, click on create bucket

6.    Now, click on Bucket Name (do not click on check box)

7.    Click on upload to upload file to the bucket

8.    Click on Add files

9.    Select the file you want to upload.


10.                       File is successfully uploaded.
11.                       Now, Click on the file you just uploaded.
12.                       Click on Properties and review different options like versioning, server access logging, static website hosting, encryption and more. And click on Permission tab and go all the way bottom and click on Everyone. Everyone pops up and click on Read Object and click on save.

13.                       I got permission deny error.
14.                       Now go back to yor bucket and click on check box and click on Edit public access and remove all check boxes. Once its done go back to the promperies of the image and grant access to everyone.

15.                       Now, error is gone.  Go back to the bucket, and click on Image. On overview page you will see object URL, just copy it and paste on web browser, you should be able to see it.

16.                       If you want to delete the image, click on check box of the image, go to action and click on delete.


Cheers !!! You successfully created a S3 bucket and uploaded a file.



AWS:- Login to AWS


Login to AWS
1.    Go to aws.amazon.com
2.    Enter your account information
3.    You are logged in to AWS Management Console
4.    Click on Services on top right corner.

5.    Once you click on services, you will see many available services.

6.    By default, you can see the services based on category. If you like to change to list alphabetically, you can click on A-Z on right side corner.

And you will see like this,
7.    Click on different services to know and understand more.
There are lots of whitepapers, free trainings available @aws. Simply enroll and enjoy !!!


AWS:- Creating account on AWS


Creating account on AWS

1.    Go to https://aws.amazon.com/

2.    Click on Sign in to the console

3.    Click on Create a new AWS account

4.    Fill Out the basic info on the page presented. The basic account includes 12 months of free tier access (750 hrs).

5.    Click on continue. Select personal for your personal use.

6.    Fill out the information and click on Create account and continue. Payment information page displays. Fill credit/David card info and click on Secure Submit.

7.    Your account is created successfully.

Saturday, March 2, 2019

RHEL7 - Create a simple web page

The script will create simple web page.
[root@server2 ~]# cat createweb.sh
#!/bin/bash
#
#
# Specify the parameters
domain_name=$1
domain_root=/var/www/html/$domain_name
myip=192.168.10.122
port=80

if [ $# -eq 0 ]
then
        echo "Please enter your domain name followed by script as command line parameter"
        exit
fi

echo "<virtualhost $myip:$port>" > /etc/httpd/conf.d/$domain_name.conf
echo "servername $domain_name" >> /etc/httpd/conf.d/$domain_name.conf
echo "documentroot /var/www/html/$domain_name" >> /etc/httpd/conf.d/$domain_name.conf
echo "directoryindex index.html" >> /etc/httpd/conf.d/$domain_name.conf
echo "</virtualhost>" >> /etc/httpd/conf.d/$domain_name.conf
echo

#mkdir /var/www/html/$domain_name
if [ ! -d "$domain_root" ]
then
        mkdir ${domain_root}
fi

#echo "Welcome to $domain_name" >/var/www/html/$domain_name/index.html
echo "Welcome to $domain_name" > ${domain_root}/index.html

echo "Now, checking httpd systax"
httpd -t
if [ $? -eq 0 ]
then
        systemctl restart httpd
        echo "Your website $domain_name  is configured successfully"
        echo $myip $domain_name >> /etc/hosts
else
        echo "Please check the config file for error"
fi

# firewall-cmd --list-all | grep http
# if [ $? -ne 0 ]
# then
#
#       firewall-cmd --permanent --add-service=http
#       firewall-cmd --reload
#fi

# nothing needed for else statement

[root@server2 ~]#