【アップデート情報】Visual Studio Code ですぐに使える Serverless Land Patterns でサーバーレス開発を加速

いつも記事を読んでいただきありがとうございます！
モブエンジニア（[@mob-engineer](https://qiita.com/mob_engineer))です！

2025.03.12のアップデート情報で開発者視点で幸せになれそうなアップデート情報がありましたので、記事としてアウトプットしたいと思います。

# 目次
- アップデート概要
- Serverless Patterns Collection
- VSCode上で試してみる
- 幸せになれるポイント

## アップデート概要

概要に関しては公式ブログにまとめられていますのでそちらを引用いたします。

#### 公式ブログ

https://aws.amazon.com/about-aws/whats-new/2025/03/ready-to-use-serverless-land-patterns-vs-code-ide/

- 原文
>AWS makes it easier for developers to build serverless applications by bringing Serverless Land's extensive application pattern library directly into the Visual Studio Code (VS Code) IDE. This integration eliminates the need to switch between your development environment and external resources when building serverless architectures by enabling you to browse, search, and implement pre-built serverless patterns directly in VS Code IDE. This new feature simplifies and accelerates the process of building serverless applications using VS Code IDE.
Serverless Land provides hundreds of curated serverless application patterns covering popular use cases across AWS services like AWS Lambda, Amazon Simple Queue Service (SQS), Amazon API Gateway, AWS Step Functions, Amazon EventBridge, and many more. With Serverless Land integration in VS Code IDE, you can now use familiar VS Code interface to search and filter application patterns based on AWS services, Infrastructure as Code (IaC) frameworks, and language runtime requirements. When you find a pattern that matches your use case, you can preview the implementation details and download the pattern code directly to your workspace using the Quick Pick functionality of VS Code. This integration ensures that you now have easy access to reliable serverless application patterns which are regularly updated and align with AWS best practices, enhancing your serverless development experience.

- Google翻訳文
>AWS は、Serverless Land の広範なアプリケーションパターンライブラリを Visual Studio Code (VS Code) IDE に直接組み込むことで、開発者がサーバーレスアプリケーションを簡単に構築できるようにしています。この統合により、VS Code IDE で事前に構築されたサーバーレスパターンを直接参照、検索、実装できるため、サーバーレスアーキテクチャを構築するときに開発環境と外部リソースを切り替える必要がなくなります。この新しい機能により、VS Code IDE を使用してサーバーレスアプリケーションを構築するプロセスが簡素化され、加速されます。Serverless
Land は、AWS Lambda、Amazon Simple Queue Service (SQS)、Amazon API Gateway、AWS Step Functions、Amazon EventBridge など、AWS のサービス全体で一般的なユースケースをカバーする、厳選された数百のサーバーレスアプリケーションパターンを提供します。VS Code IDE での Serverless Land の統合により、使い慣れた VS Code インターフェイスを使用して、AWS のサービス、Infrastructure as Code (IaC) フレームワーク、言語ランタイム要件に基づいてアプリケーションパターンを検索およびフィルタリングできるようになりました。ユースケースに一致するパターンが見つかったら、VS Code のクイックピック機能を使用して、実装の詳細をプレビューし、パターンコードをワークスペースに直接ダウンロードできます。この統合により、定期的に更新され、AWS のベストプラクティスに準拠した信頼性の高いサーバーレスアプリケーションパターンに簡単にアクセスできるようになり、サーバーレス開発エクスペリエンスが向上します

すごくざっくり言えば、**VSCode上でServerless Landで提供されているアプリケーションパターンを楽に構築できるようになる**といったアップデート情報です。

## Serverless Patterns Collection

以下サイトにアクセスすることでServerless Patterns Collectionへアクセスできます。

#### ホームページ

https://serverlessland.com/patterns

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3846878/eb8dfba7-5c93-435f-b020-33494ae2ead4.png)

また、公式サイトでも学習ガイドがありますので、初学者でも**何から学べばいいのかわからない**といったお困りごとはなくなるかと思います。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3846878/b0333667-837e-4ff3-a278-3e306fcaa500.png)

