0% found this document useful (0 votes)
117 views

EC2 Instance Creation

The document summarizes the configuration of a new Amazon EC2 instance. It shows the instance authenticating with an SSH key and logging in as the ec2-user. It then performs several system updates and installs the Apache HTTP Server (httpd). Finally, it configures httpd to start on boot, creates an index.html file in the document root, and leaves the user logged in as root in the /var/www/html directory.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views

EC2 Instance Creation

The document summarizes the configuration of a new Amazon EC2 instance. It shows the instance authenticating with an SSH key and logging in as the ec2-user. It then performs several system updates and installs the Apache HTTP Server (httpd). Finally, it configures httpd to start on boot, creates an index.html file in the document root, and leaves the user logged in as root in the /var/www/html directory.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

login as: ec2-user

Authenticating with public key "imported-openssh-key"

__| __|_ )

_| ( / Amazon Linux 2 AMI

___|\___|___|

https://aws.amazon.com/amazon-linux-2/

3 package(s) needed for security, out of 3 available

Run "sudo yum update" to apply all updates.

[ec2-user@ip-172-31-4-215 ~]$ yum update

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd

You need to be root to perform this command.

[ec2-user@ip-172-31-4-215 ~]$ sudo su

[root@ip-172-31-4-215 ec2-user]# yum update

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd

Resolving Dependencies

--> Running transaction check

---> Package kernel.x86_64 0:4.14.94-89.73.amzn2 will be installed

---> Package openssl.x86_64 1:1.0.2k-16.amzn2.0.1 will be updated

---> Package openssl.x86_64 1:1.0.2k-16.amzn2.0.2 will be an update

---> Package openssl-libs.x86_64 1:1.0.2k-16.amzn2.0.1 will be updated

---> Package openssl-libs.x86_64 1:1.0.2k-16.amzn2.0.2 will be an update

--> Finished Dependency Resolution

Dependencies Resolved
================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

kernel x86_64 4.14.94-89.73.amzn2 amzn2-core 19 M

Updating:

openssl x86_64 1:1.0.2k-16.amzn2.0.2 amzn2-core 496 k

openssl-libs x86_64 1:1.0.2k-16.amzn2.0.2 amzn2-core 1.2 M

Transaction Summary

================================================================================

Install 1 Package

Upgrade 2 Packages

Total download size: 21 M

Is this ok [y/d/N]: y

Downloading packages:

Delta RPMs disabled because /usr/bin/applydeltarpm not installed.

(1/3): openssl-1.0.2k-16.amzn2.0.2.x86_64.rpm | 496 kB 00:00

(2/3): openssl-libs-1.0.2k-16.amzn2.0.2.x86_64.rpm | 1.2 MB 00:00

(3/3): kernel-4.14.94-89.73.amzn2.x86_64.rpm | 19 MB 00:00

--------------------------------------------------------------------------------

Total 29 MB/s | 21 MB 00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction
Updating : 1:openssl-libs-1.0.2k-16.amzn2.0.2.x86_64 1/5

Updating : 1:openssl-1.0.2k-16.amzn2.0.2.x86_64 2/5

Installing : kernel-4.14.94-89.73.amzn2.x86_64 3/5

Cleanup : 1:openssl-1.0.2k-16.amzn2.0.1.x86_64 4/5

Cleanup : 1:openssl-libs-1.0.2k-16.amzn2.0.1.x86_64 5/5

Verifying : 1:openssl-libs-1.0.2k-16.amzn2.0.2.x86_64 1/5

Verifying : kernel-4.14.94-89.73.amzn2.x86_64 2/5

Verifying : 1:openssl-1.0.2k-16.amzn2.0.2.x86_64 3/5

Verifying : 1:openssl-libs-1.0.2k-16.amzn2.0.1.x86_64 4/5

Verifying : 1:openssl-1.0.2k-16.amzn2.0.1.x86_64 5/5

Installed:

kernel.x86_64 0:4.14.94-89.73.amzn2

Updated:

openssl.x86_64 1:1.0.2k-16.amzn2.0.2

openssl-libs.x86_64 1:1.0.2k-16.amzn2.0.2

Complete!

[root@ip-172-31-4-215 ec2-user]# yum install httpd

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd

Resolving Dependencies

--> Running transaction check

---> Package httpd.x86_64 0:2.4.37-1.amzn2.0.1 will be installed

--> Processing Dependency: httpd-tools = 2.4.37-1.amzn2.0.1 for package: httpd-2.4.37-


1.amzn2.0.1.x86_64

--> Processing Dependency: httpd-filesystem = 2.4.37-1.amzn2.0.1 for package: httpd-2.4.37-


1.amzn2.0.1.x86_64
--> Processing Dependency: system-logos-httpd for package: httpd-2.4.37-1.amzn2.0.1.x86_64

--> Processing Dependency: mod_http2 for package: httpd-2.4.37-1.amzn2.0.1.x86_64

--> Processing Dependency: httpd-filesystem for package: httpd-2.4.37-1.amzn2.0.1.x86_64

--> Processing Dependency: /etc/mime.types for package: httpd-2.4.37-1.amzn2.0.1.x86_64

--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.37-1.amzn2.0.1.x86_64

--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.37-1.amzn2.0.1.x86_64

--> Running transaction check

---> Package apr.x86_64 0:1.6.3-5.amzn2.0.2 will be installed

---> Package apr-util.x86_64 0:1.6.1-5.amzn2.0.2 will be installed

--> Processing Dependency: apr-util-bdb(x86-64) = 1.6.1-5.amzn2.0.2 for package: apr-util-1.6.1-


5.amzn2.0.2.x86_64

---> Package generic-logos-httpd.noarch 0:18.0.0-4.amzn2 will be installed

---> Package httpd-filesystem.noarch 0:2.4.37-1.amzn2.0.1 will be installed

---> Package httpd-tools.x86_64 0:2.4.37-1.amzn2.0.1 will be installed

---> Package mailcap.noarch 0:2.1.41-2.amzn2 will be installed

---> Package mod_http2.x86_64 0:1.11.1-1.amzn2 will be installed

--> Running transaction check

---> Package apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

httpd x86_64 2.4.37-1.amzn2.0.1 amzn2-core 1.3 M

Installing for dependencies:


apr x86_64 1.6.3-5.amzn2.0.2 amzn2-core 118 k

apr-util x86_64 1.6.1-5.amzn2.0.2 amzn2-core 99 k

apr-util-bdb x86_64 1.6.1-5.amzn2.0.2 amzn2-core 19 k

generic-logos-httpd noarch 18.0.0-4.amzn2 amzn2-core 19 k

httpd-filesystem noarch 2.4.37-1.amzn2.0.1 amzn2-core 23 k

httpd-tools x86_64 2.4.37-1.amzn2.0.1 amzn2-core 87 k

mailcap noarch 2.1.41-2.amzn2 amzn2-core 31 k

mod_http2 x86_64 1.11.1-1.amzn2 amzn2-core 150 k

Transaction Summary

================================================================================

Install 1 Package (+8 Dependent packages)

Total download size: 1.9 M

Installed size: 5.1 M

Is this ok [y/d/N]: y

Downloading packages:

(1/9): apr-1.6.3-5.amzn2.0.2.x86_64.rpm | 118 kB 00:00

(2/9): apr-util-1.6.1-5.amzn2.0.2.x86_64.rpm | 99 kB 00:00

(3/9): apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64.rpm | 19 kB 00:00

(4/9): generic-logos-httpd-18.0.0-4.amzn2.noarch.rpm | 19 kB 00:00

(5/9): httpd-2.4.37-1.amzn2.0.1.x86_64.rpm | 1.3 MB 00:00

(6/9): httpd-filesystem-2.4.37-1.amzn2.0.1.noarch.rpm | 23 kB 00:00

(7/9): httpd-tools-2.4.37-1.amzn2.0.1.x86_64.rpm | 87 kB 00:00

(8/9): mailcap-2.1.41-2.amzn2.noarch.rpm | 31 kB 00:00

(9/9): mod_http2-1.11.1-1.amzn2.x86_64.rpm | 150 kB 00:00

--------------------------------------------------------------------------------
Total 9.1 MB/s | 1.9 MB 00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : apr-1.6.3-5.amzn2.0.2.x86_64 1/9

Installing : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64 2/9

Installing : apr-util-1.6.1-5.amzn2.0.2.x86_64 3/9

Installing : httpd-tools-2.4.37-1.amzn2.0.1.x86_64 4/9

Installing : generic-logos-httpd-18.0.0-4.amzn2.noarch 5/9

Installing : mailcap-2.1.41-2.amzn2.noarch 6/9

Installing : httpd-filesystem-2.4.37-1.amzn2.0.1.noarch 7/9

Installing : mod_http2-1.11.1-1.amzn2.x86_64 8/9

Installing : httpd-2.4.37-1.amzn2.0.1.x86_64 9/9

Verifying : apr-util-1.6.1-5.amzn2.0.2.x86_64 1/9

Verifying : mod_http2-1.11.1-1.amzn2.x86_64 2/9

Verifying : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64 3/9

Verifying : httpd-filesystem-2.4.37-1.amzn2.0.1.noarch 4/9

Verifying : httpd-2.4.37-1.amzn2.0.1.x86_64 5/9

Verifying : apr-1.6.3-5.amzn2.0.2.x86_64 6/9

Verifying : httpd-tools-2.4.37-1.amzn2.0.1.x86_64 7/9

Verifying : mailcap-2.1.41-2.amzn2.noarch 8/9

Verifying : generic-logos-httpd-18.0.0-4.amzn2.noarch 9/9

Installed:

httpd.x86_64 0:2.4.37-1.amzn2.0.1
Dependency Installed:

apr.x86_64 0:1.6.3-5.amzn2.0.2

apr-util.x86_64 0:1.6.1-5.amzn2.0.2

apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2

generic-logos-httpd.noarch 0:18.0.0-4.amzn2

httpd-filesystem.noarch 0:2.4.37-1.amzn2.0.1

httpd-tools.x86_64 0:2.4.37-1.amzn2.0.1

mailcap.noarch 0:2.1.41-2.amzn2

mod_http2.x86_64 0:1.11.1-1.amzn2

Complete!

[root@ip-172-31-4-215 ec2-user]# service httpd start

Redirecting to /bin/systemctl start httpd.service

[root@ip-172-31-4-215 ec2-user]# chkconfig httpd on

Note: Forwarding request to 'systemctl enable httpd.service'.

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to


/usr/lib/systemd/system/httpd.service.

[root@ip-172-31-4-215 ec2-user]# cd /var/www/html

[root@ip-172-31-4-215 html]# cd

[root@ip-172-31-4-215 ~]# cd

[root@ip-172-31-4-215 ~]# cd

[root@ip-172-31-4-215 ~]# cd

[root@ip-172-31-4-215 ~]# cd

[root@ip-172-31-4-215 ~]# cd

[root@ip-172-31-4-215 ~]# cd

[root@ip-172-31-4-215 ~]# cd /var/www/html

[root@ip-172-31-4-215 html]# nano index.html

[root@ip-172-31-4-215 html]# nano index.html


[root@ip-172-31-4-215 html]# nano index.html

[root@ip-172-31-4-215 html]# nano index.html

[root@ip-172-31-4-215 html]# nano index.html

[root@ip-172-31-4-215 html]#

USerdata:

#!/bin/bash

yum update -y

yum install httpd -y

service httpd start

chkconfig httpd on

cd /var/www/html

echo "<html><h1>Hiiii</h1></html>" > /var/www/htm/index.html/

echo "<html><h1>health</h1></html>" > /var/www/htm/health.html

You might also like