Next we're going to SSH to our server and run our deploy script
open up the
Google Chrome and load up the Amazon console page then head over to services
and ec2 under the compute option
we're going to choose running instances where
our instance should be up and running from the previous steps what we need to
do is we're going to SSH to our server in order to do that we need this Public
DNS ipv4
so hover over this entry here and click on this copy to keyboard
button then open up the terminal and we're going to use SSH to connect to our
server the way you do that is you type ssh ubuntu@ and then paste the URL for
the server
ubuntu is the user that we're going to connect to and the
authentication should automatically happen via our public key so hit enter
and you may be prompted with this authenticity of hosts and just type on
or hit yes and hit enter and then you should be connected to the server
alright so once you're connected to the server we need to download and run the
script that we created to setup our server so if you head over to the github
project and refresh the page you should see that since we've last pushed our
changes we have the deployed directory so we'll just wait for the github page
to refresh and then click on deploy and we need to get the URL for the raw data
file for our setup script
what we're going to do is we're going to pull the
script from the internet on to our server and we're going to run the script and
that script should set up our server for the deployment
the way you get the raw
file in github is you select the file and then you click on this raw button
here and this will take us to the raw text page for the setup script
so copy the URL that's in the browser and then head back into the terminal that's
connected to our server and we're going to run the following command curl -
lowercase s uppercase L and then paste the URL and then add the pipe which is
the line sudo bash -
what this does is it runs the curl command to download the
file and then it passes it into sudo bash so this curl command is
used to retrieve contents from a URL so it's basically a HTTP client in Linux
the dash S is for running in silent mode which means it won't update us with all
of the steps when it's downloading the file
the L is for following redirects so
if there's any redirects of this URL then it will automatically follow them to the
final destination and download the contents
the pipe is used to pipe the
output of one command into another command so we're going to take the
output of this curl command and we're going to pass it into sudo bash sudo is
used to run commands as administrator on Linux and bash is what we're going to
use to run our script
the hyphen is used to signal the end of the options
provided for bash so that it knows anything we pass in is to be ran on bash
and not an option to configure bash
okay so enter that into the console and hit
enter and this should go ahead and run our script so we're going to wait for
the script to finish it should take a few minutes to install all the
dependencies and set up our project once the script is finished running head over
to the Amazon Web Services console and copy the hostname again and then enter
it into the browser
you should see this bad request 400 and that's because we
haven't added the host name to the allowed hosts on
our settings dot py file so we're going to do that in the next video but that's
all you need to do to deploy our code to the server