弹性云服务器 ECS-创建云服务器(废弃):请求示例
时间:2024-11-14 15:10:22
请求示例
- 通过block_device_mapping_v2扩展属性使用镜像创建一台云服务器,采用密钥方式登录鉴权。
POST https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/servers { "server": { "flavorRef": "s3.xlarge.2", "name": "wjvm48", "metadata": { "name": "name_xx1", "id": "id_xxxx1" }, "block_device_mapping_v2": [{ "source_type": "image", "destination_type": "volume", "uuid": "b023fe17-11db-4efb-b800-78882a0e394b", "delete_on_termination": "False", "boot_index": "0", "volume_type": "SAS", "volume_size": "40" }], "security_groups": [{ "name": "name_xx5_sg" }], "networks": [{ "uuid": "fd40e6f8-942d-4b4e-a7ae-465287b02a2c", "port": "e730a11c-1a19-49cc-8797-cee2ad67af6f", "fixed_ip": "10.20.30.137" }], "key_name": "test", "user_data": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==", "availability_zone":"az1-dc1" } }
- 通过block_device_mapping_v2扩展属性使用快照创建一台云服务器,其中,boot_index为0,且该快照对应的云硬盘必须为系统盘。
POST https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/servers { "server":{ "name":"wjvm48", "availability_zone":"az1-dc1", "block_device_mapping_v2": [ { "source_type":"snapshot", "boot_index":"0", "uuid":"df51997d-ee35-4fb3-a372-e2ac933a6565", // snapshot id,创建snapshot接口会返回id "destination_type":"volume" } ], "flavorRef":"s3.xlarge.2", "max_count":1, "min_count":1, "networks": [ { "uuid":"79a68cef-0936-4e21-b1f4-b800ecb70246" } ] } }
- 通过block_device_mapping_v2使用卷创建一台弹性云服务器。
POST https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/servers { "server": { "flavorRef": "s3.xlarge.2", "name": "wjvm48", "metadata": { "name": "name_xx1", "id": "id_xxxx1" }, "block_device_mapping_v2": [{ "source_type": "volume", "destination_type": "volume", "uuid": "bd7e4f86-b004-4745-bea2-a55b1085f107", "delete_on_termination": "False", "boot_index": "0", "volume_type": "dsware", "volume_size": "40" }], "security_groups": [{ "name": "name_xx5_sg" }], "networks": [{ "uuid": "fd40e6f8-942d-4b4e-a7ae-465287b02a2c", "port": "e730a11c-1a19-49cc-8797-cee2ad67af6f", "fixed_ip": "10.20.30.137" }], "key_name": "test", "user_data": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==", "availability_zone":"az1-dc1" } }
- 使用imageRef创建一台弹性云服务器,建议将密码在配置文件或者环境变量中密文存放,使用时解密,确保安全。
POST https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/servers { "server": { "flavorRef": "s3.xlarge.2", "name": "wjvm48", "metadata": { "name": "name_xx1", "id": "id_xxxx1" }, "adminPass": "$ADMIN_PASS", "imageRef": "6b344c54-d606-4e1a-a99e-a7d0250c3d14", "security_groups": [{ "name": "name_xx5_sg" }], "networks": [{ "uuid": "fd40e6f8-942d-4b4e-a7ae-465287b02a2c", "port": "e730a11c-1a19-49cc-8797-cee2ad67af6f", "fixed_ip": "10.20.30.137" }], "key_name": "test", "user_data": "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==", "availability_zone":"az1-dc1" } }
- 批量创建弹性云服务器,最小数量为2,最大数量为3。
POST https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/servers { "server": { "availability_zone":"az1.dc1", "name": "test", "imageRef": "10ff4f01-35b6-4209-8397-359cb4475fa0", "flavorRef": "s3.xlarge.2", "return_reservation_id": "true", "networks": [ { "uuid": "51bead38-d1a3-4d08-be20-0970c24b7cab" } ], "min_count": "2", "max_count": "3" } }
support.huaweicloud.com/api-ecs/ecs_03_0201.html
看了此文的人还看了
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格
推荐文章
- ECS-服务器-云服务器-华为ECS-弹性云服务器试用
- 全站加速请求收费_HTTPS请求数包_全站加速WSA
- 弹性公网IP使用_绑定弹性公网IP-华为云
- MapReduce服务_什么是HetuEngine_如何使用HetuEngine
- ER是什么_什么是企业路由器_华为云企业路由器有什么优势
- 国内12个月免费的云服务器推荐_云服务器配置_私有云服务器
- 弹性云服务器使用_购买弹性云服务器-功能概览
- 分布式云原生集合示例_华为云分布式云原生_华为云UCS集合示例
- MapReduce服务_如何使用MapReduce服务_MRS集群客户端安装与使用
- 大数据分析是什么_使用MapReduce_创建MRS服务