[Elastic Beanstalk]502 Bad Gatewayの原因はファイル名ミス

## 概要
Elastic Beanstalkのチュートリアルをしていたら502 Bad Gatewayに遭遇。
原因は `application.py` とすべきところを `applications.py` にしていただけだった。

## チュートリアルの内容
https://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/create-deploy-python-flask.html#python-flask-setup-venv


## 事の顛末

##### 1. eb initを実行して、初期設定する
```
eb init -p python-3.7 flask-tutorial --region us-east-2
```

##### 2. もう一度初期化する
```
eb init
```

##### 3. アプリケーションをデプロイする
```
eb create flask-env
```

##### 4. eb openでWebサイトを開く
```
eb open
```

##### 5. Hello World!が出るはずが、502 Bad Gateway
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1741372/a5b1c72a-9cc0-1aff-8f87-8fbd9aad6006.png)

##### 6. Consoleからログを見に行く

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1741372/51964d96-ac92-b0a6-2a0d-ae0613720fdd.png)

このログ出すのにすごい時間かかった。
コマンドで出したい


```エラーログ
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
(省略)
Nov 27 08:29:02 ip-172-31-31-70 web[3633]: [2023-11-27 08:29:02 +0000] [3633] [INFO] Starting gunicorn 21.2.0
Nov 27 08:29:02 ip-172-31-31-70 web[3633]: [2023-11-27 08:29:02 +0000] [3633] [INFO] Listening at: http://127.0.0.1:8000 (3633)
Nov 27 08:29:02 ip-172-31-31-70 web[3633]: [2023-11-27 08:29:02 +0000] [3633] [INFO] Using worker: gthread
Nov 27 08:29:02 ip-172-31-31-70 web[3637]: [2023-11-27 08:29:02 +0000] [3637] [INFO] Booting worker with pid: 3637
Nov 27 08:29:02 ip-172-31-31-70 web[3637]: [2023-11-27 08:29:02 +0000] [3637] [ERROR] Exception in worker process
Nov 27 08:29:02 ip-172-31-31-70 web[3637]: Traceback (most recent call last):
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    worker.init_process()
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/workers/gthread.py", line 95, in init_process
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    super().init_process()
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    self.load_wsgi()
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    self.wsgi = self.app.wsgi()
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:                ^^^^^^^^^^^^^^^
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    self.callable = self.load()
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:                    ^^^^^^^^^^^
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    return self.load_wsgiapp()
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:           ^^^^^^^^^^^^^^^^^^^
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    return util.import_app(self.app_uri)
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/var/app/venv/staging-LQM1lest/lib64/python3.11/site-packages/gunicorn/util.py", line 371, in import_app
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    mod = importlib.import_module(module)
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:    return _bootstrap._gcd_import(name[level:], package, level)
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Nov 27 08:29:02 ip-172-31-31-70 web[3637]:  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
Nov 27 08:29:02 ip-172-31-31-70 web[3637]: ModuleNotFoundError: No module named 'application'
Nov 27 08:29:02 ip-172-31-31-70 web[3637]: [2023-11-27 08:29:02 +0000] [3637] [INFO] Worker exiting (pid: 3637)
Nov 27 08:29:02 ip-172-31-31-70 web[3633]: [2023-11-27 08:29:02 +0000] [3633] [ERROR] Worker (pid:3637) exited with code 3
Nov 27 08:29:02 ip-172-31-31-70 web[3633]: [2023-11-27 08:29:02 +0000] [3633] [ERROR] Shutting down: Master
Nov 27 08:29:02 ip-172-31-31-70 web[3633]: [2023-11-27 08:29:02 +0000] [3633] [ERROR] Reason: Worker failed to boot.
```
+ `^^^^^^^^^^^^^`←こういうのが出たら、そもそもファイルが読み込めてないっていう意味だという経験則
+ 読み進めると`ModuleNotFoundError: No module named 'application'`とある
+ ここで「`applications.py`って入力したな…」と記憶が蘇る
+ 見に行くと案の定
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1741372/66ad2d7e-a245-1d87-993a-fd65a4eb6a4d.png)

##### 7. ファイル名を変更して解決！
ファイル名変更→`eb init`→`eb deploy`→`eb open`
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1741372/5b83ef8e-43c1-28fc-d442-21f441f222e6.png)