Skip to main content

Deploy Your Web Application into AWS

Deploy Your Web Application into AWS


Deploy Your Application
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.
Connecting to your Amazon EC2 Instance from Your Web Browser Using the MindTerm SSH Client:
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
Install and Enable Java on Your Browser:
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 http:// java.com/ en/ download/ help/ index_installing.xml).
2. Enable Java in your web browser (see http:// 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 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 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.
Connect to Your Amazon EC2 Instance from a Windows Computer Using PuTTY:
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.
  • Launch PuTTYGen. On the Conversions menu, click Import Key.
  • Browse for mykeypair.pem, and then click Open.
  • Click Save private key. In the message it asks if you want to continue without a passphrase, click OK. Save the key as mykeypair.ppk.
  • Close PuTTYGen.
3) Configure the SSH settings.
  • Start PuTTY, expand the SSH node, and then click Auth.
  • In the Private key file for authentication box, enter the location for mykeypair.ppk.
4) Modify the keepalive.
  • In the PuTTY Configuration window, in the Catgeory pane, click Connection.
  • In the Seconds between keepalives (0 to turn off) box, type 60. If you don’t change this value, your session will time out.
5) Save the session settings.
  • In the PuTTY configuration window, in the category pane, click session.
  • In the load, save, or delete a stored session box, click default settings, and click save.
6) Type the DNS address of the Amazon EC2 instance, which you have retrieved in the previous task.
  • In the PuTTY Configuration window, in the Category pane, click Sessions. In the Host Name (or IP address) box, type < ec2-user@ DNS address of your Amazon EC2 instance >.
Note : The user name for the AMI is ec2-user.
  • Click Open. When the PuTTY Security Alert dialog box appears, click Yes to confirm that the fingerprint is OK. The SSH PuTTY window will open.
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 http:// www.openssh.org.
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.
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.
  • Enter yes.
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.
Configure the Amazon EC2 Instance:
In this topic, we will configure the running instance. You will do the following tasks:
  • Set permissions on the settings file
  • Install MySQL Server.
  • Start the web server and MySQL.
  • Configure a database.
  • Configure the application.
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
  • On your Amazon EC2 instance, at a command prompt, use the following command to set permissions:
sudo chmod 666 /var/ www/ html/ sites/ default/ settings.php
To install a MySQL Server
  • On your Amazon EC2 instance, at a command prompt, use the following command to install 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’;
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.
  • Under Database type, click MySQL, MariaDB, or equivalent.
  • In the Database name box, type the name of your database. In this example, you’ll use mydb.
  • In the Database username box, type the user name for your database. In this example, you’ll use aws user.
  • In the Database password box, type the password for your database. In this example, you’ll use my password.
  • Click Advanced Options.
  • In the Database host box, type the public DNS address of your Amazon EC2 instance, which you recorded in process of Launch an Instance.
  • Click Save and continue.
5) On the Configure site page, enter the following information.
  • In the Site name box, type a name for your site.
  • In the Site e-mail address box, type your email address.
  • In the username box, type a user name.
  • In the password box, type a password that corresponds to the user name.
  • In the confirm password box, retype the password.
  • Click save and continue.
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.

Comments

  1. Awesome post presented by you..your writing style is fabulous and keep update with your blogs AWS Online Course

    ReplyDelete
  2. I will appreciate the work done by Amazondumps.us which has made a big difference for the students who want to be professional in their fields. This site has been very helpful for me to pursue my certification. I will prefer AMAZON AWS SYSOPS Exam Dumps for my any further certification as it is the most reliable study material for me. The experts are doing their work excellently which is changing the careers of so many people. I would say thanks for providing me such a material which helped me to ace my exam by the first attempt.

    ReplyDelete
  3. I got smashing results in AMAZON AWS SYSOPS exam and it was an unachievable task for me without the help from AWS SYSOPS Exam Dumps. I am thankful to the experts who made question and answers so interesting and informative which gave me a comprehensive understanding of the field. I think AWS SYSOPS Dumps can be a source of pleasure for any IT candidate.

    ReplyDelete

Post a Comment

Popular posts from this blog

AWS S3 Simple Storage Service

                             Amazon  S3  (Simple Storage Service) Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon  S3  has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. What Is Amazon S3? Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefit...

AWS Route 53 & Routing Policy

Amazon Route 53 You can use Amazon Route 53 to register new domains, transfer existing domains, route traffic for your domains to your AWS and external resources, and monitor the health of your resources. Amazon  Route 53  ( Route 53 ) is a scalable and highly available Domain Name System (DNS). It is part of Amazon.com's cloud computing platform, Amazon Web Services (AWS). The name is a reference to TCP or UDP port  53 , where DNS server requests are addressed. ...  Route 53's  servers are distributed throughout the world. DNS management If you already have a domain name, such as example.com, Route 53 can tell the Domain Name System (DNS) where on the Internet to find web servers, mail servers, and other resources for your domain. Learn More Traffic management Route 53 traffic flow provides a visual tool that you can use to create and update sophisticated routing policies to route end users to multiple endpoints for your application. Le...

Amazon EBS Elastic Block Store

     Amazon Elastic Block Store Amazon  Elastic Block Store  (Amazon  EBS ) provides persistent block storage volumes for use with Amazon EC2 instances in the  AWS  Cloud. Each Amazon  EBS volume is automatically replicated within its Availability Zone to protect you from component failure, offering high availability and durability. Amazon Elastic Block Store (Amazon EBS) provides persistent block storage volumes for use with  Amazon EC2  instances in the AWS Cloud. Each Amazon EBS volume is automatically replicated within its Availability Zone to protect you from component failure, offering high availability and durability. Amazon EBS volumes offer the consistent and low-latency performance needed to run your workloads. With Amazon EBS, you can scale your usage up or down within minutes – all while paying a low price for only what you provision. Amazon EBS is designed for application workloads that benefit from fine tu...