Showing posts with label Guide. Show all posts
Showing posts with label Guide. Show all posts
Published February 25, 2023 by

How to launch Linux OS from EC2-instance as GUI ?

 

In this article, I will set up a GUI environment from AWS EC2 services AMI Linux Images which is Deafut as CLI.

Let's go through each step to find the way to launch in GUI mode.

  1. AWS Account
  2. MATE desktop environment
  3. Any VNC Services (TigerVNC)
  4. Tiger VNC Client Software On your Host Windows OS
  5. For a Better hands-on, Use Putty as a Remote login via SSH to access the Linux

Here, I have Guided you with the Steps to be followed,

Launch an instance with the Configuration of AWS

If you have already launched an Instance and want to proceed with manual GUI installation, then do the following:

  1. Install the MATE desktop environment, a lightweight GUI based on GNOME 2 available as an extra for Amazon Linux 2
  2. Install the MATE desktop environment manually.
  3. Install a VNC service like TigerVNC. To download Check Out the tigervnc.org website.
  4. Connect to the GUI using the VNC.

Here we use the Pre-Setup configured MATE desktop environment.

  1. Open putty, Enter your instance Public IP in the Hostname and connection type SSH type.
  2. Now go to Connection > SSH > Auth > Credentials.
    Upload your ppk file, which we have downloaded from Amazon in Step-3.
  3. Select Open.
#grep PRETTY_NAME /etc/os-release
sudo yum updates

This is to Update the Sofware programs as a whole.

The Packages are updated.

sudo amazon-linux-extras install mate-desktop1.x
sudo bash -c ‘echo PREFERRED=/usr/bin/mate-session > /etc/sysconfig/desktop’
sudo yum install tigervnc-server

Configure a VNC-specific password, then limit VNC network access to the local host, so that VNC can only be accessed via a secure SSH tunnel.

Then, create a mandatory configuration file that includes the localhost option.

Create the tigerVNC configuration directory

vncpasswd
sudo mkdir /etc/tigervnc
sudo bash -c 'echo localhost > /etc/tigervnc/vncserver-config-mandatory'
sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service

Replace all occurrences of USER in the new unit with ec2-user using the sed command. Reload the systemd manager configuration after that.

Start the service.

sudo sed -i 's/<USER>/ec2-user/' /etc/systemd/system/vncserver@.service
sudo systemctl daemon-reload
sudo systemctl enable vncserver@:1
  • Enter your Instance public IP in the Hostname and “connection type” SSH type.
  • Now go to Connection > SSH > Tunnel
  • In Source port, Add 5091 and Destination- “ localhost:5091” then click on add.

Click on Open.
Now Start the service with the following command —

sudo systemctl start vncserver@:1 
sudo systemctl status vncserver@:1
sudo systemctl enable vncserver@:1

Now, When Going to the tigerVNC client which,asks for the VNC server hostname, enter “localhost:1” and then click on connect button.

Enter the VNC password that you set up previously.

Here is your GUI running on the Amazon Linux2 image.

Thank you !!

Read More
Published April 17, 2022 by

Mail Server Using Serverless Framework AWS [Lambda + SES +IAM]

 Mail Server Using Serverless Framework On AWS [Lambda + SES +IAM]





In this article, the implementation of the MAIL Server by using the serverless Framework without doing the Changes in the AWS Account is Demonstrated Step by Step.

MAIL Server is Sending and receiving the Mail with the AWS →SES Services. as without the use of Gmail service, we can send the Mail from source to destination.

How to Deploy the Integrated Services on AWS using Serverless Framework

Pre-Requisites

  1. AWS Account

2. Nodejs

3. Programming Language (python)

4. Serverless framework

5. To Demonstrate, need 2 unique Gmail accounts.

To Begin,

Step 1:

Serverless Setup with AWS

  1. For setting up a connection with AWS, first, we need to install Serverless using CLI via NPM

#npm -g install serverless

2. Authenticating Serverless framework to Use Our AWS Account

#serverless config credentials[space] — — provider aws [space] — — key [Key in IAM] — — secret[Key in IAM] — — overwrite

3. Create a new serverless project & Select Language

#serverless

# SELECT LANGUAGE

4. Move into the newly created directory

#cd your-service-name

6. To Deploy the Serverless framework

#serverless deploy

Step 2:

Create an account in AWS using the IAM service with Full Administration Access to set up the credential to login via serverless.

Follow the Below Steps…

For creating an account using IAM in AWS

  • Go to the IAM service
  • Select users
  • Create new user
  • Give the user a name and Select the Access key
  • Give Access Power i.e, Attach Existing Policy: Administration Acess
  • Review and click on create user






Step 3:

Amazon Simple Email Service

We use the SES service for sending and receiving emails.
ADD Gmail account from which you want to send and receive the mails

steps for adding Gmail to the SES service

  • Go to SES service in AWS
  • Click on Create Identity
  • Select Email Address and Type your Email Address
  • And click on Create Identity
  • Verify your email to use it.

You need to add a minimum of two email addresses for sending and receiving mails









→ Authentication Mail Has been sent to Mail Click and Do verify.

AWS SES

Step 4:

Starting Serverless

#Serverless

Follow the below cmd to create with Serverless(SLS)

After Successfully Creating the Serverless project, Go inside the folder and edit both the handler.js and serverless.yml files.

As the actual Implementation of the Code is present in the Github

#notepad handler.js
#notepad serverless.yml

Copy Paste the code provided from the GitHub Repository.

https://github.com/Prashanth102000/SES_Mail_Server

After Editing the codes with the same folder files

Finally, you have to deploy it by the following command

#serverless deploy


CLI

Step 5 :

To Sending, mail will be using Postman Software

https://www.postman.com/downloads/

As it is a POST method, we can create a UI to post or we can POST using the Postman tool,

Open up the Postman tool → Choose the POST method → Paste the Link generated by the Serverless in the given address bar → Select RAW → Apply the Below Code with Your Created 2 unique Gmail → Click on Send



Email Sent successfully

THANK YOU




Read More