1
0

More than 1 year has passed since last update.

AWS認定クラウドプラクティショナー合格に向けて Day11

Last updated at Posted at 2022-12-11

前回の内容

AWS認定クラウドプラクティショナー合格に向けて Day10

EC2インスタンス操作 2/2

前回に引き続き操作方法について確認する

WEBサイトを作成する

管理者権限(ルート権限)に移動する

[ec2-user@~~~~ ~]$ sudo su
[root@~~~~ ec2-user]# 

ファイルの確認を行う

ソフトウェアの状態を確認して必要なものはアップデートされる

[root@~~~~ ec2-user]# yum update -y
~
~
~
完了しました!

アパッチサーバーを導入する

WEBサーバーになるソフトウェア

[root@~~~~ ec2-user]# yum install httpd -y
~
~
~
完了しました!

アパッチサーバーの中にWEBサイトを作成する

htmlファイルを作成する

WEBページを作るためのディレクトリ(html)に移動し適当なhtmlファイルを作成する(index.html)

[root@~~~~ ec2-user]# cd /var/www/html
[root@~~~~ html]# 

アパッチサーバーを起動する

インスタンスを停止するたびにアパッチサーバーも停止するため都度起動する必要がある

[root@~~~~ html]# systemctl start httpd

常に起動しておくには以下のコマンドを実行する

[root@~~~~ html]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

サイトにアクセスする

パブリックIPアドレスにアクセスすると...
作成したindex.htmlが表示されている!
スクリーンショット 2022-12-04 23.45.40.png

EC2インスタンスのバックアップ

バックアップはAMIというイメージで取得する
インスタンスのダッシュボードから

  1. 該当のインスタンスを選択
  2. アクション
  3. イメージとテンプレート
  4. イメージの作成

でイメージを作成していく

次の記事は➡︎AWS認定クラウドプラクティショナー合格に向けて Day12

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0