mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-03 08:06:01 +08:00
docs: add amazon tutorial (#2261)
* feat: add amazon tutorial * chore: apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Guille <gagdiez.c@gmail.com> * chore: apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Guille <gagdiez.c@gmail.com> --------- Co-authored-by: Guille <gagdiez.c@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -135,7 +135,8 @@
|
||||
{
|
||||
"group": "How to host IronClaw on...",
|
||||
"pages": [
|
||||
"infrastructure/droplet"
|
||||
"infrastructure/droplet",
|
||||
"infrastructure/amazon"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -262,7 +263,8 @@
|
||||
{
|
||||
"group": "在以下平台托管 IronClaw",
|
||||
"pages": [
|
||||
"zh/infrastructure/droplet"
|
||||
"zh/infrastructure/droplet",
|
||||
"zh/infrastructure/amazon"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
BIN
docs/images/infrastructure/amazon/amazon-create.png
Normal file
BIN
docs/images/infrastructure/amazon/amazon-create.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 254 KiB |
BIN
docs/images/infrastructure/amazon/amazon-firewall.png
Normal file
BIN
docs/images/infrastructure/amazon/amazon-firewall.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 167 KiB |
BIN
docs/images/infrastructure/amazon/amazon-ip.png
Normal file
BIN
docs/images/infrastructure/amazon/amazon-ip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
BIN
docs/images/infrastructure/amazon/amazon-ssh.png
Normal file
BIN
docs/images/infrastructure/amazon/amazon-ssh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 328 KiB |
154
docs/infrastructure/amazon.mdx
Normal file
154
docs/infrastructure/amazon.mdx
Normal file
@@ -0,0 +1,154 @@
|
||||
---
|
||||
title: Amazon EC2
|
||||
description: Host IronClaw on an Amazon EC2 Instance
|
||||
---
|
||||
|
||||
Amazon Elastic Compute Cloud (EC2) lets you run virtual machines on AWS infrastructure with flexible pricing and a free tier for new accounts. In this guide we will launch an EC2 instance and configure it securely so you can run IronClaw and expose it to the internet.
|
||||
|
||||
<Tip>
|
||||
Do not feel like setting up your own infrastructure? You can install IronClaw with a few clicks on [agent.near.ai](https://agent.near.ai)
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## Create an EC2 Instance
|
||||
|
||||
Sign in to the [AWS Management Console](https://console.aws.amazon.com) and navigate to **EC2 → Instances → Launch Instances**.
|
||||

|
||||
|
||||
|
||||
Configure the following:
|
||||
|
||||
- **Name**: choose a descriptive name (e.g. `ironclaw`)
|
||||
- **AMI**: Ubuntu Server 24.04 LTS (free tier eligible)
|
||||
- **Instance type**: `t2.micro` or `t3.micro` (free tier eligible) — sufficient for most use cases
|
||||
- **Key pair**: click **Create new key pair**, give it a name, choose RSA and `.pem` format, then download the file. Keep it in a safe place — you will not be able to download it again.
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
```bash
|
||||
# Restrict permissions on the downloaded key (required by SSH)
|
||||
chmod 400 ~/.ssh/your-key.pem
|
||||
```
|
||||
|
||||
Under **Network settings**, click **Edit** and make sure the following inbound rules are set in the security group:
|
||||
|
||||
| Type | Protocol | Port | Source |
|
||||
|-------|----------|------|-----------|
|
||||
| SSH | TCP | 22 | My IP |
|
||||
| HTTP | TCP | 80 | Anywhere |
|
||||
| HTTPS | TCP | 443 | Anywhere |
|
||||
|
||||
<Note>
|
||||
Restricting SSH to **My IP** is strongly recommended. It prevents brute-force attacks from the open internet. You can update this rule later if your IP changes.
|
||||
</Note>
|
||||

|
||||
|
||||
Click **Launch Instance**. AWS will take a few seconds to provision the instance.
|
||||
|
||||
---
|
||||
|
||||
## Access Your Instance
|
||||
|
||||
Once the instance is running, find its **Public IPv4 address** in the **Instances** list.
|
||||
|
||||

|
||||
|
||||
Connect from your terminal using the `.pem` key you downloaded:
|
||||
|
||||
```bash
|
||||
# Replace <KEY_PATH> and <IP_ADDRESS> accordingly
|
||||
ssh -i <KEY_PATH> ubuntu@<IP_ADDRESS>
|
||||
```
|
||||
|
||||
<Note>
|
||||
The default username for Ubuntu AMIs is `ubuntu`. For Amazon Linux AMIs it would be `ec2-user`.
|
||||
</Note>
|
||||
|
||||
### Root Access
|
||||
|
||||
Unlike DigitalOcean Droplets, EC2 Ubuntu instances do not let you log in directly as `root`. Instead, the `ubuntu` user has passwordless `sudo` privileges. All privileged commands in this guide are prefixed with `sudo` so you can run them directly without switching users.
|
||||
|
||||
---
|
||||
|
||||
## Configure Your Instance
|
||||
|
||||
Now that we are inside the instance, we need to perform some initial configuration. We want to strengthen security by setting up a dedicated user and preparing the system for running IronClaw.
|
||||
|
||||
### Update and Upgrade
|
||||
|
||||
First, make sure the system is up to date:
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
### Create a New User
|
||||
|
||||
It is good practice to create a dedicated user with sudo privileges instead of using `ubuntu` for all operations. You can create a new user (for example, `ironclaw`) and add it to the sudo group:
|
||||
|
||||
```bash
|
||||
sudo adduser ironclaw
|
||||
sudo usermod -aG sudo ironclaw
|
||||
```
|
||||
|
||||
Copy the SSH keys from `ubuntu` to the new user so you can log in with the same key pair:
|
||||
|
||||
```bash
|
||||
# Create the .ssh directory for the user
|
||||
sudo mkdir -p /home/ironclaw/.ssh
|
||||
|
||||
# Copy the authorized_keys from the ubuntu user
|
||||
sudo cp ~/.ssh/authorized_keys /home/ironclaw/.ssh/authorized_keys
|
||||
|
||||
# Set the correct ownership (critical — SSH will ignore the file otherwise)
|
||||
sudo chown -R ironclaw:ironclaw /home/ironclaw/
|
||||
sudo chmod 700 /home/ironclaw/.ssh
|
||||
sudo chmod 600 /home/ironclaw/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
Open a new terminal window and confirm you can log in with the new user before continuing:
|
||||
|
||||
```bash
|
||||
ssh -i <KEY_PATH> ironclaw@<IP_ADDRESS>
|
||||
```
|
||||
|
||||
<Warning>
|
||||
Do not move forward until you have confirmed that you can log in with the new user. If you lose access without another user set up, you will need to reset your instance and start over.
|
||||
</Warning>
|
||||
|
||||
<Note>
|
||||
EC2 Security Groups already act as a network-level firewall. As long as your inbound rules are configured as shown above, no additional firewall configuration is needed on the instance itself.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Install IronClaw
|
||||
|
||||
Now that the instance is set up and secured, install IronClaw:
|
||||
|
||||
```bash
|
||||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/nearai/ironclaw/releases/latest/download/ironclaw-installer.sh | sh
|
||||
```
|
||||
|
||||
Then start IronClaw and follow the instructions to complete the setup:
|
||||
|
||||
```bash
|
||||
ironclaw
|
||||
```
|
||||
|
||||
<Tip>
|
||||
We recommend using a session manager like `tmux` or `screen` so you can easily detach and reattach to your running IronClaw instance between SSH sessions.
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
Follow our [Quickstart Guide](/quickstart) to create your first agent, connect it to Telegram, and start exploring IronClaw's capabilities.
|
||||
|
||||
Want to talk with your agent using a messaging app? Check out the [**Channels**](/channels/overview) documentation to learn how to connect.
|
||||
|
||||
Need your agent to perform complex tasks that require multiple tools? Check out the [**Extensions**](/extensions/overview) documentation.
|
||||
90
docs/zh/infrastructure/amazon.mdx
Normal file
90
docs/zh/infrastructure/amazon.mdx
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
title: Amazon EC2
|
||||
description: 在 Amazon EC2 实例上托管 IronClaw
|
||||
---
|
||||
|
||||
Amazon Elastic Compute Cloud(EC2)允许您在 AWS 基础设施上以灵活的定价运行虚拟机,新账户还可享受免费套餐。本指南将带您启动一个 EC2 实例并对其进行安全配置,从而安全地运行 IronClaw 并将其暴露到互联网。
|
||||
|
||||
<Tip>
|
||||
不想自己搭建基础设施?您可以在 [agent.near.ai](https://agent.near.ai) 上点几下就安装好 IronClaw。
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## 创建 EC2 实例
|
||||
|
||||
登录 [AWS 管理控制台](https://console.aws.amazon.com),然后导航到 **EC2 → 实例 → 启动实例**。
|
||||

|
||||
|
||||
|
||||
配置以下内容:
|
||||
|
||||
- **名称**:选择一个描述性名称(例如 `ironclaw`)
|
||||
- **AMI**:Ubuntu Server 24.04 LTS(符合免费套餐资格)
|
||||
- **实例类型**:`t2.micro` 或 `t3.micro`(符合免费套餐资格)——足以满足大多数使用场景
|
||||
- **密钥对**:点击 **创建新密钥对**,输入名称,选择 RSA 和 `.pem` 格式,然后下载文件。请妥善保管——此文件无法再次下载。
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
```bash
|
||||
# 限制已下载密钥的权限(SSH 要求此操作)
|
||||
chmod 400 ~/.ssh/your-key.pem
|
||||
```
|
||||
|
||||
在 **网络设置** 下,点击 **编辑** 并确保安全组中设置了以下入站规则:
|
||||
|
||||
| 类型 | 协议 | 端口 | 来源 |
|
||||
|-------|------|------|------------|
|
||||
| SSH | TCP | 22 | 我的 IP |
|
||||
| HTTP | TCP | 80 | 任意位置 |
|
||||
| HTTPS | TCP | 443 | 任意位置 |
|
||||
|
||||
<Note>
|
||||
强烈建议将 SSH 限制为 **我的 IP**。这可以防止来自公共互联网的暴力破解攻击。如果您的 IP 发生变化,可以随时更新此规则。
|
||||
</Note>
|
||||

|
||||
|
||||
点击 **启动实例**。AWS 将花费几秒钟来配置实例。
|
||||
|
||||
---
|
||||
|
||||
## 访问您的实例
|
||||
|
||||
实例运行后,在 **实例** 列表中找到其 **公有 IPv4 地址**。
|
||||
|
||||

|
||||
|
||||
使用您下载的 `.pem` 密钥从终端进行连接:
|
||||
|
||||
```bash
|
||||
# 将 <KEY_PATH> 和 <IP_ADDRESS> 替换为实际值
|
||||
ssh -i <KEY_PATH> ubuntu@<IP_ADDRESS>
|
||||
```
|
||||
|
||||
<Note>
|
||||
Ubuntu AMI 的默认用户名是 `ubuntu`。Amazon Linux AMI 的默认用户名则是 `ec2-user`。
|
||||
</Note>
|
||||
|
||||
### Root 权限
|
||||
|
||||
与 DigitalOcean Droplet 不同,EC2 Ubuntu 实例不允许直接以 `root` 身份登录。但 `ubuntu` 用户已具备无密码 `sudo` 权限。本指南中所有需要特权的命令均已加上 `sudo` 前缀,无需切换用户即可直接运行。
|
||||
|
||||
---
|
||||
|
||||
## 安全加固与安装 IronClaw
|
||||
|
||||
[安全指南](/zh/security) 同样适用于您的 EC2 实例,但有一点不同:由于您已以 `ubuntu`(非 root 的 sudo 用户)身份登录,可以 **跳过"创建新用户"步骤** ——`ubuntu` 已承担了该角色。
|
||||
|
||||
其余所有步骤——更新系统、加固 SSH、安装 Fail2Ban、配置防火墙以及安装 IronClaw——均完全适用。
|
||||
|
||||
---
|
||||
|
||||
## 下一步
|
||||
|
||||
参考我们的 [快速入门指南](/zh/quickstart) 创建您的第一个 agent,将其连接到 Telegram,并开始探索 IronClaw 的功能。
|
||||
|
||||
想通过即时通讯应用与您的 agent 对话?请查看 [**Channels**](/zh/channels/overview) 文档了解如何连接。
|
||||
|
||||
需要 agent 执行需要多个工具的复杂任务?请查看 [**Extensions**](/zh/extensions/overview) 文档。
|
||||
Reference in New Issue
Block a user