nakatievent / my_baby_diary_app

0 stars 0 forks source link

AWSについて #24

Open nakatievent opened 3 years ago

nakatievent commented 3 years ago

AWSについて

今回AWSを使用してポートフォリオを作成することになったが、正直AWSCloud9しか使ったことが無いので全然知識がない状態である。

そこで、以前山浦さんのYoutubeDocker講座を学習しとても分かりやすかったので、今回はUdemyで山浦さんの下記の動画を購入した。 AWS:ゼロから実践するAmazon Web Services。手を動かしながらインフラの基礎を習得

勉強するのが楽しみだ!

nakatievent commented 3 years ago

セクション1:AWSでネットワーク・サーバを構築しよう

nakatievent commented 3 years ago

セクション2:【初期設定】AWSを始めよう

  1. AWSのアカウントを作成しよう
  2. CloudWatchで料金アラートを設定しよう
  3. IAMで作業用ユーザーを作成しよう ルートユーザーはAWS上でなんでもできる特権ユーザー AdministratorAccess→ほとんどのサービスにアクセスすることができる権限
    サインイン URL: https://942273433611.signin.aws.amazon.com/console
    ユーザー名: nakatievent
  4. CloudTrailで操作ログを記録しよう いつ誰が何をしたかを記録する
  5. このセクションのまとめ
nakatievent commented 3 years ago

セクション3:【VPC】ネットワークを構築しよう

  1. 本講座で作成するシステムの全体像

  2. AWSのネットワークの概念を学ぼう

    • リージョン→AWSの各サービスが提供されている地域のこと
    • 日本でAWSのサービスを使うときは東京リージョンを使うと応答時間が早くなる
    • アベイラビリティゾーンAWSは各国に複数のデータセンターを持っていて、そのデータセンターを束ねた物をアベイラビリティゾーンという。アベイラビリティゾーンは複数存在し、一つが利用不可能になっても、それ以外のアベイラビリティゾーンでシステムが稼働できる
    • VPC→AWS上に仮想ネットワークを作成できるサービス
    • VPCを細かく区切ったネットワーク→サブネット
    • AWSでサーバーを作るときはサブネットに配置する
    • サブネットはアベイラビリティゾーンに作る
  3. ネットワークのIPアドレスを決めよう(1)

  1. ネットワークのIPアドレスを決めよう(2)
  2. VPCを作成しよう
  3. サブネットを作成しよう
  4. ルーティングを設定しよう
  5. ネットワーク設計で考慮すべきポイント
  6. このセクションのまとめ
nakatievent commented 3 years ago

セクション4:【EC2】Webサーバーを構築しよう

  1. このセクションで構築するもの
  2. EC2インスタンスを設置しよう(1)
  3. EC2インスタンスを設置しよう(2)
  4. SSHについて学ぼう
  5. 公開鍵認証について学ぼう
  6. SSHでEC2インスタンスに接続しよう(Mac)

    chmod 600 ~/Desktop/aws_and_infra_ssh_key.pem
    chmod: Unable to change file mode on /Users/nakatievent/Desktop/aws_and_infra_ssh_key.pem: Operation not permitted
    
    ssh -i aws_and_infra_ssh_key.pem ec2-user@52.196.9.168
    The authenticity of host '52.196.9.168 (52.196.9.168)' can't be established.
    ECDSA key fingerprint is SHA256:y9wftFM/SXMtfQi+qqNO7+FGQLUiBbj86+WxayWxHP8.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '52.196.9.168' (ECDSA) to the list of known hosts.
    
       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

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

[ec2-user@ip-10-0-10-10 ~]$ exit ログアウト Connection to 52.196.9.168 closed.

27. ポート番号について学ぼう

[ec2-user@ip-10-0-10-10 ~]$ sudo lsof -i -n -P

28. Apacheをインストールしよう
`sudo yum update -y`
`sudo yum -y install httpd`
`sudo systemctl start httpd.service`
`sudo systemctl status httpd.service`
`ps -axu`

sudo systemctl enable httpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

sudo systemctl is-enabled httpd.service enabled


29. ファイアウォールを設定しよう
30. Elastic IPアドレスでIPアドレスを固定しよう
31. このセクションのまとめ
nakatievent commented 3 years ago

セクション5:【Route53】ドメインを登録しよう

  1. このセクションで構築するもの
  2. ドメインについて学ぼう
  3. DNSについて学ぼう
  4. ドメインを購入しよう
  5. Route 53について学ぼう
  6. Route 53でDNSを設定しよう dig aws_and_infration.work NS +short
  7. このセクションのまとめ
nakatievent commented 3 years ago

セクション6:【RDS】DBサーバーを構築しよう

  1. このセクションで構築するもの
  2. RDSについて学ぼう
  3. プライベートサブネットを作成しよう
  4. RDSを設置しよう(1)
  5. RDSを設置しよう(2)
  6. WebサーバーからRDSに接続しよう ssh -i aws_and_infra_ssh_key.pem ec2-user@54.168.231.241 [ec2-user@ip-10-0-10-10 ~]$ sudo yum -y install mysql
    
    [ec2-user@ip-10-0-10-10 ~]$ mysql -h aws-and-infra-web.cbnh1luuo8qx.ap-northeast-1.rds.amazonaws.com -u rott -p
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MySQL connection id is 12
    Server version: 8.0.15 Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>


45. このセクションのまとめ
nakatievent commented 3 years ago

セクション7:【EC2】WordPressを構築しよう

  1. このセクションで構築するもの

  2. WordPress用のデータベースを作成しよう ssh -i aws_and_infra_ssh_key.pem ec2-user@54.168.231.241 mysql -h aws-and-infra-web.cbnh1luuo8qx.ap-northeast-1.rds.amazonaws.com -u rott -p CREATE DATABASE aws_and_infra DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; create user 'aws_and_infra'@'%' identified by 'password'; grant all on aws_and_infra.* to 'aws_and_infra'@'%'; flush privileges; select user , host from mysql.user; mysql -h aws-and-infra-web.cbnh1luuo8qx.ap-northeast-1.rds.amazonaws.com -u aws_and_infra -p exit exit

  3. WordPressをインストールしよう ssh -i aws_and_infra_ssh_key.pem ec2-user@54.168.231.241 sudo amazon-linux-extras install -y php7.2 sudo yum install -y php php-mbstring cd ~ wget https://ja.wordpress.org/latest-ja.tar.gz tar xzvf latest-ja.tar.gz cd wordpress sudo cp -r * /var/www/html/ sudo chown apache:apache /var/www/html/ -R sudo systemctl status httpd.service sudo systemctl restart httpd.service sudo systemctl status httpd.service

  4. WordPressを設定しよう aws-and-infration.work

  5. なんでWordPressのサイトが表示されるの?

  6. TCP/IPについて学ぼう

  7. HTTPについて学ぼう

  8. TCPとUDPについて学ぼう

  9. IPについて学ぼう

  10. このセクションのまとめ