right a bash scrip to automate our easy to security updates
and create a bash Script to launch are easy to Web server.
we downloaded and used putty toe log in tow. RTC to instance
we also use Putty Jin to convert our pen file into a PPK file.
we will really step up our game and automate the EEC to bootstrap process.
We will also configure and launch our easy to Web server via bash script.
So, in essence, everything that we have been doing throughout the past few easy to videos
updating our Lennix Am mine. Installing our Apache servers,
we will combine into a script that will automate all of these tasks.
For those who may not be familiar, bash stands for
the born again shell.
It's a command line interpreter
that's included with most Lennox distributions.
It's used for scripting to do such things as read files or execute commands.
Now our course won't make you a bash expert.
However, I highly recommend that you continue learning more about bash and other scripting. Language is such as python
to really take your career to the next level.
The first thing that we will need to do is create a landing page for a Web server.
I've created a basic HTML foul
that says today I am honored to teach you how to automate the EEC to bootstrap process.
We will need to upload this file
to an S three bucket,
So let's log into the console
click Create bucket.
Let's give the bucket a unique name.
I will name mine Cyber Very Dash E C to Dash Automation Dash Demo,
then click Create bucket.
Next, we want to attach a role.
So let's go back out to the console and select I am.
Then click rolls from the menu on the left
we will slay easy to
in the filter type s3 To select the S tree policies,
Amazon ist three Full access,
Let's give our role of name.
can underscore Call underscore history
I will update the description.
Finally click create role
and our new role has been created.
Now let's go back to our newly created as three bucket,
we will need to upload our static Web page that we created.
Next. Let's go back to the console
and click on Easy to.
Then click Launch instance.
You select the Amazon Lennox to am I
t to Micro is our instance type.
configure instance. Details.
Navigate down to where it says
Then from the dropdown,
select our easy to can call as three roll
scroll down to advanced details,
then click inside the user data box.
This is where we create our bash scrip.
Usually one would create the script in the text editor, but since this is a learning demo, we could place are short script directly into the window, line by line.
This will give us a chance to learn what each command is doing within the script.
The first line that we type is called the Shebang.
This is the pound sign, followed by an exclamation point
and then the path to the bash Interpreter.
we run Yemen stall H T T P D
To install our Apache server.
to install any security updates.
we will have our E. C. Two Instance, copy our static Web page that we uploaded into Rs Tree Bucket
to the HTML directory of our new Apache server.
we run service H T T p d start
to start our Apache server,
we will run the check config. H t t p d on command.
This command will check to see if the Apaches service is running on our instance,
just in case our session gets terminated.
Next, click, add storage,
accepted the faults and then click add tags.
Then select Configure Security Group.
We will use our existing security group that we created. In a previous lesson,
Cy Berry underscored Demo underscored DMC
Now Click Review and Launch
perform a final review.
We will use the existing key pair that we created in previous lesson,
Then click launch Instances,
then select view instances
in the filter. I like to type pending and running to clear out in the stop determinate instances.
And now that we see are instances
Once running, our instance will execute the script that we added in the user data box.
now are instances up in running.
I will copy the public I p address to the clipboard.
Next, we will open a browser
and see if our script worked.
We expect to see a fully patched and functioning Web server
hosting our HTML page that we uploaded to RST bucket
and there's our Web page.
So just to summarize,
before we even created this instance,
we created an HTML page.
Then we created a new S three bucket
that we uploaded our HTML file into.
We then created a new E C to roll, and I am
that has full access to as three buckets.
Next, we launched a new easy to instance.
We instructed it to install the Apache server,
install any security updates,
copy the HTML page from Rs three bucket
to the HTML directory of our Apache server,
turn on the Apache server
and check to ensure that the servers running
all of this was done from a few lines of a bash grip.
That, my friends, is just a taste of the power of automation.
Congratulations, everyone, Fantastic job.
we wrote a bash grip toe automate R E C two security updates,
we created a bash scrip to launch our easy to Web server