ガイド内容に関しては英文ですが翻訳ツールを用いれば学習できるかと思います。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3846878/99316730-0b03-43d3-91b8-68e0b6a6c9af.png)


## VSCode上で試してみる

実際に私のVSCodeで試してみたいと思います。

今回はお試しにMQブローカーとLamdbaのアーキテクチャパターンを試してみたいと思います。

https://serverlessland.com/patterns/activemq-lambda
https://github.com/aws-samples/serverless-patterns/tree/main/activemq-lambda

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3846878/3e5c8af7-e00a-462c-b272-95c26ecf5e5d.png)

https://serverlessland.com/patterns/activemq-lambda

:::note info
AWS ToolkitをインストールしたらAmazon QがVS Code上で利用できるようですね。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3846878/8effcfaa-964b-46ef-bf3c-b55cb19410b3.png)
:::

とりあえず手順に従ってGit Cloneしてみます。

```
git clone https://github.com/aws-samples/serverless-patterns/ 
cd serverless-patterns/activemq-lambda
```

無事インストールされました。

```
[ec2-user@ip-10-0-0-47 ~]$ git clone https://github.com/aws-samples/serverless-patterns/ 
cd serverless-patterns/activemq-lambda
Cloning into 'serverless-patterns'...
remote: Enumerating objects: 46656, done.
remote: Counting objects: 100% (430/430), done.
remote: Compressing objects: 100% (160/160), done.
remote: Total 46656 (delta 360), reused 273 (delta 268), pack-reused 46226 (from 4)
Receiving objects: 100% (46656/46656), 531.32 MiB | 23.51 MiB/s, done.
Resolving deltas: 100% (21446/21446), done.
Updating files: 100% (12158/12158), done.
[ec2-user@ip-10-0-0-47 activemq-lambda]$ 
```

次に、デプロイコマンドを実行しましょう。

```
sam deploy
```

実行したところ、samコマンドを認識しないといったエラーが表示されました。

```
[ec2-user@ip-10-0-0-47 activemq-lambda]$ sam deploy
bash: sam: command not found
```

調べてみたところ、**pip install aws-sam-cli**を通じてインストール必要があるようなのでインストールしてみたいと思います

