This article covers installing, and customizing an Amazon EC2 instance with Gemini CLI and the Google Cloud platform tools to simplify working with a Cross Cloud environment.
What is Gemini CLI?
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:
Amazon EC2
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:
Why would I want Gemini CLI on AWS? Isn’t that a Google Thing?
Yes- Gemini CLI 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.
Activating Amazon EC2
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:
Instance Customization
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
changed 624 packages in 52s
175 packages are looking for funding
run `npm fund` for details
v25.8.0
0.32.1
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$
Verifying Node.js in Amazon Linux Instance
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
Gemini CLI Installation
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
Testing the Gemini CLI Environment
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:
Authentication
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.
Google Cloud Tools
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
Transaction Summary
==============================================================================================================================================
Install 2 Packages
Total download size: 136 M
Installed size: 680 M
Is this ok [y/N]: y
Linking the Google Cloud Project
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]$
Using Gemini CLI on AWS
Once everything is installed- Gemini CLI has direct access to the Google cloud command environment:
[ec2-user@ip-172-31-66-238 gemini-cli-aws]$ gemini
Logged in with Google: xbill@glitnir.com /auth
Plan: Gemini Code Assist Standard
Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. /help for more information.
> what buckets are in my google cloud project
✦ I will check the current Google Cloud configuration to identify the active project and then list the available storage buckets.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Action Required │
│ │
│ ? Shell gcloud config get-value project && gcloud storage buckets list [current working directory /home/ec2-user/gemini-cli-aws] (Get th… │
│ │
│ gcloud config get-value project && gcloud storage buckets list │
│ Allow execution of: 'gcloud, gcloud'? │
│ │
│ 1. Allow once │
│ 2. Allow for this session │
│ ● 3. Allow for all future sessions │
│ 4. No, suggest changes (esc) │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
This will then execute the gcloud command and retrieve the bucket information:
✦ In your Google Cloud project comglitn, the following storage buckets are available:
Core Project Buckets
- gs://glitnir/ (Standard, versioning enabled)
- gs://glitnir-backup/ (Standard)
- gs://glitnir-dev/ (Standard, versioning enabled)
- gs://glitnir-src/ (Archive)
- gs://glitnir-html/ (Archive)
- gs://glitnir-cloud-logging/ (Standard, public access enforced)
- gs://glitnir-project-search-documents-1/
Environment Validation
You can also use Gemini CLI to cross-check the setup:
> what is my current environment
✦ I will check your cloud configurations and environment variables to determine your current active environment.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell gcloud config list && aws configure list && env | grep -E "NODE_ENV|APP_ENV|ENVIRONMENT|STAGE" [current working directory /h… │
│ │
│ [core] │
│ account = xbill@glitnir.com │
│ disable_usage_reporting = True │
│ project = comglitn │
│ │
│ Your active configuration is: [default] │
│ NAME : VALUE : TYPE : LOCATION │
│ profile : <not set> : None : None │
│ access_key : <not set> : None : None │
│ secret_key : <not set> : None : None │
│ region : us-east-1 : imds : │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ Your current environment is:
- Google Cloud Project: comglitn (active project)
- AWS Region: us-east-1 (running in AWS via IMDS)
Summary
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, Gemini CLI was used to perform Google cloud native operations directly from the Amazon EC2 instance. This is a first step to enabling cross platform projects with both Google Cloud and AWS.





Top comments (0)