Back to list
Google ADK と Amazon EC2 を使用したクロスクラウドエージェント開発
Cross Cloud Agent Development with the Google ADK and Amazon EC2
Translated: 2026/3/16 14:02:06
Japanese Translation
この記事では、Gemini CLI と ADK エージェントプラットフォームツールを使用して、クロスクラウド環境での作業を簡素化するため、Amazon EC2 インスタンスのインストールとカスタマイズ方法を解説します。
Gemini CLI は、Google から提供されるオープンソースのターミナルベース AI エージェントで、Gemini 2.5 Pro などの Gemini モデルと直接インタラクトし、コーディング、コンテンツ作成、およびワークフロー自動化を行います。また、Model Context Protocol (MCP) を介して外部ツールとも接続可能です。
Gemini CLI の詳細は、以下の通りです:
AI でビルド、デバッグおよびデプロイ
Amazon Elastic Compute Cloud (Amazon EC2) は、クラウド上の仮想サーバー(インスタンス)を、前もってハードウェア投資を行うことなくオンデマンドで容易に取得・設定できる、Amazon Web Services (AWS) の核心機能です。
Amazon EC2 の詳細な背景情報はこちら:
Amazon EC2
Gemini CLI と ADK は、Google Cloud コンソールと Gemini モデルを活用しますが、オープンソースかつプラットフォームに依存しないため、すでにクロスクラウドを跨ぐ多くのアプリケーションが存在します。これにより、慣れ親しんだツールが Amazon AWS 上でネイティブで実行可能になります。
このアプローチを検証するために、基本的な Amazon Linux EC2 インスタンスが起動されています:
次に、t3-small プロファイルを使用した基本的な Amazon Linux 2023 EC2 インスタンスを作成します:
イメージが起動したら、SSH またはコンソール経由で接続し、カスタマイズスクリプトを含む git リポジトリをクローンしてください:
git clone https://github.com/xbill9/gemini-cli-aws
cd gemini-cli-aws
次に、更新スクリプトを実行します:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ source linux-update
Detected Amazon Linux. Running aws-update...
...
(上記の出力は、パッケージ更新、依存関係の解決、Node.js および gemini-cli のインストールプロセスを示しています)
Node.js バージョンが Gemini CLI をサポートする最新であることを確認します:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ npm --version
11.11.0
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ node --version
v25.8.0
linux-update スクリプトは gemini-cli を自動的に更新します。
手動でのバージョン更新には以下の通り:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ source gemini-update
または、gemini-cli を直接ダウンロードします:
npm install -g @google/gemini-cli
ツールと正しい Node.js バージョンを準備したら、gemini-cli の起動をテストできます。Key または Google アカウントを使用して認証する必要があります:
gemini
認証が完了すると、CLI のフルアクセスが得られます:
複数の認証オプションが利用可能です。既存の Code Assist ライセンスを使用して認証するには、Google アカウントで認証します:
次に、Google Cloud コンソールでの有効なプロジェクト設定に GOOGLE_CLOUD_PROJECT を設定します:
~ $ export GOOGLE_CLOUD_PROJECT=comglitn
~ $
他のオプションとしては、Google Cloud コンソールから直接生成可能な Google Cloud API キーがあります。
Google Cloud のユーティリティツールは、Amazon Linux 2023 にインストールできます。以下の手順に従ってください:
クイックスタート:Google Cloud CLI のインストール | Google Cloud SDK | Google Cloud ドキュメンテーション
直接の URL はこちらです:
https://docs.cloud.google.com/sdk/docs/install-sdk
まず、Google Cloud リポジトリソースを追加します:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ sudo tee -a /etc/yum.repos.d/
Original Content
This article covers installing, and customizing an Amazon EC2 instance with Gemini CLI and the ADK agent platform tools to simplify working with a Cross Cloud environment.
The Gemini CLI is an open-source, terminal-based AI agent from Google that allows developers to interact directly with Gemini models, such as Gemini 2.5 Pro, for coding, content creation, and workflow automation. It supports file operations, shell commands, and connects to external tools via the Model Context Protocol (MCP).
The full details on Gemini CLI are available here:
Build, debug & deploy with AI
Amazon Elastic Compute Cloud (Amazon EC2) is a core Amazon Web Services (AWS) offering that provides secure, resizable compute capacity (virtual servers) in the cloud. It enables developers to easily obtain and configure virtual machines, known as instances , on demand, without the need for up-front hardware investment.
The full background information on Amazon EC2 is here:
Amazon EC2
Yes- Gemini CLI and the ADK leverages the Google Cloud console and Gemini models but it is also open source and platform agnostic. Many applications are already cross-cloud so this enables familiar tools to be run natively on Amazon AWS.
To validate the approach- a basic Amazon Linux EC2 instance is spun up:
Then create a basic Amazon Linux 2023 EC2 instance with the t3-small profile:
Once the image spins up- connect via SSH or the console and pull the git repo with the customization scripts:
git clone https://github.com/xbill9/gemini-cli-aws
cd gemini-cli-aws
Then run the update scripts:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ source linux-update
Detected Amazon Linux. Running aws-update...
Last metadata expiration check: 0:53:51 ago on Mon Mar 9 16:00:36 2026.
Last metadata expiration check: 0:53:51 ago on Mon Mar 9 16:00:36 2026.
Dependencies resolved.
Nothing to do.
Complete!
Last metadata expiration check: 0:53:52 ago on Mon Mar 9 16:00:36 2026.
Package libatomic-14.2.1-7.amzn2023.0.2.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
npm warn deprecated prebuild-install@7.1.3: No longer maintained. Please contact the author of the relevant native addon; alternatives are available.
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
npm warn deprecated glob@10.5.0: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
The version of Node.js is verified that it is recent enough to support Gemini CLI:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ npm --version
11.11.0
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ node --version
v25.8.0
The linux-update script automatically updates Gemini CLI.
To manually update the version:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ source gemini-update
You also download the Gemini CLI directly:
npm install -g @google/gemini-cli
Once you have all the tools and the correct Node.js version in place- you can test the startup of Gemini CLI. You will need to authenticate with a Key or your Google Account:
gemini
Then you will get full access to the CLI:
Several authentication options are available. To use an existing Code Assist licence — authenticate with a Google Account:
Then set the GOOGLE_CLOUD_PROJECT to a valid project setup on the Google Cloud console:
~ $ export GOOGLE_CLOUD_PROJECT=comglitn
~ $
Other options include Google Cloud API Key that can be generated directly from the Google Cloud Console.
The Google Cloud utility tools can be installed on Amazon Linux 2023 following these directions:
Quickstart: Install the Google Cloud CLI | Google Cloud SDK | Google Cloud Documentation
The direct URL is here:
https://docs.cloud.google.com/sdk/docs/install-sdk
First add the Google Cloud source repository:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-cli]
name=Google Cloud CLI
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el10-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key-v10.gpg
EOM
[google-cloud-cli]
name=Google Cloud CLI
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el10-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key-v10.gpg
Then, install the tools:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ sudo dnf install google-cloud-cli
Google Cloud CLI 8.9 MB/s | 10 MB 00:01
Last metadata expiration check: 0:00:03 ago on Mon Mar 9 17:09:31 2026.
Dependencies resolved.
==============================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================
Installing:
google-cloud-cli x86_64 559.0.0-1.el10 google-cloud-cli 110 M
Installing dependencies:
google-cloud-cli-anthoscli x86_64 559.0.0-1.el10 google-cloud-cli 26 M
Is this ok [y/N]: y
Once the gcloud tools are active- authenticate to the underlying Google Cloud Project:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ gcloud auth list
No credentialed accounts.
To login, run:
$ gcloud auth login `ACCOUNT`
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ gcloud auth login
You will be prompted for an Oauth authentication flow.
Then — set your main Google Cloud project:
Your current project is [None]. You can change this setting by running:
$ gcloud config set project PROJECT_ID
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ gcloud config set project comglitn
Updated property [core/project].
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$
Now that the base environment has been enabled- a sample ADK project is cloned and initial setup is done:
git clone https://github.com/adk-hello-world
source set_env.sh
gcloud auth application-default login
Once the environment is set- call the Agent1_cli.sh script:
/home/ec2-user/adk-hello-world/src/agents/Agent1
adk run .
Log setup complete: /tmp/agents_log/agent.20260310_192953.log
To access latest log: tail -F /tmp/agents_log/agent.latest.log
/home/ec2-user/.pyenv/versions/3.13.12/lib/python3.13/site-packages/google/adk/cli/utils/agent_loader.py:248: UserWarning: [EXPERIMENTAL] _load_from_yaml_config: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
if root_agent := self._load_from_yaml_config(actual_agent_name, agents_dir):
/home/ec2-user/.pyenv/versions/3.13.12/lib/python3.13/site-packages/google/adk/features/_feature_decorator.py:81: UserWarning: [EXPERIMENTAL] feature FeatureName.AGENT_CONFIG is enabled.
check_feature_enabled()
/home/ec2-user/.pyenv/versions/3.13.12/lib/python3.13/site-packages/google/adk/cli/cli.py:204: UserWarning: [EXPERIMENTAL] InMemoryCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
credential_service = InMemoryCredentialService()
/home/ec2-user/.pyenv/versions/3.13.12/lib/python3.13/site-packages/google/adk/auth/credential_service/in_memory_credential_service.py:33: UserWarning: [EXPERIMENTAL] BaseCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
super(). __init__ ()
Running agent Agent1, type exit to exit.
[user]: what is the weather in Hoboken NJ
[Agent1]: The weather in Hoboken, New Jersey, on Tuesday, March 10, 2026, is sunny with temperatures in the low 70s Fahrenheit.
Specifically, around 3:00 PM to 4:00 PM EDT, the temperature is approximately 72°F, feeling like 72-74°F. The forecast for today indicates sunny conditions and highs in the mid-70s. Earlier in the afternoon, around 3 PM, the temperature was 72°F with a RealFeel of 74°F, remaining pleasant into the evening with temperatures around 69°F by 6 PM. The day is expected to be mainly sunny, with some areas of dense morning fog clearing.
First- check that the Amazon EC2 instance allows web traffic on ports 8000 and 8080- these are the common Agent ports.
Once the CLI has been validated, start the ADK Web Interface with the *webvm.sh * script:
Running ADK from VM
/home/ec2-user/adk-hello-world/src/agents
adk web
2026-03-10 19:34:22,852 - INFO - service_factory.py:266 - Using in-memory memory service
2026-03-10 19:34:22,852 - INFO - local_storage.py:84 - Using per-agent session storage rooted at /home/ec2-user/adk-hello-world/src/agents
2026-03-10 19:34:22,853 - INFO - local_storage.py:110 - Using file artifact service at /home/ec2-user/adk-hello-world/src/agents/.adk/artifacts
/home/ec2-user/.pyenv/versions/3.13.12/lib/python3.13/site-packages/google/adk/cli/fast_api.py:192: UserWarning: [EXPERIMENTAL] InMemoryCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
credential_service = InMemoryCredentialService()
/home/ec2-user/.pyenv/versions/3.13.12/lib/python3.13/site-packages/google/adk/auth/credential_service/in_memory_credential_service.py:33: UserWarning: [EXPERIMENTAL] BaseCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
super(). __init__ ()
INFO: Started server process [22779]
INFO: Waiting for application startup.
+-----------------------------------------------------------------------------+
| ADK Web Server started |
| |
| For local testing, access at http://0.0.0.0:8000. |
+-----------------------------------------------------------------------------+
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Navigate to the external IP address of the EC2 VM:
Gemini CLI was downloaded and tested from an AWS Amazon Linux 2023 EC2 instance.
This is a complete fully working version of Gemini CLI with all the standard features like extensions, agent skills, and a familiar interface.
Next, the Google Cloud tools package was installed on the same EC2 instance. Then, a Google ADK project was cloned from Github.
This project was used to test the ADK running natively in AWS.
This is a first step to enabling cross platform projects with both Google Cloud and AWS.