```
[ec2-user@ip-10-0-0-47 activemq-lambda]$ pip install aws-sam-cli
Defaulting to user installation because normal site-packages is not writeable
Collecting aws-sam-cli
  Downloading aws_sam_cli-1.135.0-py3-none-any.whl (6.1 MB)
     |████████████████████████████████| 6.1 MB 11.4 MB/s            
Collecting docker~=7.1.0
  Downloading docker-7.1.0-py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 141.7 MB/s            
Collecting dateparser~=1.2
  Downloading dateparser-1.2.1-py3-none-any.whl (295 kB)
     |████████████████████████████████| 295 kB 134.2 MB/s            
Collecting pyopenssl~=24.3.0
  Downloading pyOpenSSL-24.3.0-py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 16.0 MB/s             
Collecting tomlkit==0.13.2
  Downloading tomlkit-0.13.2-py3-none-any.whl (37 kB)
Collecting boto3<2,>=1.29.2
  Downloading boto3-1.37.11-py3-none-any.whl (139 kB)
     |████████████████████████████████| 139 kB 132.5 MB/s            
Collecting Flask<3.2
  Downloading flask-3.1.0-py3-none-any.whl (102 kB)
     |████████████████████████████████| 102 kB 146.1 MB/s            
Collecting tzlocal==5.2
  Downloading tzlocal-5.2-py3-none-any.whl (17 kB)
Collecting PyYAML~=6.0
  Downloading PyYAML-6.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (720 kB)
     |████████████████████████████████| 720 kB 129.9 MB/s            
Collecting ruamel_yaml~=0.18.6
  Downloading ruamel.yaml-0.18.10-py3-none-any.whl (117 kB)
     |████████████████████████████████| 117 kB 140.2 MB/s            
Collecting click~=8.1
  Downloading click-8.1.8-py3-none-any.whl (98 kB)
     |████████████████████████████████| 98 kB 23.1 MB/s             
Collecting aws_lambda_builders==1.53.0
  Downloading aws_lambda_builders-1.53.0-py3-none-any.whl (131 kB)
     |████████████████████████████████| 131 kB 143.5 MB/s            
Collecting cookiecutter~=2.6.0
  Downloading cookiecutter-2.6.0-py3-none-any.whl (39 kB)
Collecting typing_extensions<5,>=4.4.0
  Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Requirement already satisfied: chevron~=0.12 in /usr/lib/python3.9/site-packages (from aws-sam-cli) (0.13.1)
Collecting rich~=13.9.4
  Downloading rich-13.9.4-py3-none-any.whl (242 kB)
     |████████████████████████████████| 242 kB 46.1 MB/s            
Collecting cfn-lint~=1.25.1
  Downloading cfn_lint-1.25.1-py3-none-any.whl (4.9 MB)
     |████████████████████████████████| 4.9 MB 119.2 MB/s            
Collecting aws-sam-translator==1.95.0
  Downloading aws_sam_translator-1.95.0-py3-none-any.whl (385 kB)
     |████████████████████████████████| 385 kB 17.3 MB/s            
Collecting regex!=2021.10.8
  Downloading regex-2024.11.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (782 kB)
     |████████████████████████████████| 782 kB 17.8 MB/s            
Requirement already satisfied: jsonschema<4.24 in /usr/lib/python3.9/site-packages (from aws-sam-cli) (3.2.0)
Collecting requests~=2.32.3
  Downloading requests-2.32.3-py3-none-any.whl (64 kB)
     |████████████████████████████████| 64 kB 6.7 MB/s             
Collecting boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.35.71
  Downloading boto3_stubs-1.35.71-py3-none-any.whl (62 kB)
     |████████████████████████████████| 62 kB 3.4 MB/s             
Collecting jmespath~=1.0.1
  Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)
Collecting watchdog==4.0.2
  Downloading watchdog-4.0.2-py3-none-manylinux2014_aarch64.whl (82 kB)
     |████████████████████████████████| 82 kB 2.6 MB/s             
Requirement already satisfied: setuptools in /usr/lib/python3.9/site-packages (from aws_lambda_builders==1.53.0->aws-sam-cli) (59.6.0)
Collecting wheel
  Downloading wheel-0.45.1-py3-none-any.whl (72 kB)
     |████████████████████████████████| 72 kB 2.0 MB/s             
Collecting pydantic!=1.10.15,!=1.10.17,<3,>=1.8
  Downloading pydantic-2.10.6-py3-none-any.whl (431 kB)
     |████████████████████████████████| 431 kB 30.9 MB/s            
Collecting botocore<1.38.0,>=1.37.11
  Downloading botocore-1.37.11-py3-none-any.whl (13.4 MB)
     |████████████████████████████████| 13.4 MB 32.0 MB/s            
Collecting s3transfer<0.12.0,>=0.11.0
  Downloading s3transfer-0.11.4-py3-none-any.whl (84 kB)
     |████████████████████████████████| 84 kB 10.0 MB/s             
Collecting types-s3transfer
  Downloading types_s3transfer-0.11.4-py3-none-any.whl (19 kB)
Collecting botocore-stubs
  Downloading botocore_stubs-1.37.11-py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 13.8 MB/s             
Collecting mypy-boto3-cloudformation<1.36.0,>=1.35.0
  Downloading mypy_boto3_cloudformation-1.35.93-py3-none-any.whl (66 kB)
     |████████████████████████████████| 66 kB 11.7 MB/s            
Collecting mypy-boto3-kinesis<1.36.0,>=1.35.0
  Downloading mypy_boto3_kinesis-1.35.93-py3-none-any.whl (32 kB)
Collecting mypy-boto3-s3<1.36.0,>=1.35.0
  Downloading mypy_boto3_s3-1.35.93-py3-none-any.whl (79 kB)
     |████████████████████████████████| 79 kB 23.8 MB/s             
Collecting mypy-boto3-signer<1.36.0,>=1.35.0
  Downloading mypy_boto3_signer-1.35.93-py3-none-any.whl (28 kB)
Collecting mypy-boto3-stepfunctions<1.36.0,>=1.35.0
  Downloading mypy_boto3_stepfunctions-1.35.93-py3-none-any.whl (35 kB)
Collecting mypy-boto3-xray<1.36.0,>=1.35.0
  Downloading mypy_boto3_xray-1.35.93-py3-none-any.whl (36 kB)
Collecting mypy-boto3-ecr<1.36.0,>=1.35.0
  Downloading mypy_boto3_ecr-1.35.93-py3-none-any.whl (39 kB)
Collecting mypy-boto3-schemas<1.36.0,>=1.35.0
  Downloading mypy_boto3_schemas-1.35.93-py3-none-any.whl (28 kB)
Collecting mypy-boto3-secretsmanager<1.36.0,>=1.35.0
  Downloading mypy_boto3_secretsmanager-1.35.93-py3-none-any.whl (26 kB)
Collecting mypy-boto3-apigateway<1.36.0,>=1.35.0
  Downloading mypy_boto3_apigateway-1.35.93-py3-none-any.whl (50 kB)
     |████████████████████████████████| 50 kB 21.1 MB/s             
Collecting mypy-boto3-sqs<1.36.0,>=1.35.0
  Downloading mypy_boto3_sqs-1.35.93-py3-none-any.whl (33 kB)
Collecting mypy-boto3-iam<1.36.0,>=1.35.0
  Downloading mypy_boto3_iam-1.35.93-py3-none-any.whl (91 kB)
     |████████████████████████████████| 91 kB 26.1 MB/s             
Collecting mypy-boto3-lambda<1.36.0,>=1.35.0
  Downloading mypy_boto3_lambda-1.35.93-py3-none-any.whl (47 kB)
     |████████████████████████████████| 47 kB 12.2 MB/s             
Collecting mypy-boto3-sts<1.36.0,>=1.35.0
  Downloading mypy_boto3_sts-1.35.97-py3-none-any.whl (19 kB)
Collecting sympy>=1.0.0
  Downloading sympy-1.13.3-py3-none-any.whl (6.2 MB)
     |████████████████████████████████| 6.2 MB 70.3 MB/s            
Requirement already satisfied: jsonpatch in /usr/lib/python3.9/site-packages (from cfn-lint~=1.25.1->aws-sam-cli) (1.21)
Collecting networkx<4,>=2.4
  Downloading networkx-3.2.1-py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 147.0 MB/s            
Collecting binaryornot>=0.4.4
  Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
Collecting arrow
  Downloading arrow-1.3.0-py3-none-any.whl (66 kB)
     |████████████████████████████████| 66 kB 13.5 MB/s             
Requirement already satisfied: Jinja2<4.0.0,>=2.7 in /usr/lib/python3.9/site-packages (from cookiecutter~=2.6.0->aws-sam-cli) (2.11.3)
Collecting python-slugify>=4.0.0
  Downloading python_slugify-8.0.4-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: python-dateutil>=2.7.0 in /usr/lib/python3.9/site-packages (from dateparser~=1.2->aws-sam-cli) (2.8.1)
Collecting pytz>=2024.2
  Downloading pytz-2025.1-py2.py3-none-any.whl (507 kB)
     |████████████████████████████████| 507 kB 147.2 MB/s            
Collecting urllib3>=1.26.0
  Downloading urllib3-2.3.0-py3-none-any.whl (128 kB)
     |████████████████████████████████| 128 kB 147.3 MB/s            
Collecting Werkzeug>=3.1
  Downloading werkzeug-3.1.3-py3-none-any.whl (224 kB)
     |████████████████████████████████| 224 kB 149.2 MB/s            
Collecting itsdangerous>=2.2
  Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Collecting Jinja2<4.0.0,>=2.7
  Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
     |████████████████████████████████| 134 kB 148.0 MB/s            
Collecting blinker>=1.9
  Downloading blinker-1.9.0-py3-none-any.whl (8.5 kB)
Collecting importlib-metadata>=3.6
  Downloading importlib_metadata-8.6.1-py3-none-any.whl (26 kB)
Requirement already satisfied: attrs>=17.4.0 in /usr/lib/python3.9/site-packages (from jsonschema<4.24->aws-sam-cli) (20.3.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/lib64/python3.9/site-packages (from jsonschema<4.24->aws-sam-cli) (0.17.3)
Requirement already satisfied: six>=1.11.0 in /usr/lib/python3.9/site-packages (from jsonschema<4.24->aws-sam-cli) (1.15.0)
Collecting cryptography<45,>=41.0.5
  Downloading cryptography-44.0.2-cp39-abi3-manylinux_2_34_aarch64.whl (4.0 MB)
     |████████████████████████████████| 4.0 MB 140.3 MB/s            
Collecting certifi>=2017.4.17
  Downloading certifi-2025.1.31-py3-none-any.whl (166 kB)
     |████████████████████████████████| 166 kB 37.0 MB/s            
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (141 kB)
     |████████████████████████████████| 141 kB 143.7 MB/s            
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3.9/site-packages (from requests~=2.32.3->aws-sam-cli) (2.10)
Collecting markdown-it-py>=2.2.0
  Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
     |████████████████████████████████| 87 kB 15.8 MB/s             
Collecting pygments<3.0.0,>=2.13.0
  Downloading pygments-2.19.1-py3-none-any.whl (1.2 MB)
     |████████████████████████████████| 1.2 MB 148.3 MB/s            
Collecting ruamel.yaml.clib>=0.2.7
  Downloading ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux2014_aarch64.whl (636 kB)
     |████████████████████████████████| 636 kB 81.5 MB/s            
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.9/site-packages (from binaryornot>=0.4.4->cookiecutter~=2.6.0->aws-sam-cli) (4.0.0)
Collecting urllib3>=1.26.0
  Downloading urllib3-1.26.20-py2.py3-none-any.whl (144 kB)
     |████████████████████████████████| 144 kB 147.8 MB/s            
Requirement already satisfied: cffi>=1.12 in /usr/lib64/python3.9/site-packages (from cryptography<45,>=41.0.5->pyopenssl~=24.3.0->aws-sam-cli) (1.14.5)
Collecting zipp>=3.20
  Downloading zipp-3.21.0-py3-none-any.whl (9.6 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (21 kB)
Collecting mdurl~=0.1
  Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting pydantic-core==2.27.2
  Downloading pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB)
     |████████████████████████████████| 1.8 MB 72.6 MB/s            
Collecting annotated-types>=0.6.0
  Downloading annotated_types-0.7.0-py3-none-any.whl (13 kB)
Collecting text-unidecode>=1.3
  Downloading text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
     |████████████████████████████████| 78 kB 14.1 MB/s             
Collecting mpmath<1.4,>=1.1.0
  Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
     |████████████████████████████████| 536 kB 129.6 MB/s            
Collecting types-python-dateutil>=2.8.10
  Downloading types_python_dateutil-2.9.0.20241206-py3-none-any.whl (14 kB)
Collecting types-awscrt
  Downloading types_awscrt-0.24.1-py3-none-any.whl (19 kB)
Requirement already satisfied: jsonpointer>=1.9 in /usr/lib/python3.9/site-packages (from jsonpatch->cfn-lint~=1.25.1->aws-sam-cli) (2.0)
Requirement already satisfied: pycparser in /usr/lib/python3.9/site-packages (from cffi>=1.12->cryptography<45,>=41.0.5->pyopenssl~=24.3.0->aws-sam-cli) (2.20)
Requirement already satisfied: ply==3.11 in /usr/lib/python3.9/site-packages (from pycparser->cffi>=1.12->cryptography<45,>=41.0.5->pyopenssl~=24.3.0->aws-sam-cli) (3.11)
Installing collected packages: urllib3, jmespath, typing-extensions, botocore, types-awscrt, s3transfer, pydantic-core, mdurl, annotated-types, zipp, types-s3transfer, types-python-dateutil, text-unidecode, pygments, pydantic, mpmath, MarkupSafe, markdown-it-py, charset-normalizer, certifi, botocore-stubs, boto3, wheel, Werkzeug, tzlocal, sympy, ruamel.yaml.clib, rich, requests, regex, PyYAML, pytz, python-slugify, networkx, mypy-boto3-xray, mypy-boto3-sts, mypy-boto3-stepfunctions, mypy-boto3-sqs, mypy-boto3-signer, mypy-boto3-secretsmanager, mypy-boto3-schemas, mypy-boto3-s3, mypy-boto3-lambda, mypy-boto3-kinesis, mypy-boto3-iam, mypy-boto3-ecr, mypy-boto3-cloudformation, mypy-boto3-apigateway, Jinja2, itsdangerous, importlib-metadata, cryptography, click, boto3-stubs, blinker, binaryornot, aws-sam-translator, arrow, watchdog, tomlkit, ruamel-yaml, pyopenssl, Flask, docker, dateparser, cookiecutter, cfn-lint, aws-lambda-builders, aws-sam-cli
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
awscli 2.17.18 requires cryptography<40.0.2,>=3.3.2, but you have cryptography 44.0.2 which is incompatible.
awscli 2.17.18 requires ruamel.yaml<=0.17.21,>=0.15.0, but you have ruamel-yaml 0.18.10 which is incompatible.
Successfully installed Flask-3.1.0 Jinja2-3.1.6 MarkupSafe-3.0.2 PyYAML-6.0.2 Werkzeug-3.1.3 annotated-types-0.7.0 arrow-1.3.0 aws-lambda-builders-1.53.0 aws-sam-cli-1.135.0 aws-sam-translator-1.95.0 binaryornot-0.4.4 blinker-1.9.0 boto3-1.37.11 boto3-stubs-1.35.71 botocore-1.37.11 botocore-stubs-1.37.11 certifi-2025.1.31 cfn-lint-1.25.1 charset-normalizer-3.4.1 click-8.1.8 cookiecutter-2.6.0 cryptography-44.0.2 dateparser-1.2.1 docker-7.1.0 importlib-metadata-8.6.1 itsdangerous-2.2.0 jmespath-1.0.1 markdown-it-py-3.0.0 mdurl-0.1.2 mpmath-1.3.0 mypy-boto3-apigateway-1.35.93 mypy-boto3-cloudformation-1.35.93 mypy-boto3-ecr-1.35.93 mypy-boto3-iam-1.35.93 mypy-boto3-kinesis-1.35.93 mypy-boto3-lambda-1.35.93 mypy-boto3-s3-1.35.93 mypy-boto3-schemas-1.35.93 mypy-boto3-secretsmanager-1.35.93 mypy-boto3-signer-1.35.93 mypy-boto3-sqs-1.35.93 mypy-boto3-stepfunctions-1.35.93 mypy-boto3-sts-1.35.97 mypy-boto3-xray-1.35.93 networkx-3.2.1 pydantic-2.10.6 pydantic-core-2.27.2 pygments-2.19.1 pyopenssl-24.3.0 python-slugify-8.0.4 pytz-2025.1 regex-2024.11.6 requests-2.32.3 rich-13.9.4 ruamel-yaml-0.18.10 ruamel.yaml.clib-0.2.12 s3transfer-0.11.4 sympy-1.13.3 text-unidecode-1.3 tomlkit-0.13.2 types-awscrt-0.24.1 types-python-dateutil-2.9.0.20241206 types-s3transfer-0.11.4 typing-extensions-4.12.2 tzlocal-5.2 urllib3-1.26.20 watchdog-4.0.2 wheel-0.45.1 zipp-3.21.0
[ec2-user@ip-10-0-0-47 activemq-lambda]$ 
```

