2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Kiro(Amazon Q Developer)でCI/CDパイプラインを自然言語だけで構築してみた

2
Last updated at Posted at 2025-12-11

はじめに

Kiro(Amazon Q Developer CLI)とは

Kiro(Amazon Q Developer CLIは2025年11月から「Kiro」にリブランドされました。)は、AWSが提供するAI駆動の開発アシスタントです。ターミナルから自然言語で指示を出すだけで、コードの生成からAWSリソースの設定、CI/CDパイプラインの構築まで、様々な開発タスクを自動化してくれます。

「自然言語でCI/CD構築」の魅力

従来、CI/CDパイプラインを構築するには:

  • GitHub ActionsのYAML記法を学習
  • AWSのS3、IAMの権限設定を理解
  • デプロイスクリプトの作成

など、多くの知識と時間が必要でした。
しかしKiroを使えば、「このアプリをS3にデプロイするCI/CDを作って」と一言伝えるだけで、必要なファイルの生成から設定まで、すべて自動化できます。

この記事で試すこと

本記事では、Kiroを使って以下を実現します:

  • Reactアプリケーションの作成
  • GitHub Actionsを使ったCI/CDパイプラインの構築
  • AWS S3への自動デプロイ

環境準備(mac)

kiro-cliをインストール

curl -fsSL https://cli.kiro.dev/install | bash

インストール確認
表示されるログに従いkiro-cliを実行、ブラウザでログイン
スクリーンショット 2025-12-07 11.22.14.png
スクリーンショット 2025-12-07 11.21.25.png

実践

アプリの作成

S3にアップロードするためのReactのサンプルアプリを作ります。
入力したプロンプトは以下です。

kiro chat "Create a React app with Vite that has:
- A homepage with a header and main content
- Some styling with Tailwind CSS
- A sample component
Set up the complete project structure for me."

kiroがこれから実行するコマンドを教えた上で、確認を取ってくれます。
問題ないので"t"を入力しました。
スクリーンショット 2025-12-07 11.42.18.png
アプリの作成が完了し、localhostで立ち上がったようです。
スクリーンショット 2025-12-07 11.39.21.png

localhost:5173にアクセスするとこのようなサンプルアプリの画面が見られました!
スクリーンショット 2025-12-07 11.31.44.png

CI/CDパイプラインの作成

次に、このReactアプリをS3にデプロイするGitHub Actionsのワークフローを作ってもらいましょう。
入力したプロンプトは以下です。

kiro chat "Set up git and create a CI/CD pipeline to deploy this React app to S3"

kiroがGitリポジトリの初期化とCI/CDパイプラインの構築をやってくれました。

Git Setup:
- Initialized Git repository
- Created initial commit with all project files

CI/CD Pipeline:
- GitHub Actions workflow at .github/workflows/deploy.yml
- Automatically deploys to S3 on push to main branch
- Includes optional CloudFront cache invalidation

スクリーンショット 2025-12-07 11.53.06.png
スクリーンショット 2025-12-07 11.53.17.png
スクリーンショット 2025-12-07 11.53.24.png

S3バケットの作成

次に、S3バケットを作成します。
Kiroが教えてくれたNext Stepsに従って、プロンプトを考えます。
Next Stepsは以下です。

Next Steps:

1. Create an S3 bucket and configure it for static website hosting
2. Add GitHub repository secrets (AWS credentials, bucket name, region)
3. Push to GitHub to trigger automatic deployment

プロンプトは以下のようにしました。

kiro chat "Set up everything needed for deployment:
1. Create and configure an S3 bucket for static website hosting
2. Set up the bucket policy for public access
3. Generate the AWS CLI commands I need to run
4. Tell me what GitHub secrets I need to add"

Kiroが作成してくれたsetup-deployment.shを実行させましょう。

kiro chat "Run the setup-deployment.sh script to create the S3 bucket and configure it"

スクリーンショット 2025-12-07 12.25.06.png

S3バケットは作成されたようですが、URLにアクセスしても404NotFoundが出てしまいました。
スクリーンショット 2025-12-07 12.07.46.png

これはGitHubリポジトリをまだ作成していないためです。
GitHubリポジトリを作成し、コードをpushしましょう。

kiro chat "Create a new GitHub repository for this project and push the code to it"

スクリーンショット 2025-12-07 12.26.59.png
リポジトリの作成とコードのpushに成功しましたが、これだけではまだアプリのデプロイに失敗してしまいます。
Github ActionsにSecretsを登録する必要があります。
しかし、Access Key IDとSecret Access Keyを取得するために、IAMユーザーを新しく作成しましょう。

kiro chat "Guide me through creating a new IAM user with permissions for S3 deployment via GitHub Actions"

スクリーンショット 2025-12-07 12.23.26.png
新しいIAMユーザーが作成され、Access Key IDとSecret Access Keyも発行されました。
E7866311-716A-4927-8E75-7E49C7CF0D89.jpg

AWSの認証情報(Access KeyとSecret Key)は機密情報なので、手動で追加します。
githubのsettings/secrets/actionsのNew repository secretというボタンから登録します。
スクリーンショット 2025-12-07 12.21.38.png

これでデプロイ準備は完了です!
ActionsのRe-run all jobsボタンを押してもう一度実行すると
スクリーンショット 2025-12-07 12.21.15.png

アクセスできるようになりました!
スクリーンショット 2025-12-07 12.21.01.png

アプリを更新し、s3に再度アップロード

コードを更新し、自動デプロイをさせます。

kiro chat "Update the homepage to add a colorful header that says 'Deployed with Kiro!', then commit the changes and push to GitHub to trigger automatic deployment"

もう一度アクセスすると、「Deployed with Kiro!」というメッセージが追加されました!
スクリーンショット 2025-12-07 12.44.27.png

まとめ

Reactアプリの作成からS3へのデプロイ、CI/CDパイプラインの完全な構築まで、わずか1時間程度で完了しました。

特筆すべきは、Kiroがエラーを出して躓くことがなかった点です。自然言語のプロンプトを理解し、適切なファイルを生成し、必要なコマンドを実行してくれました。途中で詰まって調べ物をする時間がほとんどなく、スムーズに作業を進められたのは大きな驚きでした。

Qiitaのアドベントカレンダーをご覧の皆さんも、ぜひKiroを試してみてください。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?