├── LICENSE ├── README.md ├── cloud9-alternative-cloudformation.yaml └── images ├── cloudformation-checkbox.png ├── cloudformation-complete.png ├── cloudformation-delete.png ├── cloudformation-open.png ├── cloudformation-stack-name.png ├── cloudformation-stacks.png ├── cloudformation-upload.png ├── ec2-stop.png ├── ssm-ec2-user.png ├── ssm-open.png ├── ssm-session-manager.png ├── ssm-start-session.png ├── ssm-terminal.png ├── vscode-install-node.png ├── vscode-open-directory.png ├── vscode-open-directory2.png ├── vscode-open-directory3.png ├── vscode-port-forward.png ├── vscode-terminal.png ├── vscode-tool-versions.png ├── vscode-upload-file.png └── vscode.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Yuki Oshima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AWS Cloud9 新規利用終了のための代替環境 2 | 3 | このリポジトリでは、AWS 上に Cloud9 の代替となる開発環境を構築するための手順と設定ファイルを公開しています。 4 | AWS Cloud9 の代替として、EC2 インスタンスで [Visual Studio Code Server](https://code.visualstudio.com/docs/remote/vscode-server) を使用します。 5 | 6 | > [!WARNING] 7 | > このリポジトリの手順では、デフォルトで t2.micro の EC2 インスタンスを起動します。 8 | > このインスタンスを起動し続けると、1 ヶ月で 10 数ドル程度の料金が発生します。 9 | 10 | ## 目次 11 | 12 | - [環境構築手順](#環境構築手順) 13 | - [トラブルシューティング](#トラブルシューティング) 14 | - [停止・削除手順](#停止・削除手順) 15 | - [基本操作](#基本操作) 16 | - [各種インストール手順](#各種インストール手順) 17 | - [参考リポジトリ](#参考リポジトリ) 18 | 19 | ## 環境構築手順 20 | 21 | ### 1. CloudFormation スタックの作成 22 | 23 | マネジメントコンソール上部の検索欄で「CloudFormation」を検索して開きます。 24 | 25 | ![](images/cloudformation-open.png) 26 | 27 | > [!NOTE] 28 | > 日本に在住の場合、マネジメントコンソール右上で「東京」リージョンを選択することで、開発環境を快適に使用することができます。 29 | 30 | CloudFormation のホーム画面左のメニューから「スタック」を開き、「スタックの作成」を選択します。 31 | 32 | ![](images/cloudformation-stacks.png) 33 | 34 | [cloud9-alternative-cloudformation.yaml](cloud9-alternative-cloudformation.yaml) をダウンロードして、「スタックの作成」画面でアップロードして次に進みます。 35 | 36 | ![](images/cloudformation-upload.png) 37 | 38 | スタック名を適当につけて、その他の設定はデフォルトのままで、作成まで進めます。 39 | (最後に IAM リソースが作成されることを承認するチェックボックスにチェックが必要です) 40 | 41 | ![](images/cloudformation-stack-name.png) 42 | 43 | ![](images/cloudformation-checkbox.png) 44 | 45 | しばらくすると、スタックの作成が完了します。 46 | 47 | ![](images/cloudformation-complete.png) 48 | 49 | > [!WARNING] 50 | > AWS のハンズオンでは、AWS CLI や CDK、Terraform、Serverless Framework などのツールを使用するために、開発環境に非常に強い権限が必要なことが多いです。 51 | > そのため、この手順で構築される EC2 インスタンスには AdministratorAccess の権限を付与しています。 52 | 53 | ### 2. EC2 インスタンスへの接続 54 | 55 | マネジメントコンソール上部の検索欄で「Systems Manager」を検索して開きます。 56 | 57 | ![](images/ssm-open.png) 58 | 59 | Systems Manager のホーム画面左のメニューから「セッションマネージャー」を開き、「セッションの開始」をクリックします。 60 | 61 | ![](images/ssm-session-manager.png) 62 | 63 | 「ターゲットインスタンス」で該当の EC2 インスタンスを選択して、「Start session」をクリックすると、ブラウザ上で EC2 インスタンスに接続できます。 64 | 65 | ![](images/ssm-start-session.png) 66 | 67 | ![](images/ssm-terminal.png) 68 | 69 | ### 3. `sudo loginctl enable-linger ec2-user` コマンドの実行 70 | 71 | セッションマネージャーで接続したら、以下のコマンドを実行して、「ec2-user」というユーザーで Visual Studio Code Server を使う準備をします。 72 | 73 | ```console 74 | sudo loginctl enable-linger ec2-user 75 | ``` 76 | 77 | エラーがない場合、以下のように特に実行結果は表示されません。 78 | 79 | ``` 80 | sh-5.2$ sudo loginctl enable-linger ec2-user 81 | sh-5.2$ 82 | ``` 83 | 84 | > [!NOTE] 85 | > 上記のコマンドは、あとで実行する `code tunnel service install` コマンドが成功するようにするための操作です。 86 | 87 | ### 4. ユーザーの変更 88 | 89 | 続いて、以下のコマンドを実行して、操作中のユーザーを「ec2-user」に変更します。 90 | 91 | ```console 92 | sudo su - ec2-user 93 | ``` 94 | 95 | ターミナルの表示が以下のようになれば成功です。 96 | (IP アドレスの部分は毎回異なります) 97 | 98 | ``` 99 | [ec2-user@ip-10-0-0-119 ~]$ 100 | ``` 101 | 102 | ![](images/ssm-ec2-user.png) 103 | 104 | > [!WARNING] 105 | > 次の Visual Studio Code Server に接続するためのコマンドを実行する前に、上記の手順でユーザーを「ec2-user」に切り替える必要があります。 106 | 107 | ### 5. Visual Studio Code Server への接続 108 | 109 | 作成した EC2 インスタンスには、Visual Studio Code がインストール済みです。 110 | 以下の手順で、Visual Studio Code Server を起動して接続することができます。 111 | 112 | まず、EC2 インスタンスで以下のコマンドを実行して、Visual Studio Code Server を起動します。 113 | 114 | ```console 115 | code tunnel service install 116 | ``` 117 | 118 | 以下のように、メッセージとともにコード (8 桁の英数字) が表示されます。 119 | 120 | ``` 121 | [2024-08-05 05:40:38] info Using GitHub for authentication, run `code tunnel user login --provider ` option to change this. 122 | To grant access to the server, please log into https://github.com/login/device and use code XXXX-XXXX 123 | ``` 124 | 125 | ブラウザの別タブで [https://github.com/login/device](https://github.com/login/device) にアクセスし、GitHub にログインして、ターミナル上に表示されたコードを入力してください。 126 | 127 | その後、EC2 Instance Connect の画面に戻り、以下のコマンドを実行してください。 128 | 129 | ```console 130 | journalctl --user -u code-tunnel | grep https://vscode.dev/tunnel 131 | ``` 132 | 133 | すると、以下のように表示されます。 134 | (表示されない場合は数秒待って再度コマンドを実行してください) 135 | 136 | ``` 137 | Jan 29 11:14:07 ip-10-0-0-188.ap-northeast-1.compute.internal code-tunnel[26082]: Open this link in your browser https://vscode.dev/tunnel/XXXXXXXXXXXXXXXXXXXX 138 | ``` 139 | 140 | 表示された URL にアクセスして GitHub でログインすると、ブラウザ上で Visual Studio Code が開きます。 141 | 142 | ![](images/vscode.png) 143 | 144 | ## トラブルシューティング 145 | 146 | ### 開発環境が安定しない場合 147 | 148 | 開発環境が t2.micro の EC2 インスタンスで安定的に動作しない場合、インスタンスのスペックが不足している可能性があります。 149 | その場合は、インスタンスタイプを「c7i.large」として構築し直してみてください。 150 | 151 | ただし、**c7i.large インスタンスを起動し続けると、1 日あたり 2.7 ドル程度、1 ヶ月で 80 ドル程度の料金が発生します。** 152 | ハンズオンが終了したら環境を停止または削除するようにしてください。 153 | 154 | > [!NOTE] 155 | > それでもこの開発環境が安定的に動作しないといった場合は、GitHub の [Issue](https://github.com/os1ma/cloud9-alternative/issues) で起票お願いします。 156 | 157 | ### `-bash: code: command not found` 158 | 159 | `code` コマンド実行時に `-bash: code: command not found` というエラーになった場合、以下のコマンドを順に実行することで、code コマンドをインストールし直すことができます。 160 | 161 | ```console 162 | sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc 163 | echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null 164 | dnf check-update 165 | sudo dnf install -y code 166 | sudo loginctl enable-linger ec2-user 167 | ``` 168 | 169 | ### `code tunnel service install` での GitHub ログイン後のエラーメッセージ 170 | 171 | `code tunnel service install` コマンドを実行して GitHub でログインした後、以下のエラーメッセージが表示される場合があります。 172 | 173 | > [2024-12-01 03:01:20] error Error creating dbus session. This command uses systemd for managing services, you should check that systemd is installed and under your user.If running `systemctl status` works, systemd is ok, but your session dbus may not be. You might need to: 174 | > 175 | > - Install the `dbus-user-session` package, and reboot if it was not installed 176 | > - Start the user dbus session with `systemctl --user enable dbus --now`. 177 | > 178 | > The error encountered was: I/O error: No such file or directory (os error 2) 179 | 180 | このメッセージが表示された場合、「環境構築手順」の「3. `sudo loginctl enable-linger ec2-user` コマンドの実行」が実施されていない可能性があります。 181 | 「環境構築手順」の「2. EC2 インスタンスへの接続」から実行し直してみてください。 182 | 183 | ### 起動時のスクリプトのログ確認手順 184 | 185 | EC2 インスタンスには、起動時のスクリプト (ユーザーデータ) で Visual Studio Code をインストールしています。 186 | 187 | `code` コマンドが見つからない場合、以下のコマンドでユーザーデータのログを確認してください。 188 | 189 | ```console 190 | cat /var/log/cloud-init-output.log 191 | ``` 192 | 193 | ### Visualt Stuido Code Server の起動状況・ログ確認手順 194 | 195 | `code` コマンドはインストールされているものの、ブラウザから Visual Studio Code に接続できない場合、以下のコマンドで Visual Studio Code Server の起動状況を確認してください。 196 | 197 | ```console 198 | code tunnel service log 199 | ``` 200 | 201 | ## 停止・削除手順 202 | 203 | 構築した開発環境を使わないときは、「EC2 インスタンスの停止」または「CloudFormation スタックの削除」により、料金を削減することができます。 204 | 205 | ### EC2 インスタンスの停止手順 206 | 207 | マネジメントコンソール上部の検索欄で「EC2」を検索して開きます。 208 | 209 | EC2 のホーム画面左のメニューから「インスタンス」を開き、EC2 インスタンスを選択して、「インスタンスの状態」から「インスタンスの停止」を実行します。 210 | 211 | ![](images/ec2-stop.png) 212 | 213 | > [!WARNING] 214 | > EC2 インスタンスを停止しても、データを保存するストレージ (EBS) は確保したままのため、ストレージの料金は発生し続けます。 215 | > 完全に料金が発生しないようにするには、次の手順で「削除」を実施する必要があります。 216 | 217 | ### CloudFormation スタックの削除手順 218 | 219 | マネジメントコンソール上部の検索欄で「CloudFormation」を検索して開きます。 220 | 221 | CloudFormation のホーム画面左のメニューから「スタック」を開き、スタックを選択して、「削除」を実行します。 222 | 223 | ![](images/cloudformation-delete.png) 224 | 225 | ## 基本操作 226 | 227 | ### ターミナルの開き方 228 | 229 | 画面左のメニューボタン (≡) をクリックし、「ターミナル」>「新しいターミナル」でターミナルを開くことができます。 230 | 231 | ![](images/vscode-terminal.png) 232 | 233 | ### ディレクトリの開き方 234 | 235 | 作業用のディレクトリは、ターミナルで `mkdir workspace` のようなコマンドで作成してください。 236 | 237 | 画面左のメニューボタン (≡) をクリックし、「ファイル」>「フォルダーを開く」で作成したディレクトリを開くことができます。 238 | 239 | ![](images/vscode-open-directory.png) 240 | 241 | ![](images/vscode-open-directory2.png) 242 | 243 | ![](images/vscode-open-directory3.png) 244 | 245 | ### ファイルのアップロード 246 | 247 | ローカルからファイルをアップロードする際は、エクスプローラー (画面左のファイルのアイコン) を開いて、エクスプローラーを右クリックして「アップロード」を選択してください。 248 | 249 | ![](images/vscode-upload-file.png) 250 | 251 | または、エクスプローラーにドラッグ & ドロップすることでもファイルをアップロードできます。 252 | 253 | ### Web アプリケーションのプレビュー (ポートの転送) 254 | 255 | ターミナル上で Web アプリケーション等を起動した場合、ターミナルの右の「ポート」のタブを開いて、「転送されたアドレス」を右クリックし、「ブラウザーで開く」をクリックすると開くことができます。または、画面右下に表示される「ブラウザーで開く」をクリックしてください。 256 | 257 | ![](images/vscode-port-forward.png) 258 | 259 | ## 各種インストール手順 260 | 261 | ### Git のインストール 262 | 263 | 以下のコマンドで Git をインストールできます。 264 | 265 | ```console 266 | sudo dnf install -y git 267 | ``` 268 | 269 | 以下のコマンドで、インストールできたことを確認してください。 270 | 271 | ```console 272 | git -v 273 | ``` 274 | 275 | ### asdf のインストール 276 | 277 | Node.js や Terraform などの特定バージョンをインストールしたい際は、[asdf](https://asdf-vm.com/) を使用すると便利です。 278 | 279 | 以下のコマンドを順に実行することで、asdf (v0.16.5) をインストールできます。 280 | 281 | ```console 282 | sudo dnf install -y git 283 | curl -sSfL https://github.com/asdf-vm/asdf/releases/download/v0.16.5/asdf-v0.16.5-linux-amd64.tar.gz -o asdf.tar.gz 284 | tar -xzf asdf.tar.gz 285 | sudo mv asdf /usr/local/bin/asdf 286 | echo 'export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"' >> ~/.bashrc 287 | echo '. <(asdf completion bash)' >> ~/.bashrc 288 | exec "$SHELL" 289 | ``` 290 | 291 | その後、以下のコマンドで asdf がインストールできたことを確認してください。 292 | 293 | ```console 294 | asdf version 295 | ``` 296 | 297 | ### Node.js のインストール 298 | 299 | asdf を使って Node.js をインストールする手順を以下に示します。 300 | 301 | まず、以下のコマンドで Node.js のインストールに必要な OS のパッケージをインストールします。 302 | 303 | ```console 304 | sudo dnf install -y python3 gcc-c++ make python3-pip 305 | ``` 306 | 307 | 参考: https://github.com/nodejs/node/blob/main/BUILDING.md#building-nodejs-on-supported-platforms 308 | 309 | 続いて、以下のコマンドで asdf の Node.js プラグインをインストールします。 310 | 311 | ```console 312 | asdf plugin add nodejs 313 | ``` 314 | 315 | 作業用のディレクトリに `.tool-versions` というファイルを作成し、インストールしたい Node.js のバージョンを以下のように記述します。 316 | 317 | ``` 318 | nodejs 20.16.0 319 | ``` 320 | 321 | ![](images/vscode-tool-versions.png) 322 | 323 | `.tool-versions` を配置したディレクトリで以下のコマンドを実行して、Node.js をインストールします。 324 | 325 | ```console 326 | asdf install 327 | ``` 328 | 329 | 以下のコマンドで、インストールできたことを確認してください。 330 | 331 | ```console 332 | node -v 333 | ``` 334 | 335 | ![](images/vscode-install-node.png) 336 | 337 | ### Terraform のインストール 338 | 339 | asdf を使って Terraform をインストールする手順を以下に示します。 340 | 341 | まず、以下のコマンドで Terraform のインストールに必要な OS のパッケージをインストールします。 342 | 343 | ```console 344 | sudo dnf -y install gnupg2 --allowerasing 345 | ``` 346 | 347 | 続いて、以下のコマンドで asdf の Terraform プラグインをインストールします。 348 | 349 | ```console 350 | asdf plugin add terraform 351 | ``` 352 | 353 | 作業用のディレクトリに `.tool-versions` というファイルを作成し、インストールしたい Terraform のバージョンを以下のように記述します。 354 | 355 | ``` 356 | terraform 1.3.8 357 | ``` 358 | 359 | `.tool-versions` を配置したディレクトリで以下のコマンドを実行して、Terraform をインストールします。 360 | 361 | ```console 362 | asdf install 363 | ``` 364 | 365 | 以下のコマンドで、インストールできたことを確認してください。 366 | 367 | ```console 368 | terraform -v 369 | ``` 370 | 371 | ### Docker のインストール 372 | 373 | 以下のコマンドで、Docker をインストールします。 374 | 375 | ```console 376 | sudo dnf update 377 | sudo dnf install -y docker 378 | ``` 379 | 380 | 以下のコマンドで Docker を起動します。 381 | 382 | ```console 383 | sudo systemctl start docker 384 | ``` 385 | 386 | 以下のコマンドで Docker コンテナの一覧を表示できます。 387 | 388 | ```console 389 | sudo docker container ls 390 | ``` 391 | 392 | 以下のようにエラーなく一覧が表示されれば、Docker のセットアップは完了です。 393 | 394 | ``` 395 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 396 | ``` 397 | 398 | > [!WARNING] 399 | > docker コマンドを sudo をつけずに実行できるようにしたい場合は、 400 | > `sudo usermod -a -G docker "$(whoami)"` コマンドを実行したうえで、 401 | > ターミナルを一度閉じて開き直してください。 402 | 403 | ## 参考リポジトリ 404 | 405 | EC2 インスタンスで Visual Studio Code Server を使用する環境の構築は、「[AWS CDK Conference Japan 2024 presented by JAWS-UG コントリビュートワークショップ](https://github.com/jaws-ug-cdk/cdk-conf-2024-contribute-workshop)」のリポジトリを参考にさせていただきました。 406 | -------------------------------------------------------------------------------- /cloud9-alternative-cloudformation.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | 3 | Parameters: 4 | InstanceType: 5 | Type: String 6 | Default: t2.micro 7 | AllowedValues: 8 | [ 9 | c4.large, 10 | c4.xlarge, 11 | c4.2xlarge, 12 | c4.4xlarge, 13 | c4.8xlarge, 14 | c5.large, 15 | c5.xlarge, 16 | c5.2xlarge, 17 | c5.4xlarge, 18 | c5.9xlarge, 19 | c5.12xlarge, 20 | c5.18xlarge, 21 | c5.24xlarge, 22 | c5a.large, 23 | c5a.xlarge, 24 | c5a.2xlarge, 25 | c5a.4xlarge, 26 | c5a.8xlarge, 27 | c5a.12xlarge, 28 | c5a.16xlarge, 29 | c5a.24xlarge, 30 | c5ad.large, 31 | c5ad.xlarge, 32 | c5ad.2xlarge, 33 | c5ad.4xlarge, 34 | c5ad.8xlarge, 35 | c5ad.12xlarge, 36 | c5ad.16xlarge, 37 | c5ad.24xlarge, 38 | c5d.large, 39 | c5d.xlarge, 40 | c5d.2xlarge, 41 | c5d.4xlarge, 42 | c5d.9xlarge, 43 | c5d.12xlarge, 44 | c5d.18xlarge, 45 | c5d.24xlarge, 46 | c5n.large, 47 | c5n.xlarge, 48 | c5n.2xlarge, 49 | c5n.4xlarge, 50 | c5n.9xlarge, 51 | c5n.18xlarge, 52 | c6a.large, 53 | c6a.xlarge, 54 | c6a.2xlarge, 55 | c6a.4xlarge, 56 | c6a.8xlarge, 57 | c6a.12xlarge, 58 | c6a.16xlarge, 59 | c6a.24xlarge, 60 | c6a.32xlarge, 61 | c6a.48xlarge, 62 | c6g.medium, 63 | c6g.large, 64 | c6g.xlarge, 65 | c6g.2xlarge, 66 | c6g.4xlarge, 67 | c6g.8xlarge, 68 | c6g.12xlarge, 69 | c6g.16xlarge, 70 | c6gd.medium, 71 | c6gd.large, 72 | c6gd.xlarge, 73 | c6gd.2xlarge, 74 | c6gd.4xlarge, 75 | c6gd.8xlarge, 76 | c6gd.12xlarge, 77 | c6gd.16xlarge, 78 | c6gn.medium, 79 | c6gn.large, 80 | c6gn.xlarge, 81 | c6gn.2xlarge, 82 | c6gn.4xlarge, 83 | c6gn.8xlarge, 84 | c6gn.12xlarge, 85 | c6gn.16xlarge, 86 | c6i.large, 87 | c6i.xlarge, 88 | c6i.2xlarge, 89 | c6i.4xlarge, 90 | c6i.8xlarge, 91 | c6i.12xlarge, 92 | c6i.16xlarge, 93 | c6i.24xlarge, 94 | c6i.32xlarge, 95 | c7g.medium, 96 | c7g.large, 97 | c7g.xlarge, 98 | c7g.2xlarge, 99 | c7g.4xlarge, 100 | c7g.8xlarge, 101 | c7g.12xlarge, 102 | c7g.16xlarge, 103 | c7gd.medium, 104 | c7gd.large, 105 | c7gd.xlarge, 106 | c7gd.2xlarge, 107 | c7gd.4xlarge, 108 | c7gd.8xlarge, 109 | c7gd.12xlarge, 110 | c7gd.16xlarge, 111 | c7gn.medium, 112 | c7gn.large, 113 | c7gn.xlarge, 114 | c7gn.2xlarge, 115 | c7gn.4xlarge, 116 | c7gn.8xlarge, 117 | c7gn.12xlarge, 118 | c7gn.16xlarge, 119 | c7i.large, 120 | c7i.xlarge, 121 | c7i.2xlarge, 122 | c7i.4xlarge, 123 | c7i.8xlarge, 124 | c7i.12xlarge, 125 | c7i.16xlarge, 126 | c7i.24xlarge, 127 | c7i.48xlarge, 128 | m4.large, 129 | m4.xlarge, 130 | m4.2xlarge, 131 | m4.4xlarge, 132 | m4.10xlarge, 133 | m4.16xlarge, 134 | m5.large, 135 | m5.xlarge, 136 | m5.2xlarge, 137 | m5.4xlarge, 138 | m5.8xlarge, 139 | m5.12xlarge, 140 | m5.16xlarge, 141 | m5.24xlarge, 142 | m5a.large, 143 | m5a.xlarge, 144 | m5a.2xlarge, 145 | m5a.4xlarge, 146 | m5a.8xlarge, 147 | m5a.12xlarge, 148 | m5a.16xlarge, 149 | m5a.24xlarge, 150 | m6a.large, 151 | m6a.xlarge, 152 | m6a.2xlarge, 153 | m6a.4xlarge, 154 | m6a.8xlarge, 155 | m6a.12xlarge, 156 | m6a.16xlarge, 157 | m6a.24xlarge, 158 | m6a.32xlarge, 159 | m6a.48xlarge, 160 | m7a.medium, 161 | m7a.large, 162 | m7a.xlarge, 163 | m7a.2xlarge, 164 | m7a.4xlarge, 165 | m7a.8xlarge, 166 | m7a.12xlarge, 167 | m7a.16xlarge, 168 | m7a.24xlarge, 169 | m7a.32xlarge, 170 | m7a.48xlarge, 171 | t2.nano, 172 | t2.micro, 173 | t2.small, 174 | t2.medium, 175 | t2.large, 176 | t2.xlarge, 177 | t2.2xlarge, 178 | t3.nano, 179 | t3.micro, 180 | t3.small, 181 | t3.medium, 182 | t3.large, 183 | t3.xlarge, 184 | t3.2xlarge, 185 | t3a.nano, 186 | t3a.micro, 187 | t3a.small, 188 | t3a.medium, 189 | t3a.large, 190 | t3a.xlarge, 191 | t3a.2xlarge, 192 | t4g.nano, 193 | t4g.micro, 194 | t4g.small, 195 | t4g.medium, 196 | t4g.large, 197 | t4g.xlarge, 198 | t4g.2xlarge 199 | ] 200 | 201 | Mappings: 202 | Constants: 203 | Ec2: 204 | ImageId: '{{resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64}}' 205 | Vpc: 206 | CidrBlock: 10.0.0.0/16 207 | PublicSubnetCidrBlock: 10.0.0.0/24 208 | 209 | Resources: 210 | Vpc: 211 | Type: AWS::EC2::VPC 212 | Properties: 213 | CidrBlock: !FindInMap [Constants, Vpc, CidrBlock] 214 | EnableDnsHostnames: true 215 | EnableDnsSupport: true 216 | Tags: 217 | - Key: Name 218 | Value: !Ref AWS::StackName 219 | VpcIgw: 220 | Type: AWS::EC2::InternetGateway 221 | VpcIgwAttachment: 222 | Type: AWS::EC2::VPCGatewayAttachment 223 | Properties: 224 | InternetGatewayId: !Ref VpcIgw 225 | VpcId: !Ref Vpc 226 | 227 | VpcPublicRouteTable: 228 | Type: AWS::EC2::RouteTable 229 | Properties: 230 | VpcId: !Ref Vpc 231 | VpcPublicRoute: 232 | Type: AWS::EC2::Route 233 | Properties: 234 | RouteTableId: !Ref VpcPublicRouteTable 235 | GatewayId: !Ref VpcIgw 236 | DestinationCidrBlock: 0.0.0.0/0 237 | DependsOn: 238 | - VpcIgwAttachment 239 | 240 | VpcPublicSubnet: 241 | Type: AWS::EC2::Subnet 242 | Properties: 243 | VpcId: !Ref Vpc 244 | CidrBlock: !FindInMap [Constants, Vpc, PublicSubnetCidrBlock] 245 | VpcPublicSubnetRouteTableAssociation: 246 | Type: AWS::EC2::SubnetRouteTableAssociation 247 | Properties: 248 | RouteTableId: !Ref VpcPublicRouteTable 249 | SubnetId: !Ref VpcPublicSubnet 250 | 251 | InstanceSecurityGroup: 252 | Type: AWS::EC2::SecurityGroup 253 | Properties: 254 | VpcId: !Ref Vpc 255 | GroupDescription: cloud9-alternative 256 | SecurityGroupEgress: 257 | - CidrIp: 0.0.0.0/0 258 | IpProtocol: -1 259 | 260 | InstanceRole: 261 | Type: AWS::IAM::Role 262 | Properties: 263 | AssumeRolePolicyDocument: 264 | Statement: 265 | - Action: sts:AssumeRole 266 | Effect: Allow 267 | Principal: 268 | Service: ec2.amazonaws.com 269 | Version: 2012-10-17 270 | ManagedPolicyArns: 271 | - !Join 272 | - '' 273 | - - 'arn:' 274 | - Ref: 'AWS::Partition' 275 | - ':iam::aws:policy/AdministratorAccess' 276 | InstanceProfile: 277 | Type: 'AWS::IAM::InstanceProfile' 278 | Properties: 279 | Roles: 280 | - !Ref InstanceRole 281 | 282 | Instance: 283 | Type: AWS::EC2::Instance 284 | Properties: 285 | ImageId: !FindInMap [Constants, Ec2, ImageId] 286 | InstanceType: !Ref InstanceType 287 | NetworkInterfaces: 288 | - SubnetId: !Ref VpcPublicSubnet 289 | AssociatePublicIpAddress: 'true' 290 | DeviceIndex: '0' 291 | GroupSet: 292 | - !Ref InstanceSecurityGroup 293 | IamInstanceProfile: !Ref InstanceProfile 294 | Tags: 295 | - Key: Name 296 | Value: !Ref AWS::StackName 297 | UserData: !Base64 | 298 | #!/bin/bash 299 | 300 | set -o errexit 301 | set -o nounset 302 | set -o pipefail 303 | set -o xtrace 304 | 305 | # Install Visual Studio Code 306 | # Reference: https://code.visualstudio.com/docs/setup/linux#_rhel-fedora-and-centos-based-distributions 307 | sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc 308 | echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null 309 | dnf check-update 310 | sudo dnf install -y code 311 | -------------------------------------------------------------------------------- /images/cloudformation-checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-checkbox.png -------------------------------------------------------------------------------- /images/cloudformation-complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-complete.png -------------------------------------------------------------------------------- /images/cloudformation-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-delete.png -------------------------------------------------------------------------------- /images/cloudformation-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-open.png -------------------------------------------------------------------------------- /images/cloudformation-stack-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-stack-name.png -------------------------------------------------------------------------------- /images/cloudformation-stacks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-stacks.png -------------------------------------------------------------------------------- /images/cloudformation-upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/cloudformation-upload.png -------------------------------------------------------------------------------- /images/ec2-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/ec2-stop.png -------------------------------------------------------------------------------- /images/ssm-ec2-user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/ssm-ec2-user.png -------------------------------------------------------------------------------- /images/ssm-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/ssm-open.png -------------------------------------------------------------------------------- /images/ssm-session-manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/ssm-session-manager.png -------------------------------------------------------------------------------- /images/ssm-start-session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/ssm-start-session.png -------------------------------------------------------------------------------- /images/ssm-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/ssm-terminal.png -------------------------------------------------------------------------------- /images/vscode-install-node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-install-node.png -------------------------------------------------------------------------------- /images/vscode-open-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-open-directory.png -------------------------------------------------------------------------------- /images/vscode-open-directory2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-open-directory2.png -------------------------------------------------------------------------------- /images/vscode-open-directory3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-open-directory3.png -------------------------------------------------------------------------------- /images/vscode-port-forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-port-forward.png -------------------------------------------------------------------------------- /images/vscode-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-terminal.png -------------------------------------------------------------------------------- /images/vscode-tool-versions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-tool-versions.png -------------------------------------------------------------------------------- /images/vscode-upload-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode-upload-file.png -------------------------------------------------------------------------------- /images/vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/os1ma/cloud9-alternative/fba856644d8dbe8e6adff9c9ad385f19b6d58311/images/vscode.png --------------------------------------------------------------------------------