ログを見る限り正常にインストールできたようですね。
改めて、デプロイを実行してみたいと思います。

```
[ec2-user@ip-10-0-0-47 activemq-lambda]$ sam deploy

        SAM CLI now collects telemetry to better understand customer needs.

        You can OPT OUT and disable telemetry collection by setting the
        environment variable SAM_CLI_TELEMETRY=0 in your shell.
        Thanks for your help!

        Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html

Usage: sam deploy [OPTIONS]
Try 'sam deploy -h' for help.

Error: Missing option '--stack-name', 'sam deploy --guided' can be used to provide and save needed parameters for future deploys.
```

どうも、--guided引数を指定しないとうまく実行できないようですね。
--guided引数を指定して実行したいと思います。

```
[ec2-user@ip-10-0-0-47 activemq-lambda]$ sam deploy

        SAM CLI now collects telemetry to better understand customer needs.

        You can OPT OUT and disable telemetry collection by setting the
        environment variable SAM_CLI_TELEMETRY=0 in your shell.
        Thanks for your help!

        Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html

Usage: sam deploy [OPTIONS]
Try 'sam deploy -h' for help.

Error: Missing option '--stack-name', 'sam deploy --guided' can be used to provide and save needed parameters for future deploys.
[ec2-user@ip-10-0-0-47 activemq-lambda]$ sam deploy --guided

Configuring SAM deploy
======================

        Looking for config file [samconfig.toml] :  Not found

        Setting default arguments for 'sam deploy'
        =========================================
        Stack Name [sam-app]: test
        AWS Region [us-east-1]: ap-northeast-1                                                                        
        Parameter SecretARN [arn:aws:secretsmanager:us-east-1:733304292857:secret:mq_secret_01-9T06KM]: 
        Parameter SecretName [mq_secret_01]: 
        Parameter MQVpcId [vpc-0d465ccd5c4b66bba]: 
        Parameter MQSubnetId [subnet-08220300a8cdd8635]: 
        #Shows you resources changes to be deployed and require a 'Y' to initiate deploy
        Confirm changes before deploy [y/N]: y
        #SAM needs permission to be able to create roles to connect to the resources in your template
        Allow SAM CLI IAM role creation [Y/n]: Y
        #Preserves the state of previously provisioned resources when an operation fails
        Disable rollback [y/N]: y
        Save arguments to configuration file [Y/n]: 
        SAM configuration file [samconfig.toml]: 
        SAM configuration environment [default]: 

        Looking for resources needed for deployment:
        Creating the required resources...
        Successfully created!

        Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-4ml4sexenajj
        A different default S3 bucket can be set in samconfig.toml and auto resolution of buckets turned off by setting resolve_s3=False

        Saved arguments to config file
        Running 'sam deploy' for future deployments will use the parameters saved above.
        The above parameters can be changed by modifying samconfig.toml
        Learn more about samconfig.toml syntax at 
        https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html

        Uploading to test/f546434e70499c69467fad03bc8cf6af  494 / 494  (100.00%)

        Deploying with following values
        ===============================
        Stack name                   : test
        Region                       : ap-northeast-1
        Confirm changeset            : True
        Disable rollback             : True
        Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-4ml4sexenajj
        Capabilities                 : ["CAPABILITY_IAM"]
        Parameter overrides          : {"SecretARN": "arn:aws:secretsmanager:us-east-1:733304292857:secret:mq_secret_01-9T06KM", "SecretName": "mq_secret_01", "MQVpcId": "vpc-0d465ccd5c4b66bba", "MQSubnetId": "subnet-08220300a8cdd8635"}
        Signing Profiles             : {}

Initiating deployment
=====================

        Uploading to test/cfc2d4919c00bcca50893394a5f474d3.template  3614 / 3614  (100.00%)


Waiting for changeset to be created..

CloudFormation stack changeset
---------------------------------------------------------------------------------------------------------------------
Operation                     LogicalResourceId             ResourceType                  Replacement                 
---------------------------------------------------------------------------------------------------------------------
+ Add                         MQBroker                      AWS::AmazonMQ::Broker         N/A                         
+ Add                         MQListenerFunctionMQEvent     AWS::Lambda::EventSourceMap   N/A                         
                                                            ping                                                      
+ Add                         MQListenerFunctionRole        AWS::IAM::Role                N/A                         
+ Add                         MQListenerFunction            AWS::Lambda::Function         N/A                         
+ Add                         MQSecurityGroup               AWS::EC2::SecurityGroup       N/A                         
---------------------------------------------------------------------------------------------------------------------


Changeset created successfully. arn:aws:cloudformation:ap-northeast-1:952307266115:changeSet/samcli-deploy1741735765/e90e7910-e024-4cb9-90d5-35c02f3dd181


Previewing CloudFormation changeset before deployment
======================================================
Deploy this changeset? [y/N]: y

2025-03-11 23:29:37 - Waiting for stack create/update to complete

CloudFormation events from stack operations (refresh every 5.0 seconds)
---------------------------------------------------------------------------------------------------------------------
ResourceStatus                ResourceType                  LogicalResourceId             ResourceStatusReason        
---------------------------------------------------------------------------------------------------------------------
CREATE_IN_PROGRESS            AWS::CloudFormation::Stack    test                          User Initiated              
CREATE_IN_PROGRESS            AWS::EC2::SecurityGroup       MQSecurityGroup               -                           
CREATE_FAILED                 AWS::EC2::SecurityGroup       MQSecurityGroup               Resource handler returned   
                                                                                          message: "The vpc ID        
                                                                                          'vpc-0d465ccd5c4b66bba'     
                                                                                          does not exist (Service:    
                                                                                          Ec2, Status Code: 400,      
                                                                                          Request ID:                 
                                                                                          3d92acf8-8bdb-45fd-         
                                                                                          afe5-b980ff66426b) (SDK     
                                                                                          Attempt Count: 1)"          
                                                                                          (RequestToken: fb01e426-ad0 
                                                                                          b-3d83-2bb7-25512824acb5,   
                                                                                          HandlerErrorCode:           
                                                                                          InvalidRequest)             
CREATE_FAILED                 AWS::CloudFormation::Stack    test                          The following resource(s)   
                                                                                          failed to create:           
                                                                                          [MQSecurityGroup].          
---------------------------------------------------------------------------------------------------------------------

                                                                                                                          
Failed to deploy. Automatic rollback disabled for this deployment.                                                        
                                                                                                                          
Actions you can take next                                                                                                 
=========================                                                                                                 
[*] Fix issues and try deploying again                                                                                    
[*] Roll back stack to the last known stable state: aws cloudformation rollback-stack --stack-name test                   
                                                                                                                          
Error: Failed to create/update the stack: test, Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "CREATE_FAILED" at least once
```

