Now that, you’ve launched your Amazon EC2 instance, it’s time to connect to it and deploy your application. In this post, you’ll first connect to your Amazon EC2 instance, and then you’ll deploy Drupal, which is already available on the Linux AMI.
The steps to connect to a Linux/ UNIX instance using your browser are as follows:
1. Install and Enable Java on Your Browser
2. Connect Using the MindTerm (SSH) Client
To connect to your instance from the Amazon Elastic Compute Cloud (Amazon EC2) console, you must have Java installed and enabled in your browser. To install and enable Java, follow the steps provided by Oracle as shown below or contact your IT administrator to install and enable Java on your web browser.
1. Install Java (see https:// java.com/ en/ download/ help/ index_installing.xml).
2. Enable Java in your web browser (see https:// java.com/ en/ download/ help/ enable_browser.xml).
Connect Using the MindTerm (SSH) Client
To connect to your instance through a web browser
1. Sign in to the AWS Management Console and open the Amazon EC2 console at https:// console.aws.amazon.com/ ec2/.
2. In the Navigation pane, click Instances.
3. Right-click your instance, and then click Connect.
4. Click Connect from your browser using the MindTerm SSH client (Java Required). AWS automatically detects the public DNS address of your instance and the key pair name you launched the instance with.
5. In User name, enter the user name to log in to your instance. For this example, enter eC2user.
6. The Key Name field is automatically populated for you.
7. In Path to the private key, enter the fully qualified path to your .pem private key file.
8. Click Save key location, click Stored in browser cache to store the key location in your browser cache so that the key location is detected in subsequent browser sessions until you clear your browser’s cache.
9. Click Launch MindTerm.
10. If necessary, click Yes to trust the certificate.
11. Click Run to run the MindTerm client.
12. If you accept the license agreement, click Accept.
13. If this is your first time running MindTerm, a series of dialog boxes will ask you to confirm the setup for your home directory and other settings.
14. Confirm settings for MindTerm setup.
15. A screen similar to the below opens and you automatically get connected to your instance.
To gain in-depth knowledge and be on par with practical experience, then explore AWS SysOps Training Course. |
If you are running Windows from your local machine, Secure Shell (SSH) is not built-in, so you will need to install PuTTY and PuTTYGen. You’ll need the contents of the private key file that you created (e.g., mykeypair.pem) in Step 4: Launch an Instance.
To connect to your Amazon EC2 instance from a Windows machine
1) Download and install PuTTY and PuTTYGen. A search on “download Putty” on Google returns a list of download sites. Be certain that you install both PuTTY and PuTTYGen, because you will need both of them.
2) Convert the key pair using PuTTYGen. For information on key pairs, see Step 4: Launch an Instance.
[Related Page: Creating An Elastic Load Balancer In AWS]
Note: The user name for the AMI is ec2-user.
Explore AWS Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download Now! |
Note: The SSH fingerprint will eventually appear in the system log. You can use the SSH fingerprint as a comparison to protect against a man-in-the-middle attack. For more information, go to Connecting Using PuTTY SSH in the Amazon Elastic Compute Cloud (Amazon EC2) User Guide.
Your screen should look similar to this:
Now that you have successfully signed in to your instance, you are ready to configure it. For instructions on configuring your instance, see Configure the Amazon EC2 Instance.
Connecting to Your Amazon EC2 Instance from a Linux/ UNIX Machine Using a Standalone SSH Client:
Use the ssh command to connect to your Linux/ UNIX instance from a Linux/ UNIX computer.
Note: Most Linux and UNIX computers include a Secure Shell (SSH) client by default. If yours doesn’t, the OpenSSH project provides a free implementation of the full suite of SSH tools. For more information, go to https:// www.openssh.org.
For an in-depth understanding and practical experience, Explore AWS Architect Training. |
To use SSH to connect
1. In a command line shell, change directories to the location of the private key file that you created in Step 4: Launch an Instance.
2. Use the chmod command to ensure that your private key file isn’t publicly viewable. For example, for mykeypair.pem, you would enter the following : chmod 400 mykeypair.pem
3. Sign in to the AWS Management Console and open the Amazon EC2 console at https:// console.aws.amazon.com/ ec2/.
4. In the Navigation pane, select US East (Virginia) from the Region drop-down menu.
5. Click Instances in the Navigation pane.
6. Right-click your instance, and then click Connect.
7. Click Connect using a standalone SSH client. AWS automatically detects the public DNS address of your instance and also the key pair name you have launched the instance with.
8. Connect to your instance by using the public DNS name of the instance. For example, if the key file is mykeypair.pem and the instance’s DNS name is ec2-184-72-209-110. compute-1. amazonaws.com, use the following command.
Related Article: What is AWS Cloudformation
ssh -i mykeypair.pem ec2-user@ ec2-184-72-209-110. compute-1. amazonaws.com
Note : We use ec2-user as the user name in this exercise for this AMI.
You’ll see a response like the following.
The authenticity of host ‘ec2-184-72-209-110. compute-1. amazonaws.com (10.254.142.33)’ can’t be established.
RSA key fingerprint is 00: 00: 00: 00: 00: 00: 00: 00: 00: 00: 00: 00: 00: 00: 00.
Are you sure you want to continue connecting (yes/ no)? yes
Note The SSH fingerprint will eventually show up in the system log. You can use the SSH fingerprint as a comparison to protect against a man-in-the-middle attack. For more information, go to Connect to Linux/ UNIX Instances from Linux/ UNIX with SSH in the Amazon Elastic Compute Cloud (Amazon EC2) User Guide.
You’ll see a response like the following.
Warning: Permanently added ‘ec2-184-72-209-110. compute-1. amazonaws.com’ (RSA) to the list of known hosts.
Now that you have successfully logged into your instance, you are ready to configure your instance. For instructions on how to configure your instance, see Configure the Amazon EC2 Instance.
Checkout Amazon EC2 Interview Questions |
Configure the Amazon EC2 Instance:
In this topic, we will configure the running instance. You will do the following tasks:
To simplify this tutorial, we are creating a database that will run locally on one Amazon EC2 instance. You will configure the Drupal application to use this Amazon EC2 instance for your database; all other Amazon EC2 instances will connect to this instance to access the database.
If you are going to use more than one Amazon EC2 instance, you will usually set up your database on a different server from the one that is running your application. That way, the information is stored in one location, and all instances have access to the same data instead of a local running database that may be out of sync.
Creating a separate database is beyond the scope of this document. For more information about setting up Amazon RDS for your web application, go to Step 8: Add Amazon RDS inside the Getting Started Guide Web Application Hosting for Linux.
To set permissions on the settings file
sudo chmod 666 /var/ www/ html/ sites/ default/ settings.php
To install a MySQL Server
sudo yum install mysql-server
When you are prompted, type ‘y’.
To start the web server and MySQL
1. On your Amazon EC2 instance, at a command prompt, start the web server, and then configure it to start up automatically on reboot:
sudo chkconfig httpd on
sudo service httpd start
You’ll see a response like the following.
Starting httpd [OK]
2. Start mysql, and configure it to start up automatically on reboot.
sudo chkconfig mysqld on
sudo service mysqld start
You’ll see a response like the following.
Starting mysqld [OK]
To configure a database
1. On your Amazon EC2 instance, update the password for the ‘root’ user. In this example, you’ll use the password ‘root’.
mysqladmin -u root password root
2. Create a database. In this example, you’ll use the database name ‘mydb’. mysqladmin -u root -p create mydb
When you are prompted for a password, type ‘root’.
3. Sign in and set the access database rights.
mysql -u root -p
When you are prompted for a password, type ‘root’.
4. At the MySQL prompt, set the permissions by using the following command. Replace < your public EC2 DNS address > with the public DNS address of the Amazon EC2 instance, which you recorded in Step 4: Launch an Instance.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON mydb.* TO ‘awsuser’@’ < your public EC2 DNS address >’ IDENTIFIED BY ‘mypassword’;
Checkout AWS IoT Tutorial |
If successful, MySQL will reply with the following:
Query OK, 0 rows affected
5. At the MySQL prompt, set the permissions by using the following command.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLE ON mydb. *TO ‘a ‘awsuser’@’%’ IDENTIFIED BY ‘mypassword’;
If successful, MySQL will reply with the following:
Query OK, 0 rows affected
6. To activate the new permissions, enter the following command:
FLUSH PRIVILEGES;
If successful, MySQL will reply with the following:
Query OK, 0 rows affected
7. Exit the MySQL prompt by typing the following:
exit
The server responds with the following:
Bye
To configure the application:
1) Open your web browser. In the Address box, type the public DNS address of the Amazon EC2 instance, which you have recorded during the process of Launching an Instance. The Choose profile page appears in the Drupal installation wizard.
2) On the Choose profile page, click Standard, and then click Save and continue.
3) On the Choose language page, click English, and then click Save and continue. The Set up database page appears.
4) On the Set up database page, enter the following information.
5) On the Configure site page, enter the following information.
The installation is complete.
6) Click Visit your new site.
7) To add a new article to your site, click Add new content.
Congratulations! You have successfully deployed your web application with Amazon Web Services. In the future, if you ever decide to launch more instances, you won’t want to customize each one. Let’s create a custom AMI that incorporates all the configuration changes we’ve made.
Related Pages:
AWS TRAINING
AWS TUTORIAL
If you interested to learn AWS and building a career in Cloud Computing? Then check out our AWS Certification Training Course at your near Cities
AWS Course in Ahmedabad, AWS Course in Bangalore AWS Course in Chennai, AWS Course in Delhi, AWS Course in Dallas, AWS Course in Hyderabad, AWS Course in London, AWS Course in Mumbai, AWS Course in NewYork, AWS Course in Pune
These courses are incorporated with Live instructor-led training, Industry Use cases, and hands-on live projects. This training program will make you an expert in AWS and help you to achieve your dream job.
Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!
Name | Dates | |
---|---|---|
AWS Training | Aug 05 to Aug 20 | |
AWS Training | Aug 08 to Aug 23 | |
AWS Training | Aug 12 to Aug 27 | |
AWS Training | Aug 15 to Aug 30 |
Prasanthi is an expert writer in MongoDB, and has written for various reputable online and print publications. At present, she is working for MindMajix, and writes content not only on MongoDB, but also on Sharepoint, Uipath, and AWS.
1 /15
Copyright © 2013 - 2023 MindMajix Technologies