cloud-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCloud Environment Setup
云环境设置
Configure Elastic Cloud authentication and preferences. All other skills depend on this setup.
cloud/*配置Elastic Cloud身份验证和偏好设置。所有其他技能都依赖于该设置。
cloud/*Workflow
工作流程
text
Setup Progress:
- [ ] Step 1: Verify API key
- [ ] Step 2: Set defaults
- [ ] Step 3: Validate connectiontext
Setup Progress:
- [ ] Step 1: Verify API key
- [ ] Step 2: Set defaults
- [ ] Step 3: Validate connectionStep 1: Verify API key
步骤1:验证API密钥
Check whether is already set:
EC_API_KEYbash
echo "${EC_API_KEY:?Not set}"If not set, instruct the user to set it. Never ask the user to paste an API key into the chat — secrets must not
appear in conversation history.
Direct the user to:
- Generate a key at Elastic Cloud API keys. The key must have Project Admin privileges or higher (Org Owner) to create and manage serverless projects.
- Create a file in the project root (recommended — works in sandboxed agent shells):
.env
bash
EC_API_KEY=your-api-keyAll scripts auto-load from the working directory — no manual sourcing needed.
cloud/*.env- Alternatively, export directly in the terminal:
bash
export EC_API_KEY="your-api-key"Terminal exports might not be visible to sandboxed agents running in a separate shell session. Prefer the file
when working with an agent.
.envRemind the user that storing secrets in local files is acceptable for development, but for production or shared
environments, use a centralized secrets manager (for example, HashiCorp Vault, AWS Secrets Manager, 1Password CLI) to
avoid secrets sprawl.
检查是否已设置:
EC_API_KEYbash
echo "${EC_API_KEY:?Not set}"如果未设置,请指导用户进行设置。切勿要求用户在聊天中粘贴API密钥——机密信息不得出现在对话历史中。
请指导用户执行以下操作:
- 在Elastic Cloud API密钥页面生成密钥。该密钥必须拥有项目管理员或更高权限(组织所有者)才能创建和管理无服务器项目。
- 在项目根目录创建文件(推荐方式——适用于沙盒Agent Shell环境):
.env
bash
EC_API_KEY=your-api-key所有脚本会自动从工作目录加载文件——无需手动导入。
cloud/*.env- 或者,直接在终端中导出:
bash
export EC_API_KEY="your-api-key"在独立Shell会话中运行的沙盒Agent可能无法识别终端中导出的变量。与Agent配合使用时,优先选择文件方式。
.env提醒用户,在开发环境中可以将机密信息存储在本地文件中,但在生产环境或共享环境中,请使用集中式密钥管理工具(例如HashiCorp Vault、AWS Secrets Manager、1Password CLI),以避免机密信息扩散。
Step 2: Set defaults
步骤2:设置默认值
Export the base URL and default region:
bash
export EC_BASE_URL="https://api.elastic-cloud.com"
export EC_REGION="gcp-us-central1"Ask the user if they want a different region. To list available regions:
bash
curl -s -H "Authorization: ApiKey ${EC_API_KEY}" \
"${EC_BASE_URL}/api/v1/serverless/regions" | python3 -m json.tool导出基础URL和默认区域:
bash
export EC_BASE_URL="https://api.elastic-cloud.com"
export EC_REGION="gcp-us-central1"询问用户是否需要设置其他区域。如需列出可用区域,请执行:
bash
curl -s -H "Authorization: ApiKey ${EC_API_KEY}" \
"${EC_BASE_URL}/api/v1/serverless/regions" | python3 -m json.toolStep 3: Validate connection
步骤3:验证连接
Confirm the API key works by calling the regions endpoint:
bash
curl -sf -H "Authorization: ApiKey ${EC_API_KEY}" \
"${EC_BASE_URL}/api/v1/serverless/regions" > /dev/null && echo "Authenticated." || echo "Authentication failed."If validation fails, check:
- The API key is valid and not expired
- Network connectivity to
api.elastic-cloud.com
通过调用区域端点确认API密钥可用:
bash
curl -sf -H "Authorization: ApiKey ${EC_API_KEY}" \
"${EC_BASE_URL}/api/v1/serverless/regions" > /dev/null && echo "Authenticated." || echo "Authentication failed."如果验证失败,请检查:
- API密钥是否有效且未过期
- 与的网络连接是否正常
api.elastic-cloud.com
Examples
示例
First-time setup
首次设置
text
User: set up my cloud environment
Agent: Check if EC_API_KEY is set in your terminal. If not, generate a key at
https://cloud.elastic.co/account/keys and run:
export EC_API_KEY="your-key"
Then confirm and I'll validate the connection.text
用户:设置我的云环境
Agent:检查你的终端中是否已设置EC_API_KEY。如果未设置,请访问https://cloud.elastic.co/account/keys生成密钥,然后运行:
export EC_API_KEY="your-key"
确认后我将验证连接。Setup with custom region
自定义区域设置
text
User: set up cloud with eu region
Agent: [runs setup, sets EC_REGION to user's preferred EU region]text
用户:设置使用欧盟区域的云环境
Agent:[执行设置,将EC_REGION设置为用户偏好的欧盟区域]Guidelines
指导原则
- Never receive, echo, or log API keys, passwords, or any credentials in the chat. Instruct the user to manage secrets in their terminal or using files directly.
- Always validate the connection after setting the key.
- Default region is — only change if the user requests a different region.
gcp-us-central1 - This skill is a prerequisite. Other cloud skills should refer here when is missing.
EC_API_KEY
- 切勿在聊天中接收、回显或记录API密钥、密码或任何凭证。指导用户在终端中或直接通过文件管理机密信息。
- 设置密钥后务必验证连接。
- 默认区域为——仅在用户要求时更改。
gcp-us-central1 - 本技能是前置要求。当其他云技能检测到缺失时,应引导用户参考本设置流程。
EC_API_KEY
Environment variables
环境变量
| Variable | Required | Description |
|---|---|---|
| Yes | Elastic Cloud API key |
| No | Cloud API base URL (default: |
| No | Default region (default: |
| 变量名 | 是否必填 | 说明 |
|---|---|---|
| 是 | Elastic Cloud API密钥 |
| 否 | Cloud API基础URL(默认值: |
| 否 | 默认区域(默认值: |
Troubleshooting
故障排除
| Problem | Fix |
|---|---|
| API key is invalid or expired — generate a new one |
| Check network access to |
| 问题 | 解决方法 |
|---|---|
| API密钥无效或已过期——生成新密钥 |
| 检查对 |