成功していないようですね。おそらくコンソール側の権限問題な気がするので、今後触ってみて調査してみたいと思います。

## 幸せになれるポイント

今回の検証は失敗に終わってしまいましたが、個人的に触ってみて幸せになれるポイントとしていくつかあると思いました。

- よく用いられるパターンに関してコードで管理が行える
    - インフラロールだけでなく開発者ロールでもインフラを楽に扱える
- 構成管理を楽に行える
    - 不要になったらコマンド1発で削除ができるため、構成管理のわずらわしさが少ない
- コミュニティとしても盛り上がっている
    - ざっと見たか限り900種類以上のアーキテクチャパターンがそろっているためコミュニティとしては盛り上がっている
    - 学習ガイド・技術ブログなどのページもあるので初学者でも触りやすい環境が整っている

個人的に本サイトで掲載されているパターンをアレンジすることでオリジナルのアーキテクチャを**簡単に**開発できるのではないかと思いました。

そのうえで、今回のアップデートでVSCode民が利用しやすくなった印象を持ちました。
個人的には注目すべき取り組みだと思いましたので継続してウォッチしていきたいと思います。
（今回試したアーキテクチャパターンのコードを見ましたがそこまで複雑でないので、1か月くらいで製造までできる印象を持ちました）

最後までお読みいただきありがとうございました！！

## 参考サイト

https://aws.amazon.com/jp/serverless/patterns/serverless-pattern/
https://www.youtube.com/watch?v=hNUDGh0W6h0