Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AWS DevDay2022 どんな低スペックPCが割り振られても泣かないで!開発環境をCloudへ移行した話

yamjun
November 11, 2022
380

AWS DevDay2022 どんな低スペックPCが割り振られても泣かないで!開発環境をCloudへ移行した話

ローカルの開発環境における課題の一つは、マシンのハードウェアに制限があることです。例えば、CPUのスペック不足やメモリーの枯渇、ローカルディスクの容量不足が挙げられます。それらの制限の度に皆さんはストレスを感じローカルマシンを新調したことでしょう。
今回は、ローカルの開発環境にVisual Studio Codeを利用しつつ、ローカルのハードウェアの制限から開放されるべくAWS Cloud9へのリモートインスタンスを活用する方法と感想をお話します。

yamjun

November 11, 2022
Tweet

Transcript

  1. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. どんな低スペックPCが割り振ら れても泣かないで︕ 開発環境をCloudへ移⾏した話 山本 純也 $     アマゾン ウェブ サービス ジャパン合同会社 ソリューション アーキテクト
  2. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⾃⼰紹介 名前︓⼭本 純也 • 所属︓アマゾンウェブサービスジャパン 合同会社 • 職種︓ソリューションアーキテクト • 経歴︓モバイルゲームの会社︓ - モバイルゲームのアプリケーション開発・運⽤ - 分析基盤の構築 • 好きなAWSサービス︓AWS Lambda AWS Fargate AWS Cloud9
  3. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. アジェンダとターゲット • アジェンダ︓ § ローカルPCの制限について振り返り § クラウドを活⽤したソリューションの紹介 § アーキテクチャとセットアップ⽅法を簡単に紹介 • ターゲット︓ § 普段のPCスペックに不満を抱いているコードを書いているエンジニア
  4. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⼤多数がエンジニアであると同時にサラリーマン and
  5. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. PCのスペックにおける選択権がないことが多い でも、本当に欲しいのは… B 8Gメモリー Core i 5 Windows A 8Gメモリー Core i 5 Mac 本当に欲しいのは… M2 Mac 24Gメモリー 2TB SSD スペック不⾜の GAP
  6. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ローカルPCにおけるスペック不⾜とは︖ コンパイルと 処理の実⾏が遅い 同時に実⾏できる アプリの制限あり アセットなど 巨⼤なデータの 保存に制限あり メモリー ストレージ
  7. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ローカルPCのスペック不⾜における 解決策は何がある︖ • マシンの買い替えを会社へ直談判 § マシン1台20万-30万円 • クラウドリソースの活⽤ § IaaS︓(Amazon Elastic Compute Cloud) § DaaS︓(Amazon AppStream2.0やNICE DCV) § SaaS︓(AWS Cloud9)
  8. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS Cloud9 A cloud IDE for writing, running, and debugging code • Start new projects quickly • Docker、Git、AWS CLIなど開発環境に必要なものが インストール済み • Cloud9 base on EC2 • ⼀度セットアップした開発環境を AMIとしてチームで共有可能 • Code together in real time • ペアプロがしやすい AWS Cloud9とは︖
  9. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 私が感じるCloud9のもう⼀息なポイントと理想 • Cloud9はIDEとして完結しており、拡張性の余⽩がない • ブラウザの壁が厚い § 具体的にはCtrl-wや⌘-wでCloud9のウィンドウを閉じてしまう • ただ、Cloud9は開発環境の箱としては魅⼒的 § Docker、Git、AWS CLIだけでなく、開発するターゲットによって利⽤する Cloud9を切り替えられるのも魅⼒。つまり、ローカル環境を汚さなくてもよい § IDEとして構築されているので、起動やシャットダウンも構成済み • やはり、⼿元ではVisual Studio Codeを利⽤したい
  10. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. そこで︕︕ 普段使っている Visual Studio CodeからCloud9を リモート接続できれば 互いの良い所を補完し合えるのでは︕︖
  11. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 理想をまとめると • インターフェイスはVisual Studio Codeで • コンパイルやソースコードをアセットはクラウドで ローカルPC AWS Cloud9 シームレスに接続
  12. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Visual Studio Code Remote - SSH シームレスに接続 AWS Cloud Region VPC AWS Cloud9 AWS Systems Manager ローカルPC Extensions: Remote - SSH Visual Studio CodeのExtensionであるRemote – SSHによりCloud9へSSHで接続 (プロトコルはSSHではあるもものAWS Systems MagnagerでSSHをトンネリング可能で、 不要なポートを開なくてもOK)
  13. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. VS Code Remote – SSHでクラウドを使うメリット • リソース選択の⾃由 § EC2の拡張性があるためローカルPCと違いCPUやメモリー、ストレージを⾃由に 選択可。具体的にはメモリー384 GBで96vCPUの開発環境も実現 • コスト最適化 § 開発時のみCloud9を起動し、終わったら終了 → 従量課⾦ • VS Codeのエコシステムを利⽤できるので拡張性が⾼い • SSMを通じてデータをやり取りするため⾼いセキュリティ
  14. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Field Notes: Use AWS Cloud9 to Power Your Visual Studio Code IDE VS Code Remote - SSHでCloud9を利⽤する⽅法 https://aws.amazon.com/jp/blogs/architecture/field-notes-use-aws-cloud9-to-power-your-visual-studio-code-ide/
  15. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. ⼤まかなセットアップの⼤体の流れ 1. Cloud9の⽴ち上げ 2. VS CodeにRemote SSHの拡張機能を追加 3. 接続の設定 § SSH key pairを作成しCloud9へ設定 § Cloud9のPower On/Offを⾃動でセットするスクリプト導⼊ https://aws.amazon.com/jp/blogs/architecture/field-notes-use-aws-cloud9-to-power-your-visual-studio-code-ide/ 詳細はAWS Blogを参照 結果︓VS Codeから意識しなくともCloud9が起動し、 ⼀定時間接続がなければシャットダウン → コスト最適化へ
  16. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. クラウド費⽤概算 コーディング中のCPU負荷は⾼くないので、 ⼀時的なバーストが利⽤できるt系インスタンスタイプがオススメ 例えば、 Cloud9(EC2)の X を100GBのインスタンスで1⽇8時間 - 20⽇間利⽤ § X = t3.mediumならば約1700円/⽉ vCPU:2, メモリー:4GB § X = t3.largeならば約3000円/⽉ vCPU:2, メモリー:8GB 注釈︓データ転送量は含まず 147.614円/ドル(2022/10/23で計算)
  17. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. まとめ • ローカルPCの制限について振り返り • VS Code Remote –SSH を⽤いCloud9へリモート接続する環境を紹介 § クラウドのほぼ無限のリソース § コスト最適化出来るポイント § エコシステムが豊富なVS Codeが利⽤出来る • クラウド費⽤の概算⾒積もり § 営業⽇フルで起動しても⽉額約1700円前後 注釈︓ t3.mediumを利⽤しデータ転送量は含まず 147.614円/ドル(2022/10/23で計算)
  18. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Thank you! © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. 山本純也 [email protected]
  19. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Please complete the session survey © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.