Amazon Elastic Compute Cloud logo

Amazon Elastic Compute Cloud

Amazon Elastic Compute Cloud

正常免费开源cloudAmazon Web Services62· JavaScript· MIT

Amazon EC2 API 用于创建、配置、管理虚拟机实例,是 AWS 最核心的 IaaS 服务。

访问站点 ↗源码 ↗健康巡检 9 小时前
适合什么时候用

实例类型覆盖 CPU / 内存 / GPU / 网络多维度

先注意什么

启动时间数十秒到几分钟,不适合极快冷启动场景

第一步先查

AWS Console / CLI 创建 IAM 凭证后,用 SDK 调 EC2.runInstances 启动实例。生产推荐用 Terraform / CDK / CloudFormation 等 IaC 工具管理。

认证
api_key
CORS
不支持
HTTPS
注册
需要
延迟
12 ms
协议
REST
计费
paid
Stars
62

可用率 · 30 天窗口

巡检: 1可用率: 100%平均延迟: 12ms

GitHub 活跃度

62JavaScriptMIT17 未关闭 issue上次提交 110 天前
01

关于这个 API

EC2 是 AWS 在 2006 年发布的首批服务之一,提供按需虚拟机算力。开发者通过 API 创建 instance、配 security group、附加 EBS 卷、设置 user data 初始化脚本,几十秒内拿到一台可 SSH 的服务器。实例类型矩阵覆盖通用型、计算型、内存型、GPU、ARM 等几十种,按小时(部分按秒)计费。

EC2 与 Auto Scaling、ELB、VPC 三件套构成传统云架构的脊柱。Spot 实例利用 AWS 闲置容量,价格只有按需的 10-30%,但可能被强制回收,适合容错的批处理任务。最近趋势是把无状态工作负载迁到 Lambda / ECS Fargate,让 EC2 集中在长任务、有状态服务、自管 K8s 上。

02

你可以做什么

  • 1自动化创建临时 EC2 实例跑批处理
  • 2搭建 auto-scaling 组应对流量波动
  • 3用 AMI 快速分发标准服务器镜像
  • 4为 Lambda 不适用的长任务提供算力
03

优劣对比

优点

  • 实例类型覆盖 CPU / 内存 / GPU / 网络多维度
  • 与 AWS 其它服务深度集成
  • Spot 实例最高省 90% 成本

注意事项

  • 启动时间数十秒到几分钟,不适合极快冷启动场景
  • 管理成本(patching、scaling)比 serverless 高
04

示例请求

通用模板 — 实际 endpoint 请查阅文档替换 <endpoint>。
curl https://github.com/mermade/aws2openapi/<endpoint> \
  -H "Authorization: Bearer $API_KEY"
# Some providers use X-Api-Key instead — verify in the docs.
05

快速开始

AWS Console / CLI 创建 IAM 凭证后,用 SDK 调 EC2.runInstances 启动实例。生产推荐用 Terraform / CDK / CloudFormation 等 IaC 工具管理。

06

常见问题

EC2 有免费档吗?+

首 12 个月每月 750 小时 t2.micro / t3.micro 实例免费。生产用量需付费。

Spot 实例和按需实例怎么选?+

容错性强的批处理选 Spot 省成本;线上稳定服务选按需或 Savings Plans。

怎么启动后自动配置实例?+

用 user data 脚本(启动时一次性执行),或借助 Systems Manager / Ansible / 配置管理工具持续管理。

07

技术细节

CORS: NoHTTPS: Yes注册: Yes开源: Yes
认证方式
api_key
计费
paid
协议
REST
SDK
python, javascript, java, go, ruby, csharp
响应时间
12 ms
上次巡检
2026/5/12 07:36:33
08

接口端点

从 OpenAPI spec 自动解析。显示 12 / 1182 个未弃用端点。

GET
/#Action=AcceptAddressTransfer
Address:query*TagSpecification:queryDryRun:queryAction:query*Version:query*
POST
/#Action=AcceptAddressTransfer
Action:query*Version:query*
GET
/#Action=AcceptReservedInstancesExchangeQuote
DryRun:queryReservedInstanceId:query*TargetConfiguration:queryAction:query*Version:query*
POST
/#Action=AcceptReservedInstancesExchangeQuote
Action:query*Version:query*
GET
/#Action=AcceptTransitGatewayMulticastDomainAssociations
TransitGatewayMulticastDomainId:queryTransitGatewayAttachmentId:querySubnetIds:queryDryRun:queryAction:query*+1 更多
POST
/#Action=AcceptTransitGatewayMulticastDomainAssociations
Action:query*Version:query*
GET
/#Action=AcceptTransitGatewayPeeringAttachment
TransitGatewayAttachmentId:query*DryRun:queryAction:query*Version:query*
POST
/#Action=AcceptTransitGatewayPeeringAttachment
Action:query*Version:query*
GET
/#Action=AcceptTransitGatewayVpcAttachment
TransitGatewayAttachmentId:query*DryRun:queryAction:query*Version:query*
POST
/#Action=AcceptTransitGatewayVpcAttachment
Action:query*Version:query*
GET
/#Action=AcceptVpcEndpointConnections
DryRun:queryServiceId:query*VpcEndpointId:query*Action:query*Version:query*
POST
/#Action=AcceptVpcEndpointConnections
Action:query*Version:query*

另有 1170 个端点未显示,详见 OpenAPI spec。

09

标签

10

更多来自 Amazon Web Services 的 API