3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

(備忘録)AWSではじめるLinux入門ガイドのデモ(ファイル操作コマンドなど)

Last updated at Posted at 2021-05-05

1. はじめに

2021年5月2日にヤマムギ様主催にて開催されたヤマムギ vol.19 AWSではじめるLinux入門ガイドのデモ(ファイル操作コマンドなど)でのAWS学習内容について、自分への備忘録としてまとめてみました。ご参考になれば幸いです。

2. 学んだ内容

  • EC2起動テンプレート
  • AWS CloudShell
  • コマンドを用いたS3操作
  • コマンドを用いたEFS操作

3. 学習サイト

4. 参考サイト

5. ハンズオンで得た豆知識

  • EC2の起動テンプレートを用いると、毎回同じEC2を作成&起動できる
  • CloudShellを用いると、コマンドラインで起動テンプレートを実行できる
// AWS CloudShell
aws ec2 run-instances --cli-input-yaml file://linux.yaml
  • awsコマンド操作
// S3操作コマンド
// ホームディレクトリへ移動
$ cd ~

// S3バケットの作成
$ aws s3 mb s3://xxxxxxxx
$ aws s3 mb s3://yamamugi20210505

// 新規ディレクトリの作成
$ mkdir ~/work

// 画像のダウンロード
$ wget https://xxxxxxxx
$ wget https://yamashita-20210505.s3.amazonaws.com/yamamugi.png

// S3バケットへのファイルアップロード
$ aws s3 cp xxxxxxxx.png s3://xxxxxxxx

// S3バケット内の一覧表示
$ aws s3 ls s3://xxxxxxxx

// S3バケット内の一覧表示
$ aws s3 ls -recursive s3://xxxxxxxx

// S3アクセス権限の確認
$ aws s3api get-object-acl --bucket xxxxxxxx -- key xxxxxxxx.png

// S3アクセス権限の付与
$ aws s3api put-object-acl --acl public-read --bucket xxxxxxxx --key xxxxxxxx.png

// テキストファイルの新規作成
$ echo HelloWorld > ~/work/hash.txt

// ハッシュ値の確認
$ md5sum hash.txt

// opensslにてハッシュ値の生成&base64化
$ openssl md5 -binary hash.txt | -base64

// ハッシュ値チェック付きでS3へアップロード
$ aws s3api put-object /
// EFS(Elastic File System)
// マウントポイントの作成
$ sudo mkdir /mnt/efs

// マウントヘルパー
$ sudo yum install -y amazon-efs-utils

// EFSをマウント
$ sudo mount -t efs fs-xxxxxxxx:/ /mnt/efs

// マウント先のEFSへファイルコピー
$ sudo cp hash.txt /mnt/efs

// マウント先のEFS内のファイル内容表示
$ sudo cat /mnt/efs/hash.txt

6. おわりに

AWS学習の参考になれば幸いです。
ハンズオン開催してくださいましたヤマムギ様、感謝いたします。

2021/05/05 NISHIZONO Takahiro

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?