Instance

BCC BCC

  • API Reference
    • Appendix
    • Automatic Snapshot Policy Related Interfaces
      • Bind automatic snapshot policy
      • Create automatic snapshot policy
      • Delete automatic snapshot policy
      • Query details of automatic snapshot policy
      • Query the list of automatic snapshot policies
      • Unbind automatic snapshot policy
      • Update automatic snapshot policy
    • Cluster Management Related Interfaces
      • Create EHC Cluster
      • Delete EHC Cluster
      • EHC Cluster List
      • Modify EHC Cluster
    • Common Request Headers and Response Headers
    • Dedicated Cluster Related Interfaces
      • Canceling Dedicated Cluster Auto-Renewal
      • Create a dedicated cluster
      • Dedicated Cluster Renewal
      • Dedicated Cluster Tag Binding
      • Dedicated Cluster Tag Unbinding
      • Enabling Dedicated Cluster Auto-Renewal
      • Querying Dedicated Cluster Details
      • Querying Dedicated Cluster List
      • Resizing Dedicated Cluster
    • Deployment Group Related Interfaces
      • Adjust Deployment Group
      • Create Deployment Group
      • Delete Deployment Group
      • Get Deployment Group Details
      • Modify deployment group
      • Query the deployment group list
      • Remove Instance from Deployment Group
    • Disk Related Interfaces
      • Attach a CDS disk
      • Bind a tag to a disk
      • Cancel Auto-renewal
      • Create a CDS disk
      • Detach a CDS disk
      • Disk Expansion and Type Change
      • Enable auto-renewal
      • Get Purchasable Disk Information
      • Modify disk properties
      • Query CDS Price
      • Query disk details
      • Query the disk list
      • Release a CDS disk (new)
      • Release a CDS disk
      • Rename a disk
      • Renew a disk
      • Roll back disk data
      • Shift charge for disks
      • Unbind a tag from a disk
    • Error response
    • General Description
    • Image Related Interfaces
      • Bind a tag to an image
      • Cancel cross-region replication of custom images
      • Create a custom image
      • Delete a custom image
      • Import an image
      • Modify Custom Image Name
      • Query available public image based on instance specifications
      • Query image details
      • Query List of Users with Shared Image Access
      • Query OS information based on instance IDs in batch
      • Query the image list
      • Replicate a custom image across regions
      • Share a custom image
      • Unbind a tag from an image
      • Unshare a custom image
    • Instance Related Interfaces
      • Add an instance to a security group
      • Add IPv6
      • Batch Adding Secondary IP Addresses for Primary Network Interface Card
      • Batch Convert to Postpay
      • Batch Unsubscribe Prepaid Instances
      • Billing Change - Convert to Subscription
      • Bind a role
      • Bind a tag to an instance
      • Change the instance subnet
      • Change the instance VPC
      • Convert to prepay in batch
      • Create an instance (by specifying instance package specifications)
      • Create automatic renewal rules
      • Create instance
      • Delete automatic renewal rules
      • Delete secondary IP address from the primary network interface card in batch
      • Early Release of Prepaid Instances
      • Enter rescue mode
      • Exit rescue mode
      • Instance Resizing (By Specifying Instance Package Specification)
      • Modify instance attributes
      • Modify instance description
      • Modify instance hostname
      • Modify the instance password
      • Query Instance List by Instance ID
      • Query instance list
      • Query Multiple Instance Details
      • Query recycle bin instance list
      • Query resizing specifications
      • Query the custom data of the instance
      • Query the details of a specified instance
      • Query the list of BCC instances eligible for no charge for stopped instances
      • Query the VNC address of the instance
      • Reboot an instance
      • Reinstall an instance
      • Reinstall OS for Instances (Batch Reinstallation)
      • Release instances in batch
      • Release IPv6
      • Release Postpay Instances (Release via POST Request)
      • Release recycle bin instances
      • Remove an instance from a security group
      • Remove the relationship between an instance and its deployment group
      • Renew an instance
      • Resize instances in batches
      • Resuming Billing for BCC in Recycle Bin
      • Retrieve a list of instance roles
      • Retrieve network interface card information for an instance
      • Set Auto-release of Spot Instance EIP
      • Set Instance Deletion Protection
      • Setting Auto-Release for Postpay
      • Start an instance
      • Starting Instances (Batch Start)
      • Stop an instance
      • Stopping Instances (Batch Stop)
      • Unbind a role
      • Unbind a tag from an instance
    • Key Pair Related Interfaces
      • Bind a key pair
      • Change description of key pair
      • Create a key pair
      • Delete a key pair
      • Import a key pair
      • Query key pair details
      • Query the key pair list
      • Rename a key pair
      • Unbind a key pair
    • Maintenance platform APIs
      • Maintenance Records Related Interfaces
      • Maintenance Task Related Interfaces
      • Pre-authorization Related Interfaces
    • Other APIs
      • Query instance package price
      • Query instance package specifications (new)
      • Querying Availability Zones By Package Specification
    • Overview
    • Region and Availability Zone Related Interfaces
      • Query list of availability zones
      • Retrieve the Domain Name List API
    • Reserved Instance Related Interfaces
      • Accept Reserved Instance Transfer
      • Adjust reserved instance
      • Bind Tag to Reserved Instance
      • Create Auto-renewal Rule for Reserved Instance
      • Create reserved instances
      • Disable Auto-renewal Rule for Reserved Instance
      • Initiate Reserved Instance Transfer
      • Query Reserved Instance
      • Reject Reserved Instance Transfer
      • Renew reserved instances
      • Reserved Instance Inbound List
      • Reserved Instance Outbound List
      • Revoke Reserved Instance Transfer
      • Unbind Tag from Reserved Instance
    • Security Group Related Interfaces
      • Authorize security group rules
      • Create a security group
      • Delete a security group
      • Delete security group rules
      • Instance associating with security group
      • Query the security group list
      • Replace security group for instance
      • Revoke security group rules
      • Unbind security group from instance
      • Update security group rules
    • Service domain
    • Snapshot Related Interfaces
      • Bind a tag to a snapshot chain
      • Create a snapshot
      • Delete a snapshot
      • Query snapshot chain list
      • Query snapshot details
      • Query the snapshot list
      • Replicate a snapshot across regions
      • Unbind a tag from a snapshot chain
    • Spot Instance Related Interfaces
      • Cancel Spot Instance Order
      • Create spot instances
      • Query Spot Instance Packages
      • Query Spot Price
  • Cloud Assistant API and SDK Reference
    • Python SDK
      • Batch Retrieval of bsm-agent State within Instances
      • CaClient
      • Command Interface
      • Historical records
      • Initialization
      • Install SDK
      • Log API
  • Cloud Assistant API Reference
    • Batch Retrieve Instance BSM-Agent Status
    • Command Interface
    • Common Request and Response Headers
    • Error response
    • General Description
    • Historical records
    • Log API
    • Service domain
  • FAQs
    • Billing class
    • Common Questions Overview
    • Images
    • Instances
    • Network class
    • Performance
    • Reserved Instance
    • Security class
    • Snapshots
    • Storage class
    • Virtual machine operation and maintenance class
  • Fault handling
    • GPU Instance Downtime Troubleshooting
    • Linux Baidu Cloud Compute Entering Single User Mode to Reset Paasword Reports Error-Authentication token lock busy
    • Linux Baidu Cloud Compute Entering Single User Mode to Reset Paasword Reports Error-Authentication token manipulation error
    • Linux Baidu Cloud Compute Entering Single User Mode to Reset Root Paasword
    • Linux Baidu Cloud Compute Execution Yum Update Reports Dependency Conflict
    • Linux Baidu Cloud Compute Setting Login Method
    • Unable to Remotely Connect to Linux Instance
    • Unable to Remotely Connect to Windows Instance
    • Windows Server Cannot Ping
  • Function Release Records
  • Go-SDK
    • Automatic snapshot policy
    • Availability zone
    • Dedicated CDS Cluster
    • Deployment group
    • Disk
    • Elastic high-performance computing cluster
    • Image
    • Initialization
    • Instance
    • Key pair
    • Overview
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
  • Java-SDK
    • Automatic snapshot policy
    • Availability zone
    • BCC instance
    • BccClient
    • Deployment group
    • Disk
    • Exception handling
    • Image
    • Install the SDK Package
    • Key pair
    • Log
    • Overview
    • Quick Start
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
    • Version Change Records
  • Operation guide
    • Deployment group
      • Adjust Deployment Group for Existing Instances
      • Create BCC Instance within Deployment Group
      • Create Deployment Group
      • Delete Deployment Group
      • Modify Deployment Group Information
      • Overview of deployment policy
      • Remove BCC Instance from Deployment Group
    • Elastic high-performance computing cluster
      • Create Elastic High-performance Computing Cluster
      • Overview of elastic hyper-computing cluster
    • Image
      • Baidu AI Cloud Image Service Agreement
      • Create a custom image
      • Creating Linux Image Based on Local System
      • Cross-region image replication
      • Data and Personal Information Protection Statement
      • Delete a custom image
      • How to Set Network Adapter Multi-Queue Properties
      • Image List
      • Image Overview
      • Image Quick Guide
      • Import Custom Image
        • Checking Network Configuration
        • Checking Virtio Driver
        • Creating Instance Using Imported Custom Image
        • Detecting Image Using Image Detection Tool
        • Image format check
        • Image Format Conversion
        • Image Import Restrictions
        • Import Overview
        • Install cloudbase-init
        • Installing Virtio Driver
        • System Optimization Operations (Linux)
      • OS Official End of Maintenance Plan
      • Public Image Release Records
        • 2023 BCC Public Image Release Records
        • 2023 EBC Public Image Release Records
        • 2024 BCC Public Image Release Records
        • 2024 EBC Public Image Release Records
        • 2025 BCC Public Image Release Records
      • Reinstall OS
      • Share a custom image
      • Windows Image Creation
    • Instance
      • Batch Sequential Naming
      • Change Availability Zone
      • Change Charge Type
        • Postpay to Subscription
        • Subscription to Postpay
      • Change Instance Configuration
      • Create instance
        • Create Instance Navigation
        • Create Instance via Custom Image
        • Create Instance via Purchase Page
        • Create Instances with Launch Templates
        • Purchase Instance with Same Configuration
      • Cross-AZ migration
      • Functional restrictions
      • Instance Overview
      • Modify instance name
      • Postpay Instance No Charge for Stopped Instances
      • Reboot an instance
      • Reclaim instance
      • Release an instance
      • Renew an instance
      • Reset password
      • Set IAM Role
      • Sign in to instance
        • Log in to Linux Instance
          • Connect to Baidu Cloud Compute Using SmartTerm
          • Connect to Linux instance using user name-password certification
          • Log in to Linux Instance Using SSH Key on Linux or Mac
          • Log in to Linux Instance Using SSH Key via SecureCRT
          • Remotely sign in to Baidu Cloud Computer via VNC
          • Sign in to Linux instances via SSH key in Putty
          • Sign in to Linux instances via SSH key in Xshell
        • Log in to Windows Instance
          • Remotely sign in to Baidu Cloud Computer via VNC
          • Sign in to Windows instance via remote desktop
        • Login Method Overview
      • Spot instances
        • Create spot instances
        • What Is Spot Instance
      • Start an instance
      • Stop an instance
        • Elastic Baremetal Instance and Elastic High-performance Computing Cluster Instance Halt Capability Configuration Instructions
        • Stop an instance
      • View instance
    • Launch Template
    • Network
      • Bind and Unbind EIP
      • Change Internal IP
      • Change subnet
      • Change VPC
      • Configure Dual Network Interface Card External Network Access for Windows Baidu Cloud Compute
      • Configure IPv6 Address
      • Elastic network interface
        • Configure elastic network interface
        • Create elastic network interface
        • Elastic Network Interface Overview
        • Mount elastic network interface
      • Elastic RDMA Network Interface
        • Elastic RDMA Network Interface Overview
        • Instructions for use
    • Operations and Monitor
      • Cloud Assistant
        • Cloud Assistant Overview
        • Cloud Assistant Usage Notes
        • Create command
        • FAQs
        • Historical records
        • Identity and access management
        • Instance list
        • My commands
        • Public commands
        • Upload files
      • Evacuate Faulty Instance
      • Instance Health Check
      • Maintenance Platform
        • Maintenance Platform Access Instructions
        • Maintenance Platform Overview
        • Maintenance Records Query
        • Maintenance Task
        • Pre-authorization Rule Settings
      • Monitor and Alarm
      • Self-Service Diagnostic Tool
        • Application Performance Diagnostic Tool Btune
        • Self-Service Diagnostic Tool Overview
      • Use Rescue Mode
    • Reserved Instance
      • FAQ
      • Introduction to reserved instance
      • Renew reserved instances
      • Reserved Instance AZ Change
      • Reserved Instance Cross-Account Transfer
      • Reserved Instance EHC Cluster Change
      • Reserved Instance Purchase
    • Resource Assessment
    • Security
      • Identity and access management
        • Identity and access management
        • Price Permission Control
      • Key pair
        • Bind SSH Key Pair
        • Create SSH Key Pair
        • Delete SSH Key Pair
        • SSH Key Pair Overview
        • Unbind SSH Key Pair
      • Security group
        • Associate with security group
        • Copy security group
        • Create a security group
        • Delete a security group
        • Disassociate security group
        • Edit security group
        • Security group overview
    • Server Migration
      • Migration Operation Steps
      • Server Migration Operation Process
      • Server Migration Overview
    • Snapshot
      • Automatic snapshot
      • Create disk snapshot
      • Delete a snapshot
      • Rollback snapshot
      • Snapshot Overview
    • Storage
      • Overview
      • System disk expansion
    • Tag Management
      • Configure Tag
      • Tag Management Overview
      • View Resource Bill Based on Tag
  • Operations Reference
    • Linux Operations Reference
      • Baidu Cloud Compute Delete or Modify File Prompting File System Read-Only
      • CentOS 7 Install Docker
      • Configure Linux Analysis Tools atop and kdump
      • Enter Single User Mode
        • CentOS 6 Enter Single User
        • CentOS 7 Enter Single User
        • CentOS 8 Enter Single User
        • FreeBSD 11 Single User Modify Password SOP
        • opensuse42
          • 3 Enter Single User
        • Ubuntu Enter Single User
        • OpenSUSE 42_3 Enter Single User
      • How to Enable or Disable Intel CPU Vulnerability Patch in Linux Image
      • How to Handle System Boot Exception Caused by fstab Configuration
      • How to Resolve Unable to Log in to Linux BCC Instance via SSH
      • Linux BCC Instance Insufficient Space Issue Resolution
      • Linux BCC Instance Lagging Issue
      • Linux Format and Mount Instance Mount Local Disk
      • Linux Modify Default Remote Connection Port
      • Linux Server CPU and Memory Full Issue Troubleshooting
      • Linux System Install Graphical Interface and Remote Connection
        • CentOS
          • CentOS 8 Install Graphical Interface and Connect Using VNC Viewer
          • CentOS6
            • 5 Install KDE Desktop Graphical Interface and Connect Using VNC Viewer
          • CentOS7
            • 2 Install GNOME Graphical Interface and Connect Using VNC Viewer
          • Install GNOME GUI on CentOS 7_2 and Connect via VNC Viewer
          • Install GUI on CentOS 8 and Connect via VNC Viewer
          • Install KDE Desktop GUI on CentOS 6_5 and Connect via VNC Viewer
        • opensuse
          • opensuse42
            • 3 Install Graphical Interface and Connect Using VNC Viewer
          • Install GUI on OpenSUSE 42_3 and Connect via VNC Viewer
        • Ubuntu
          • Ubuntu14
            • 04 Install Graphical Interface and Connect Using VNC Viewer
          • Ubuntu18
            • 04 Install Graphical Interface and Connect Using VNC Viewer
          • Install GUI on Ubuntu 14_04 and Connect via VNC Viewer
          • Install GUI on Ubuntu 18_04 and Connect via VNC Viewer
      • Performance test
        • Linux CPU Performance Test
        • Linux Disk IO Performance Test
        • Linux Network Performance Test
      • Ubunut16_04 Subscription Extended Security Maintenance (ESM)
    • Server configuration
      • Debian 9 Software Source Configuration Update
      • Linux PIP Configuration with Baidu Source
      • Online Instance with OFED Driver Kernel Replacement Solution
      • Windows PIP Configuration with Baidu Source
    • Windows Operations Reference
      • Blue Screen Crash General Handling Method
      • Configure Multi-User Access to Windows Server
      • Connecting to Windows Server Using Xshell
      • Data Disk Not Displayed After Server Reboot
      • Desktop and Application Color Turning Black Handling Method
      • Local Playback of Sound from Windows Server
      • Performance Resources
      • Remote Connection to Windows Unable to Use Clipboard
      • System Activation
      • System Black Screen Handling Method
      • Tutorial on Disabling Windows Firewall
      • Windows Allow Single User to Connect Multiple Sessions Method
      • Windows automatic update-related configuration
      • Windows BCC Instance Achieve SID Uniqueness After Joining Domain
      • Windows BCC Instance Lagging Issue
      • Windows CPU and Memory Full Troubleshooting Steps
      • Windows Delete Hardware Reserved Memory
      • Windows Instance Disk Space Insufficient Cleanup Tutorial
      • Windows Modify Default Remote Connection Port
      • Windows Quick Login
      • Windows Server Disable IE Enhanced Security Configuration Tutorial
      • Windows Set Only Allow Local & Fixed IP Access Remote Port
      • Windows Virtual Machine Auto Login Failure Handling Method
  • Product Description
    • Application scenarios
    • Correspondence Between Original and New Model Names
    • Discontinued Instance Specifications
    • Models and Their Regions
    • Product advantages
    • Usage restrictions
    • What Is Baidu Cloud Compute BCC
    • Instance specification
  • Product pricing
    • Billing overview
    • Charge type
      • Postpay Pricing
      • Reserved instances
      • Subscription (Prepay) Pricing
      • Reserved Instance
    • Refund policy
  • Python-SDK
    • BccClient
    • Disk
    • Image
    • Initialization
    • Install the SDK Package
    • Instance
    • Overview
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
    • Version Change Records
  • Python3-SDK
    • Automatic snapshot policy
    • BccClient
    • Dedicated CDS Cluster
    • Deployment group
    • Disk
    • Image
    • Initialization
    • Install the SDK Package
    • Instance
    • Key pair
    • Overview
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
  • Quick Start
    • Baidu Cloud Compute Security Description
    • Quick Configuration of Linux Baidu Cloud Compute
    • Quick Configuration of Windows Baidu Cloud Compute
  • Resources
    • Baidu AI Cloud Image Service Agreement
    • Image Quick Guide
  • Service Level Agreement (SLA)
    • Baidu Intelligent Cloud Baidu Cloud Compute Trusted Cloud
    • BCC Service Level Agreement SLA (V3_0)
  • Tag Service API Reference
    • Appendix 1
    • Domain name
    • General Description
    • Interface List
      • Create tag
      • Delete tag
      • Tag List
      • View resources bound to a tag
    • Introduction
  • Transfer
    • Site Offline Migration Solution
    • Site Smooth Migration Solution
  • Typical Practices
    • Connecting to Windows Server Using Xshell
    • Environment Setup
      • Manual Deployment of SQL Server 2008 R2 Express Edition
      • One-Click Setup for Linux Palworld Server
      • One-Click Setup for Windows Palworld Server
      • Set Up FTP Service on Linux
      • Setting Up Baota on Linux
      • Setting Up Baota on Windows
      • Tutorial on Setting Up IIS and FTP on Windows
      • Typical Practice for Setting Up Access VPN
      • Installing MySQL 8_0 Using Yum on CentOS 7 yum
    • Set Up FTP Service on Linux
    • Tag Management Practice
    • Tutorial on Disabling IE Enhanced Security Configuration on Windows Server 2008
    • Tutorial on Disabling Windows Firewall
    • Website Building Tutorial
      • Building a Website Using IIS Service on Windows 2008 and Windows 2012
      • Deploy SSL Certificate on Baidu Cloud Compute - Apache
      • Deploy SSL Certificate on Baidu Cloud Compute - IIS
      • Deploy SSL Certificate on Baidu Cloud Compute - Nginx
      • Deploy SSL Certificate on Baidu Cloud Compute - Tomcat
      • Installing and Configuring Apache Environment on Windows
      • Installing and Configuring Nginx Environment on Windows
      • CentOS-7_2 LNMP Environment Deployment
      • Deploy LAMP Environment on CentOS-7_2
  • Video Zone
    • Fault handling
    • Operation guide
      • Basic Functions
      • Environment Setup
      • Network Related
      • Operations Reference
      • Paasword Function
    • Operation guide
    • Product introduction
All documents
menu
No results found, please re-enter

BCC BCC

  • API Reference
    • Appendix
    • Automatic Snapshot Policy Related Interfaces
      • Bind automatic snapshot policy
      • Create automatic snapshot policy
      • Delete automatic snapshot policy
      • Query details of automatic snapshot policy
      • Query the list of automatic snapshot policies
      • Unbind automatic snapshot policy
      • Update automatic snapshot policy
    • Cluster Management Related Interfaces
      • Create EHC Cluster
      • Delete EHC Cluster
      • EHC Cluster List
      • Modify EHC Cluster
    • Common Request Headers and Response Headers
    • Dedicated Cluster Related Interfaces
      • Canceling Dedicated Cluster Auto-Renewal
      • Create a dedicated cluster
      • Dedicated Cluster Renewal
      • Dedicated Cluster Tag Binding
      • Dedicated Cluster Tag Unbinding
      • Enabling Dedicated Cluster Auto-Renewal
      • Querying Dedicated Cluster Details
      • Querying Dedicated Cluster List
      • Resizing Dedicated Cluster
    • Deployment Group Related Interfaces
      • Adjust Deployment Group
      • Create Deployment Group
      • Delete Deployment Group
      • Get Deployment Group Details
      • Modify deployment group
      • Query the deployment group list
      • Remove Instance from Deployment Group
    • Disk Related Interfaces
      • Attach a CDS disk
      • Bind a tag to a disk
      • Cancel Auto-renewal
      • Create a CDS disk
      • Detach a CDS disk
      • Disk Expansion and Type Change
      • Enable auto-renewal
      • Get Purchasable Disk Information
      • Modify disk properties
      • Query CDS Price
      • Query disk details
      • Query the disk list
      • Release a CDS disk (new)
      • Release a CDS disk
      • Rename a disk
      • Renew a disk
      • Roll back disk data
      • Shift charge for disks
      • Unbind a tag from a disk
    • Error response
    • General Description
    • Image Related Interfaces
      • Bind a tag to an image
      • Cancel cross-region replication of custom images
      • Create a custom image
      • Delete a custom image
      • Import an image
      • Modify Custom Image Name
      • Query available public image based on instance specifications
      • Query image details
      • Query List of Users with Shared Image Access
      • Query OS information based on instance IDs in batch
      • Query the image list
      • Replicate a custom image across regions
      • Share a custom image
      • Unbind a tag from an image
      • Unshare a custom image
    • Instance Related Interfaces
      • Add an instance to a security group
      • Add IPv6
      • Batch Adding Secondary IP Addresses for Primary Network Interface Card
      • Batch Convert to Postpay
      • Batch Unsubscribe Prepaid Instances
      • Billing Change - Convert to Subscription
      • Bind a role
      • Bind a tag to an instance
      • Change the instance subnet
      • Change the instance VPC
      • Convert to prepay in batch
      • Create an instance (by specifying instance package specifications)
      • Create automatic renewal rules
      • Create instance
      • Delete automatic renewal rules
      • Delete secondary IP address from the primary network interface card in batch
      • Early Release of Prepaid Instances
      • Enter rescue mode
      • Exit rescue mode
      • Instance Resizing (By Specifying Instance Package Specification)
      • Modify instance attributes
      • Modify instance description
      • Modify instance hostname
      • Modify the instance password
      • Query Instance List by Instance ID
      • Query instance list
      • Query Multiple Instance Details
      • Query recycle bin instance list
      • Query resizing specifications
      • Query the custom data of the instance
      • Query the details of a specified instance
      • Query the list of BCC instances eligible for no charge for stopped instances
      • Query the VNC address of the instance
      • Reboot an instance
      • Reinstall an instance
      • Reinstall OS for Instances (Batch Reinstallation)
      • Release instances in batch
      • Release IPv6
      • Release Postpay Instances (Release via POST Request)
      • Release recycle bin instances
      • Remove an instance from a security group
      • Remove the relationship between an instance and its deployment group
      • Renew an instance
      • Resize instances in batches
      • Resuming Billing for BCC in Recycle Bin
      • Retrieve a list of instance roles
      • Retrieve network interface card information for an instance
      • Set Auto-release of Spot Instance EIP
      • Set Instance Deletion Protection
      • Setting Auto-Release for Postpay
      • Start an instance
      • Starting Instances (Batch Start)
      • Stop an instance
      • Stopping Instances (Batch Stop)
      • Unbind a role
      • Unbind a tag from an instance
    • Key Pair Related Interfaces
      • Bind a key pair
      • Change description of key pair
      • Create a key pair
      • Delete a key pair
      • Import a key pair
      • Query key pair details
      • Query the key pair list
      • Rename a key pair
      • Unbind a key pair
    • Maintenance platform APIs
      • Maintenance Records Related Interfaces
      • Maintenance Task Related Interfaces
      • Pre-authorization Related Interfaces
    • Other APIs
      • Query instance package price
      • Query instance package specifications (new)
      • Querying Availability Zones By Package Specification
    • Overview
    • Region and Availability Zone Related Interfaces
      • Query list of availability zones
      • Retrieve the Domain Name List API
    • Reserved Instance Related Interfaces
      • Accept Reserved Instance Transfer
      • Adjust reserved instance
      • Bind Tag to Reserved Instance
      • Create Auto-renewal Rule for Reserved Instance
      • Create reserved instances
      • Disable Auto-renewal Rule for Reserved Instance
      • Initiate Reserved Instance Transfer
      • Query Reserved Instance
      • Reject Reserved Instance Transfer
      • Renew reserved instances
      • Reserved Instance Inbound List
      • Reserved Instance Outbound List
      • Revoke Reserved Instance Transfer
      • Unbind Tag from Reserved Instance
    • Security Group Related Interfaces
      • Authorize security group rules
      • Create a security group
      • Delete a security group
      • Delete security group rules
      • Instance associating with security group
      • Query the security group list
      • Replace security group for instance
      • Revoke security group rules
      • Unbind security group from instance
      • Update security group rules
    • Service domain
    • Snapshot Related Interfaces
      • Bind a tag to a snapshot chain
      • Create a snapshot
      • Delete a snapshot
      • Query snapshot chain list
      • Query snapshot details
      • Query the snapshot list
      • Replicate a snapshot across regions
      • Unbind a tag from a snapshot chain
    • Spot Instance Related Interfaces
      • Cancel Spot Instance Order
      • Create spot instances
      • Query Spot Instance Packages
      • Query Spot Price
  • Cloud Assistant API and SDK Reference
    • Python SDK
      • Batch Retrieval of bsm-agent State within Instances
      • CaClient
      • Command Interface
      • Historical records
      • Initialization
      • Install SDK
      • Log API
  • Cloud Assistant API Reference
    • Batch Retrieve Instance BSM-Agent Status
    • Command Interface
    • Common Request and Response Headers
    • Error response
    • General Description
    • Historical records
    • Log API
    • Service domain
  • FAQs
    • Billing class
    • Common Questions Overview
    • Images
    • Instances
    • Network class
    • Performance
    • Reserved Instance
    • Security class
    • Snapshots
    • Storage class
    • Virtual machine operation and maintenance class
  • Fault handling
    • GPU Instance Downtime Troubleshooting
    • Linux Baidu Cloud Compute Entering Single User Mode to Reset Paasword Reports Error-Authentication token lock busy
    • Linux Baidu Cloud Compute Entering Single User Mode to Reset Paasword Reports Error-Authentication token manipulation error
    • Linux Baidu Cloud Compute Entering Single User Mode to Reset Root Paasword
    • Linux Baidu Cloud Compute Execution Yum Update Reports Dependency Conflict
    • Linux Baidu Cloud Compute Setting Login Method
    • Unable to Remotely Connect to Linux Instance
    • Unable to Remotely Connect to Windows Instance
    • Windows Server Cannot Ping
  • Function Release Records
  • Go-SDK
    • Automatic snapshot policy
    • Availability zone
    • Dedicated CDS Cluster
    • Deployment group
    • Disk
    • Elastic high-performance computing cluster
    • Image
    • Initialization
    • Instance
    • Key pair
    • Overview
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
  • Java-SDK
    • Automatic snapshot policy
    • Availability zone
    • BCC instance
    • BccClient
    • Deployment group
    • Disk
    • Exception handling
    • Image
    • Install the SDK Package
    • Key pair
    • Log
    • Overview
    • Quick Start
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
    • Version Change Records
  • Operation guide
    • Deployment group
      • Adjust Deployment Group for Existing Instances
      • Create BCC Instance within Deployment Group
      • Create Deployment Group
      • Delete Deployment Group
      • Modify Deployment Group Information
      • Overview of deployment policy
      • Remove BCC Instance from Deployment Group
    • Elastic high-performance computing cluster
      • Create Elastic High-performance Computing Cluster
      • Overview of elastic hyper-computing cluster
    • Image
      • Baidu AI Cloud Image Service Agreement
      • Create a custom image
      • Creating Linux Image Based on Local System
      • Cross-region image replication
      • Data and Personal Information Protection Statement
      • Delete a custom image
      • How to Set Network Adapter Multi-Queue Properties
      • Image List
      • Image Overview
      • Image Quick Guide
      • Import Custom Image
        • Checking Network Configuration
        • Checking Virtio Driver
        • Creating Instance Using Imported Custom Image
        • Detecting Image Using Image Detection Tool
        • Image format check
        • Image Format Conversion
        • Image Import Restrictions
        • Import Overview
        • Install cloudbase-init
        • Installing Virtio Driver
        • System Optimization Operations (Linux)
      • OS Official End of Maintenance Plan
      • Public Image Release Records
        • 2023 BCC Public Image Release Records
        • 2023 EBC Public Image Release Records
        • 2024 BCC Public Image Release Records
        • 2024 EBC Public Image Release Records
        • 2025 BCC Public Image Release Records
      • Reinstall OS
      • Share a custom image
      • Windows Image Creation
    • Instance
      • Batch Sequential Naming
      • Change Availability Zone
      • Change Charge Type
        • Postpay to Subscription
        • Subscription to Postpay
      • Change Instance Configuration
      • Create instance
        • Create Instance Navigation
        • Create Instance via Custom Image
        • Create Instance via Purchase Page
        • Create Instances with Launch Templates
        • Purchase Instance with Same Configuration
      • Cross-AZ migration
      • Functional restrictions
      • Instance Overview
      • Modify instance name
      • Postpay Instance No Charge for Stopped Instances
      • Reboot an instance
      • Reclaim instance
      • Release an instance
      • Renew an instance
      • Reset password
      • Set IAM Role
      • Sign in to instance
        • Log in to Linux Instance
          • Connect to Baidu Cloud Compute Using SmartTerm
          • Connect to Linux instance using user name-password certification
          • Log in to Linux Instance Using SSH Key on Linux or Mac
          • Log in to Linux Instance Using SSH Key via SecureCRT
          • Remotely sign in to Baidu Cloud Computer via VNC
          • Sign in to Linux instances via SSH key in Putty
          • Sign in to Linux instances via SSH key in Xshell
        • Log in to Windows Instance
          • Remotely sign in to Baidu Cloud Computer via VNC
          • Sign in to Windows instance via remote desktop
        • Login Method Overview
      • Spot instances
        • Create spot instances
        • What Is Spot Instance
      • Start an instance
      • Stop an instance
        • Elastic Baremetal Instance and Elastic High-performance Computing Cluster Instance Halt Capability Configuration Instructions
        • Stop an instance
      • View instance
    • Launch Template
    • Network
      • Bind and Unbind EIP
      • Change Internal IP
      • Change subnet
      • Change VPC
      • Configure Dual Network Interface Card External Network Access for Windows Baidu Cloud Compute
      • Configure IPv6 Address
      • Elastic network interface
        • Configure elastic network interface
        • Create elastic network interface
        • Elastic Network Interface Overview
        • Mount elastic network interface
      • Elastic RDMA Network Interface
        • Elastic RDMA Network Interface Overview
        • Instructions for use
    • Operations and Monitor
      • Cloud Assistant
        • Cloud Assistant Overview
        • Cloud Assistant Usage Notes
        • Create command
        • FAQs
        • Historical records
        • Identity and access management
        • Instance list
        • My commands
        • Public commands
        • Upload files
      • Evacuate Faulty Instance
      • Instance Health Check
      • Maintenance Platform
        • Maintenance Platform Access Instructions
        • Maintenance Platform Overview
        • Maintenance Records Query
        • Maintenance Task
        • Pre-authorization Rule Settings
      • Monitor and Alarm
      • Self-Service Diagnostic Tool
        • Application Performance Diagnostic Tool Btune
        • Self-Service Diagnostic Tool Overview
      • Use Rescue Mode
    • Reserved Instance
      • FAQ
      • Introduction to reserved instance
      • Renew reserved instances
      • Reserved Instance AZ Change
      • Reserved Instance Cross-Account Transfer
      • Reserved Instance EHC Cluster Change
      • Reserved Instance Purchase
    • Resource Assessment
    • Security
      • Identity and access management
        • Identity and access management
        • Price Permission Control
      • Key pair
        • Bind SSH Key Pair
        • Create SSH Key Pair
        • Delete SSH Key Pair
        • SSH Key Pair Overview
        • Unbind SSH Key Pair
      • Security group
        • Associate with security group
        • Copy security group
        • Create a security group
        • Delete a security group
        • Disassociate security group
        • Edit security group
        • Security group overview
    • Server Migration
      • Migration Operation Steps
      • Server Migration Operation Process
      • Server Migration Overview
    • Snapshot
      • Automatic snapshot
      • Create disk snapshot
      • Delete a snapshot
      • Rollback snapshot
      • Snapshot Overview
    • Storage
      • Overview
      • System disk expansion
    • Tag Management
      • Configure Tag
      • Tag Management Overview
      • View Resource Bill Based on Tag
  • Operations Reference
    • Linux Operations Reference
      • Baidu Cloud Compute Delete or Modify File Prompting File System Read-Only
      • CentOS 7 Install Docker
      • Configure Linux Analysis Tools atop and kdump
      • Enter Single User Mode
        • CentOS 6 Enter Single User
        • CentOS 7 Enter Single User
        • CentOS 8 Enter Single User
        • FreeBSD 11 Single User Modify Password SOP
        • opensuse42
          • 3 Enter Single User
        • Ubuntu Enter Single User
        • OpenSUSE 42_3 Enter Single User
      • How to Enable or Disable Intel CPU Vulnerability Patch in Linux Image
      • How to Handle System Boot Exception Caused by fstab Configuration
      • How to Resolve Unable to Log in to Linux BCC Instance via SSH
      • Linux BCC Instance Insufficient Space Issue Resolution
      • Linux BCC Instance Lagging Issue
      • Linux Format and Mount Instance Mount Local Disk
      • Linux Modify Default Remote Connection Port
      • Linux Server CPU and Memory Full Issue Troubleshooting
      • Linux System Install Graphical Interface and Remote Connection
        • CentOS
          • CentOS 8 Install Graphical Interface and Connect Using VNC Viewer
          • CentOS6
            • 5 Install KDE Desktop Graphical Interface and Connect Using VNC Viewer
          • CentOS7
            • 2 Install GNOME Graphical Interface and Connect Using VNC Viewer
          • Install GNOME GUI on CentOS 7_2 and Connect via VNC Viewer
          • Install GUI on CentOS 8 and Connect via VNC Viewer
          • Install KDE Desktop GUI on CentOS 6_5 and Connect via VNC Viewer
        • opensuse
          • opensuse42
            • 3 Install Graphical Interface and Connect Using VNC Viewer
          • Install GUI on OpenSUSE 42_3 and Connect via VNC Viewer
        • Ubuntu
          • Ubuntu14
            • 04 Install Graphical Interface and Connect Using VNC Viewer
          • Ubuntu18
            • 04 Install Graphical Interface and Connect Using VNC Viewer
          • Install GUI on Ubuntu 14_04 and Connect via VNC Viewer
          • Install GUI on Ubuntu 18_04 and Connect via VNC Viewer
      • Performance test
        • Linux CPU Performance Test
        • Linux Disk IO Performance Test
        • Linux Network Performance Test
      • Ubunut16_04 Subscription Extended Security Maintenance (ESM)
    • Server configuration
      • Debian 9 Software Source Configuration Update
      • Linux PIP Configuration with Baidu Source
      • Online Instance with OFED Driver Kernel Replacement Solution
      • Windows PIP Configuration with Baidu Source
    • Windows Operations Reference
      • Blue Screen Crash General Handling Method
      • Configure Multi-User Access to Windows Server
      • Connecting to Windows Server Using Xshell
      • Data Disk Not Displayed After Server Reboot
      • Desktop and Application Color Turning Black Handling Method
      • Local Playback of Sound from Windows Server
      • Performance Resources
      • Remote Connection to Windows Unable to Use Clipboard
      • System Activation
      • System Black Screen Handling Method
      • Tutorial on Disabling Windows Firewall
      • Windows Allow Single User to Connect Multiple Sessions Method
      • Windows automatic update-related configuration
      • Windows BCC Instance Achieve SID Uniqueness After Joining Domain
      • Windows BCC Instance Lagging Issue
      • Windows CPU and Memory Full Troubleshooting Steps
      • Windows Delete Hardware Reserved Memory
      • Windows Instance Disk Space Insufficient Cleanup Tutorial
      • Windows Modify Default Remote Connection Port
      • Windows Quick Login
      • Windows Server Disable IE Enhanced Security Configuration Tutorial
      • Windows Set Only Allow Local & Fixed IP Access Remote Port
      • Windows Virtual Machine Auto Login Failure Handling Method
  • Product Description
    • Application scenarios
    • Correspondence Between Original and New Model Names
    • Discontinued Instance Specifications
    • Models and Their Regions
    • Product advantages
    • Usage restrictions
    • What Is Baidu Cloud Compute BCC
    • Instance specification
  • Product pricing
    • Billing overview
    • Charge type
      • Postpay Pricing
      • Reserved instances
      • Subscription (Prepay) Pricing
      • Reserved Instance
    • Refund policy
  • Python-SDK
    • BccClient
    • Disk
    • Image
    • Initialization
    • Install the SDK Package
    • Instance
    • Overview
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
    • Version Change Records
  • Python3-SDK
    • Automatic snapshot policy
    • BccClient
    • Dedicated CDS Cluster
    • Deployment group
    • Disk
    • Image
    • Initialization
    • Install the SDK Package
    • Instance
    • Key pair
    • Overview
    • Region
    • Reserved Instance
    • Security group
    • Snapshot
  • Quick Start
    • Baidu Cloud Compute Security Description
    • Quick Configuration of Linux Baidu Cloud Compute
    • Quick Configuration of Windows Baidu Cloud Compute
  • Resources
    • Baidu AI Cloud Image Service Agreement
    • Image Quick Guide
  • Service Level Agreement (SLA)
    • Baidu Intelligent Cloud Baidu Cloud Compute Trusted Cloud
    • BCC Service Level Agreement SLA (V3_0)
  • Tag Service API Reference
    • Appendix 1
    • Domain name
    • General Description
    • Interface List
      • Create tag
      • Delete tag
      • Tag List
      • View resources bound to a tag
    • Introduction
  • Transfer
    • Site Offline Migration Solution
    • Site Smooth Migration Solution
  • Typical Practices
    • Connecting to Windows Server Using Xshell
    • Environment Setup
      • Manual Deployment of SQL Server 2008 R2 Express Edition
      • One-Click Setup for Linux Palworld Server
      • One-Click Setup for Windows Palworld Server
      • Set Up FTP Service on Linux
      • Setting Up Baota on Linux
      • Setting Up Baota on Windows
      • Tutorial on Setting Up IIS and FTP on Windows
      • Typical Practice for Setting Up Access VPN
      • Installing MySQL 8_0 Using Yum on CentOS 7 yum
    • Set Up FTP Service on Linux
    • Tag Management Practice
    • Tutorial on Disabling IE Enhanced Security Configuration on Windows Server 2008
    • Tutorial on Disabling Windows Firewall
    • Website Building Tutorial
      • Building a Website Using IIS Service on Windows 2008 and Windows 2012
      • Deploy SSL Certificate on Baidu Cloud Compute - Apache
      • Deploy SSL Certificate on Baidu Cloud Compute - IIS
      • Deploy SSL Certificate on Baidu Cloud Compute - Nginx
      • Deploy SSL Certificate on Baidu Cloud Compute - Tomcat
      • Installing and Configuring Apache Environment on Windows
      • Installing and Configuring Nginx Environment on Windows
      • CentOS-7_2 LNMP Environment Deployment
      • Deploy LAMP Environment on CentOS-7_2
  • Video Zone
    • Fault handling
    • Operation guide
      • Basic Functions
      • Environment Setup
      • Network Related
      • Operations Reference
      • Paasword Function
    • Operation guide
    • Product introduction
  • Document center
  • arrow
  • BCCBCC
  • arrow
  • Python-SDK
  • arrow
  • Instance
Table of contents on this page
  • Create an instance (by specifying instance package specifications)
  • Create an instance (deprecated; it is recommended to use the Create Instance interface instead (by specifying instance package specifications))
  • Create instances on dedicated server (support plaintext password encryption)
  • Create an instance on a dedicated server.
  • Query instance list
  • Query instance details
  • Query the instance list by the instance ID in batch
  • Start an instance
  • Stop an instance
  • Reboot an instance
  • Modify the instance password
  • Modify instance attributes
  • Reinstall an instance
  • Reinstall instance (in batch)
  • Release an instance
  • Instance scaling
  • Add an instance to a security group
  • Remove an instance from a security group
  • Bind instance to tag
  • Unbind a tag from an instance
  • Query the address of instance
  • Renew an instance
  • Enable auto-renewal
  • Delete auto-renewal
  • Change the instance subnet
  • Add secondary IPs to the primary network interface card in batch
  • Delete secondary IP address from network interface card in batches
  • Release an instance (POST)
  • Release prepaid instance (POST)
  • Retrieve instance user data information (POST)

Instance

Updated at:2025-10-20

A BCC instance refers to an active cloud server instance on Baidu AI Cloud, serving as a management entity for advanced features like billing and permission control.

Create an instance (by specifying instance package specifications)

You can create BCC instances by specification parameters with the following code

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
10                                    endpoint=HOST)
11    client = bcc_client.BccClient(config)
12    # billing = bcc_model.Billing(paymentTiming='Postpaid', reservationLength=2, reservationTimeUnit='Month')
13    response = client.create_instance_by_spec(
14 spec='bcc.g5.c1m4', # Instance specification
15 image_id='m-***', #  Image ID
16root_disk_size_in_gb=20, #  Size of system disk for virtual machine instance to be created, in GB. The default is 40 GB, with a range of [40, 2048]GB. Sizes exceeding 40 GB are charged according to cloud disk server prices. Note that the specified size of system disk must meet the minimum disk space requirement of the image used.
17root_disk_storage_type='enhanced_ssd_pl1', #  Medium of system disk for virtual machine instance to be created. By default, an SSD cloud disk server is used
18 create_cds_list=[ #  List of CDS disks to be created
19            bcc_model.CreateCdsModel(
20cdsSizeInGB=50, #  Cloud disk server (CDS) capacity, which must be a positive integer greater than 0, in GB, with a size range of 0 - 5120G
21#  CDS disk storage class, defaulting to hp1 (high-performance cloud disk). storageType='enhanced_ssd_pl1')],
22eip_name='eip***', #  Length: 1-65 bytes, starting with a letter. It can contain letters, numbers and the characters -_/. If this parameter is not provided, the service will automatically generate a name.
23internet_charge_type='BANDWIDTH_PREPAID', #  Charge type for public network bandwidth. If internetChargeType is not specified, it is based on actual bandwidth use by default.
24purchase_count=1, #  Count of virtual machine instances to be created (purchased) in batches, which must be an integer greater than 0 (optional). The default is 1.
25name='instance-***', #  Virtual machine name. By default, no name is specified. If a name is specified: For batch creation, the name serves as a prefix. The backend will append a suffix, generated as follows: name{-sequence number}.
26hostname='hostn***', #  Virtual machine hostname. By default, no hostname is specified. If a hostname is specified: For batch creation, the hostname serves as a prefix. The backend will append a suffix, generated as follows: name{-sequence number}.
27admin_pass='***', #  Instance administrator password to be specified: 8-16 characters, it must contain English letters, numbers, and symbols (limited to !@#$%^*()) simultaneously.
28zone_name='cn-bj-a', #  Specify zone information. By default, it is empty and automatically selected by the system. The list of availability zones can be queried by calling the Query Availability Zone List API. The naming convention for zoneName is lowercase "country-region-availability zone sequence", such as "cn-bj-a" for Beijing availability zone A.
29subnet_id='sbn-***', #  Specify subnet information. If empty, it is the default subnet
30security_group_id='g-***', #  Specify security group information. If empty, it is the default security group
31asp_id='asp-***', #  Automatic snapshot policy ID
32tags=[bcc_model.TagModel('key***', 'value***')], #  List of tags to be created
33    )
34    print response
  • Mandatory parameters:

    • Specification name (for example, bcc.g4.c2m8)
    • Image ID
  • Optional parameters: Refer to standard [instance creation interface](BCC/API Reference/Instance Related Interfaces/Create an instance (by specifying instance package specifications))

Create an instance (deprecated; it is recommended to use the Create Instance interface instead (by specifying instance package specifications))

The following code can be used to create BCC instances, including dedicated instances, general-purpose type I instances, general-purpose type II instances, general-purpose type III instances, GPU instances, compute-optimized type I instances, compute-optimized type II instances, and storage-optimized type I instances:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
10                                    endpoint=HOST)
11    client = bcc_client.BccClient(config)
12    # billing = bcc_model.Billing(paymentTiming='Postpaid', reservationLength=2, reservationTimeUnit='Month')
13    response = client.create_instance(
14instance_type='N6', #  Type of virtual machine instance to be created
15cpu_count=1, #  CPU core count for the VM instance to be created
16 memory_capacity_in_gb=4, #  Memory capacity for virtual machine instance to be created, in GB
17image_id='m-***', #  Image ID
18root_disk_size_in_gb=20, #  Size of system disk for virtual machine instance to be created, in GB. The default is 40 GB, with a range of [40, 2048]GB. Sizes exceeding 40 GB are charged according to cloud disk server prices. Note that the specified size of system disk must meet the minimum disk space requirement of the image used.
19root_disk_storage_type='enhanced_ssd_pl1', #  Medium of system disk for virtual machine instance to be created. By default, an SSD cloud disk server is used
20 create_cds_list=[ #  List of CDS disks to be created
21            bcc_model.CreateCdsModel(
22cdsSizeInGB=50, #  Cloud disk server (CDS) capacity, which must be a positive integer greater than 0, in GB, with a size range of 0 - 5120G
23storageType='enhanced_ssd_pl1')], #  CDS disk storage class, defaulting to hp1 (high-performance cloud disk).
24eip_name='eip***', #  Length: 1-65 bytes, starting with a letter. It can contain letters, numbers and the characters -_/. If this parameter is not provided, the service will automatically generate a name.
25internet_charge_type='BANDWIDTH_PREPAID', #  Charge type for public network bandwidth. If internetChargeType is not specified, it is based on actual bandwidth use by default.
26purchase_count=1, #  Count of virtual machine instances to be created (purchased) in batches, which must be an integer greater than 0 (optional). The default is 1.
27name='instance-***', #  Virtual machine name. By default, no name is specified. If a name is specified: For batch creation, the name serves as a prefix. The backend will append a suffix, generated as follows: name{-sequence number}.
28hostname='hostn***', #  Virtual machine hostname. By default, no hostname is specified. If a hostname is specified: For batch creation, the hostname serves as a prefix. The backend will append a suffix, generated as follows: name{-sequence number}.
29admin_pass='***', #  Instance administrator password to be specified: 8-16 characters, it must contain English letters, numbers, and symbols (limited to !@#$%^*()) simultaneously.
30zone_name='cn-bj-a', #  Specify zone information. By default, it is empty and automatically selected by the system. The list of availability zones can be queried by calling the Query Availability Zone List API. The naming convention for zoneName is lowercase "country-region-availability zone sequence", such as "cn-bj-a" for Beijing availability zone A.
31subnet_id='sbn-***', #  Specify subnet information. If empty, it is the default subnet
32security_group_id='g-***', #  Specify security group information. If empty, it is the default security group
33asp_id='asp-***', #  Automatic snapshot policy ID
34tags=[bcc_model.TagModel('key***', 'value***')], #  List of tags to be created
35eni_ids=["eni-***"] #  List of short IDs for elastic network interface cards to be mounted. During batch creation, elastic network interface cards will be evenly distributed among instances based on the count provided. Ensure that the count of elastic network interface card IDs provided is an integer multiple of the count of instances and that the count of ENIs assigned to each instance does not exceed the maximum count that can be mounted by the instance. Elastic baremetal compute (EBC) instances are not currently supported. The maximum number of eniIds is 5000.
36    )
37    print response

Please refer to [List](BCC/API Reference/Appendix.md#Regional models and optional configurations) for the list of instance types and GPU type definitions.

Create instances on dedicated server (support plaintext password encryption)

You can create BCC instances in the specific server with the following code:

Python
1    def create_instance_from_dedicated_host_with_encrypted_password(self):
2#If the user does not specify the client_token parameter, use uuid4 to generate a random string to client_token
3          generate_client_token = str(uuid.uuid4())
4          client_token = generate_client_token()
5#Set the image ID
6          image_id = 'your-choose-image-id'
7          
8# Set the dedicated server ID
9          dedicated_host_id = 'your-choose-dedicated-host-id'
10#Set the instance name
11          instance_name = 'your-choose-instance-name' + client_token
12#Set the administrator password for the instance (8-16 characters; it must contain English letters, numbers, and symbols (limited to !@#$%^*()) simultaneously)
13          admin_pass = 'your-admin-pass'
14#Specify subnet information. If empty, it is the default subnet
15          subnet_id = 'your-choose-subnet-id'
16#Specify security group information. If empty, it is the default security group
17          security_group_id = 'your-choose-security-group-id'
18#DCC dedicated server instances can create multiple local disks, requiring specifying the disk type and size
19#Other types can only use one local disk with the default type, only requiring specifying the disk type and size
20#Set the size of the local disk to be created
21          ephemeral_disk = EphemeralDisk(6144)
22#Set the local disk type to the default type
23          ephemeral_disks = [ephemeral_disk.__dict__, ephemeral_disk.__dict__]
24          self.assertEqual(
25type(self.client.create_instance_from_dedicated_host_with_encrypted_password (1, #Set the number of CPU cores for creating the BCC
262, #Set the memory size (GB) for creating the BCC
27image_id, #Set the image for creating the BCC
28dedicated_host_id, #Set the dedicated server for creating the BCC
29purchase_count=1,# Used when creating BCC instances in batches, it must be an integer greater than 0
30name=instance_name,# Set the name for creating the BCC
31admin_pass=admin_pass,# Set the instance administrator password
32subnet_id=subnet_id,# Specify the subnet information. If empty, the default subnet is used.
33security_group_id=security_group_id,# Specify the security group information. If empty, it is the default security group
34                                                                     client_token=client_token
35ephemeral_disks) #Set the local disk for creating the BCC
36                baidubce.bce_response.BceResponse)

Create an instance on a dedicated server.

You can create BCC instances in the specific server with the following code:

Python
1    def create_instance_from_dedicated_host(self):
2#If the user does not specify the client_token parameter, use uuid4 to generate a random string to client_token
3          generate_client_token = str(uuid.uuid4())
4          client_token = generate_client_token()
5#Set the image ID
6          image_id = 'your-choose-image-id'
7          
8# Set the dedicated server ID
9          dedicated_host_id = 'your-choose-dedicated-host-id'
10#Set the instance name
11          instance_name = 'your-choose-instance-name' + client_token
12#Set the administrator password for the instance (8-16 characters; it must contain English letters, numbers, and symbols (limited to !@#$%^*()) simultaneously)
13          admin_pass = 'your-admin-pass'
14#Specify subnet information. If empty, it is the default subnet
15          subnet_id = 'your-choose-subnet-id'
16#Specify security group information. If empty, it is the default security group
17          security_group_id = 'your-choose-security-group-id'
18#DCC dedicated server instances can create multiple local disks, requiring specifying the disk type and size
19#Other types can only use one local disk with the default type, only requiring specifying the disk type and size
20#Set the size of the local disk to be created
21          ephemeral_disk = EphemeralDisk(6144)
22#Set the local disk type to the default type
23          ephemeral_disks = [ephemeral_disk.__dict__, ephemeral_disk.__dict__]
24          self.assertEqual(
25type(self.client.create_instance_from_dedicated_host(1, #Set the number of CPU cores for creating the BCC
262, #Set the memory size (GB) for creating the BCC
27image_id, #Set the image for creating the BCC
28dedicated_host_id, #Set the dedicated server for creating the BCC
29purchase_count=1,# Used when creating BCC instances in batches, it must be an integer greater than 0
30name=instance_name,# Set the name for creating the BCC
31admin_pass=admin_pass,# Set the instance administrator password
32subnet_id=subnet_id,# Specify the subnet information. If empty, the default subnet is used.
33security_group_id=security_group_id,# Specify the security group information. If empty, it is the default security group
34                                                                     client_token=client_token
35ephemeral_disks) #Set the local disk for creating the BCC
36                baidubce.bce_response.BceResponse)

Query instance list

You can query the list of BCC virtual machine instances with the following code, supporting filtering by intranet IP, dedicated server ID and availability zone name:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    `AK = `b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14 res = client.list_instances(marker='i-***',  # Starting position of batch list query, which is a system-generated string
15 Max_keys=1, # Maximum number of items per page, with a maximum not exceeding 1000, default: 1,000
16 internal_ip='192.168.***.***',  # Intranet IP
17 dedicated_host_id='d-***',  # Dedicated server ID
18 zone_name='cn-bj-d', # Availability zone information
19 instance_ids='i-***',  # Multiple instance IDs, separated by English commas, maximum 100 IDs
20 instance_ids='i-***', # Multiple instance names, separated by English commas, maximum 100 IDs
21 cds_ids='v-***',  # Multiple CDS disk IDs, separated by English commas, maximum 100 IDs
22 deployset_ids='dset-***',  # Multiple deployment group IDs, separated by English commas, maximum 100 IDs
23 security_group_ids='g-***',  # Multiple security group IDs, separated by English commas, maximum 100 IDs
24 payment_timing='Postpaid',  # Payment method (Prepaid/Postpaid)
25 status='Running', # Instance status (Recycled/Running/Stopped/Stopping/Starting)
26 tags='***', # Multiple tags, separated by commas, format: tagKey:tagValue or tagKey
27 vpc_id='vpc-***',  # vpcId, which can only be used in combination with the privateIps query parameter
28 private_ips='192.168.***.***',  # Multiple Intranet IPs, separated by English commas, maximum 100 IPs, which must be used in combination with vpcId
29                                )
30    print(res)

Query instance details

You can query the detailed information of the specified BCC virtual machine with the following code:

Python
1    def get_instance(self):
2 # Set instance_id to be operated
3          instance_id = 'your-choose-instance-id'
4 #Set whether to return creation failure information; True means to return creation failure information; default: False
5          contains_failed = True
6          self.assertEqual(
7                type(self.client.get_instance(instance_id, contains_failed=contains_failed)),
8                baidubce.bce_response.BceResponse)

Query the instance list by the instance ID in batch

You can query the instance list by the instance ID in batch with the following code

Python
1    from baidubce.auth.bce_credentials import BceCredentials
2    from baidubce.bce_client_configuration import BceClientConfiguration
3    from baidubce.services.bcc import bcc_client
4    if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6        HOST = b'http://bcc.bj.baidubce.com'
7        AK = b'ak'
8        SK = b'sk'
9# Set default configuration
10        config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                        endpoint=HOST)
12# Create a BCC client
13        client = bcc_client.BccClient(config)
14 resp = client.list_instance_by_instance_ids(instance_ids=['i-***', 'i-***', 'i-***'], # List of instance IDs to be queried
15 marker='123', # Starting position of the batch list query
16 max_keys=1000, # Maximum number of items per page,
17                                                    )
18        print(resp)

Start an instance

You can start a specified BCC virtual machine instance with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14# Set instance_id to be operated
15    instance_id = 'i-***'
16    resp = client.start_instance(instance_id)
17    print(resp)

Stop an instance

You can stop a specified BCC virtual machine instance with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = 'http://bcc.bj.baidubce.com'
7    AK = 'ak'
8    SK = 'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14    resp = client.stop_instance(
15 instance_id='i-***', # Instance ID to be stopped
16 force_stop=False # Specify whether to forcibly stop instance. Options: true, false. The default is false
17 stopWithNoCharge=True # Specify whether to perform no charge for stopped instances. Options: true, false. The default is false.
18    )
19    print(resp)

Reboot an instance

You can reboot a specified BCC virtual machine instance with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14# Set instance_id to be operated
15    instance_id = 'i-***'
16# Restart instance
17    resp = client.reboot_instance(instance_id)
18    print(resp)

Modify the instance password

You can modify the administrator password of a specified BCC virtual machine instance with the following code:

Python
1    from baidubce.auth.bce_credentials import BceCredentials
2    from baidubce.bce_client_configuration import BceClientConfiguration
3    from baidubce.services.bcc import bcc_client, bcc_model
4    if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6        HOST = b'http://bcc.bj.baidubce.com'
7        AK = b'ak'
8        SK = b'sk'
9# Set default configuration
10        config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                        endpoint=HOST)
12# Create a BCC client
13        client = bcc_client.BccClient(config)
14# Set instance_id to be operated
15        instance_id = 'i-***'
16# Set new password
17        admin_pass = '***
18        resp = client.modify_instance_password(instance_id, admin_pass)
19        print(resp)

Modify instance attributes

The following code can be used to modify the name or network interface card queue count of a specified BCC virtual machine instance:

Python
1    def modify_instance_attributes(self):
2 # Set instance_id to be operated
3          instance_id = 'your-choose-instance-id'
4          name = 'name_modify'    
5 neteth_queuecount = 3  # New network interface card queue count
6          self.assertEqual(
7                type(self.client.modify_instance_attributes(instance_id,
8                                                             name=name,
9                                                             neteth_queuecount= neteth_queuecount)),
10                baidubce.bce_response.BceResponse)

Reinstall an instance

You can rebuild a specified BCC virtual machine instance using an image with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create BCC client
13    client = bcc_client.BccClient(config)
14res = client.rebuild_instance(instance_id="i-***",  # Specified instance ID
15image_id="m-***",  #   Specified image ID
16admin_pass="***",  #  Machine password (8-16 characters, it must contain English letters, numbers and symbols (limited to !@#$%^*() simultaneously)). The password must be encrypted for transmission
17key_pair_id="k-***",  #  Key pair ID to be bound to the instance being reinstalled. Either adminPass or keypairId must be specified
18                                  )
19    print(res)

Reinstall instance (in batch)

You can reinstall instances in batches with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9#  Set default configurations
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14res = client.batch_rebuild_instances(instance_ids=["i-***", "i-***"],  #  The list of specified instance IDs, maximum 100
15image_id="m-***",  #  Specified image ID
16admin_pass="***",  #  Machine password (8-16 characters, it must contain English letters, numbers and symbols (limited to !@#$%^*() simultaneously)). The password must be encrypted for transmission
17keypair_id="k-***",  #  Key pair ID to be bound to the instance being reinstalled. Either adminPass or keypairId must be specified
18                                         )
19    print(res)

Release an instance

For BCC virtual machine instances with expired postpay (Postpaid) or prepay (Prepaid) billing modes, you can release them with the following code:

Python
1    from baidubce.auth.bce_credentials import BceCredentials
2    from baidubce.bce_client_configuration import BceClientConfiguration
3    from baidubce.services.bcc import bcc_client
4    
5    if __name__ == '__main__':
6# Set your AK, SK, and the region to be accessed
7        HOST = b'http://bcc.bj.baidubce.com'
8        AK = b'ak'
9        SK = b'sk'
10# Set default configuration
11        config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
12                                        endpoint=HOST)
13# Create a BCC client
14        client = bcc_client.BccClient(config)
15    
16 resp = client.release_instance(instance_id='i-sxb2****') # Release Instance ID
17        print (resp)

Instance scaling

Support scaling the CPU and memory of BCC virtual machines. Refer to the following code for details:

Python
1    from baidubce.auth.bce_credentials import BceCredentials
2    from baidubce.bce_client_configuration import BceClientConfiguration
3    from baidubce.services.bcc import bcc_client
4    
5    if __name__ == '__main__':
6# Set your AK, SK, and the region to be accessed
7        HOST = b'http://bcc.bj.baidubce.com'
8        AK = b'ak'
9        SK = b'sk'
10# Set default configuration
11        config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
12                                        endpoint=HOST)
13# Create a BCC client
14        client = bcc_client.BccClient(config)
15    
16 resp = client.resize_instance(instance_id="i-sxb2****",  # Instance ID
17 cpu_count=4,  # CPU core count
18 memory_capacity_in_gb=16, # Memory size
19 live_resize=True, # Resize on line or not
20 enable_jumbo_frame=False) # Whether to enable Jumbo frame. True: Enable Jumbo frame; False: Disable Jumbo frame. The default is empty. When empty: If resizing to a specification that does not support Jumbo frames, Jumbo frames will not be enabled;
21# When resizing from a specification that does not support Jumbo frames to one that does, Jumbo frames will not be enabled; when resizing between specifications that both support Jumbo frames, if Jumbo frames are enabled before resizing, they will remain enabled after resizing; if they are not enabled before resizing, they will not be enabled after resizing.
22        print (resp)

Add an instance to a security group

You can add a specified BCC virtual machine instance to a designated security group with the following code:

Python
1    def bind_instance_to_security_group(self):
2 #Specify the information of security_group_id
3          security_group_id = 'your-choose-security-group-id'
4 # Set instance_id to be operated
5          instance_id = 'your-choose-instance-id'
6          self.assertEqual(type(self.client.bind_instance_to_security_group(instance_id, security_group_id)),
7                baidubce.bce_response.BceResponse)

Remove an instance from a security group

You can remove a specified instance from a designated security group with the following code:

Python
1    def unbind_instance_from_security_group(self):
2 #Specify the information of security_group_id
3          security_group_id = 'your-choose-security-group-id'
4 # Set instance_id to be operated
5          instance_id = 'your-choose-instance-id'
6          self.assertEqual(
7                type(self.client.unbind_instance_from_security_group(instance_id, security_group_id)),
8                baidubce.bce_response.BceResponse)

Bind instance to tag

The following code can be used to bind a specified tag to a specified BCC virtual machine instance:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14# Enter tag information, supporting binding to multiple tags at once
15    instance_tag1 = bcc_model.TagModel(tagKey='TestKey01',tagValue='TestValue01')
16    instance_tag2 = bcc_model.TagModel(tagKey='TestKey02',tagValue='TestValue02')
17    instance_tag_list = []
18    instance_tag_list.append(instance_tag1)
19    instance_tag_list.append(instance_tag2)
20# Set instance_id to be operated
21    instance_id = 'i-***'
22# Execute the operation of binding instance to tag
23    resp = client.bind_instance_to_tags(instance_id=instance_id, tags=instance_tag_list)
24    print(resp)

Unbind a tag from an instance

The following code can be used to unbind a specified tag from a specified BCC virtual machine instance:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14# Enter tag information, supporting binding to multiple tags at once
15    instance_tag1 = bcc_model.TagModel(tagKey='Key***',tagValue='Value***')
16    instance_tag2 = bcc_model.TagModel(tagKey='Key***',tagValue='Value***')
17    instance_tag_list = []
18    instance_tag_list.append(instance_tag1)
19    instance_tag_list.append(instance_tag2)
20# Set instance_id to be operated
21    instance_id = 'i-***'
22# Execute the operation of unbinding a tag from an instance
23    resp = client.unbind_instance_from_tags(instance_id=instance_id, tags=instance_tag_list)
24    print(resp)

Query the address of instance

You can query the VNC URL of a specified BCC virtual machine instance with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14 print(client.get_instance_vnc("i-***"))  # i-*** represents the virtual machine instance ID

Renew an instance

Renewing a BCC virtual machine extends its expiration period. You can renew the disk with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4from baidubce.services.bcc import bcc_model
5if __name__ == '__main__':
6# Set your AK, SK, and the region to be accessed
7    HOST = b'http://bcc.bj.baidubce.com'
8    AK = b'ak'
9    SK = b'sk'
10# Set default configuration
11    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
12                                    endpoint=HOST)
13# Create a BCC client
14    client = bcc_client.BccClient(config)
15 res = client.purchase_reserved_instance(instance_id='i-***',  # Virtual machine instance ID
16 billing=bcc_model.Billing('Prepaid', 1), # Order details; this interface is used to renew prepaid instances by month
17 related_renew_flag='CDS_EIP',  # Set the instance's associated renewal flag, defaulting to an empty string
18 client_token='random-uuid'  # Idempotency Token, an ASCII string with a length not exceeding 64 bits
19                                            )
20    print(res)

Enable auto-renewal

Python2
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = 'http://bcc.bj.baidubce.com'
7    AK = 'ak'
8    SK = 'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14    resp = client.batch_create_auto_renew_rules(
15 instance_id='i-***', # Instance ID
16 renew_time=2, # Renewal duration
17 renew_time_unit='year', # Unit of renewal time, month/year
18 renew_eip=True, # Whether to enable auto-renewal for EIP. Default: true
19 renew_cds=True, # Whether to enable auto-renewal for EIP. Default: true
20    )
21    print(resp)

Delete auto-renewal

Python2
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client, bcc_model
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = 'http://bcc.bj.baidubce.com'
7    AK = 'ak'
8    SK = 'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14    resp = client.batch_delete_auto_renew_rules(
15 instance_id='i-***', # Instance ID
16 renew_eip=True,  # Whether to disable auto-renewal for EIP. Default: true
17 renew_cds=True, # Whether to disable auto-renewal for EIP. Default: true
18    )
19    print(resp)

Change the instance subnet

You can change the instance subnet with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14 res = client.instance_change_subnet(instance_id="i-***",  # Virtual machine instance ID
15 subnet_id="sbn-***",  # Changed subnet ID
16 internal_ip="10.59.***.***",  # Specify Intranet IP; if not specified, it will be randomly generated
17 reboot=True,  # Whether to restart after change
18 client_token='random-uuid'  # Idempotency Token, an ASCII string with a length not exceeding 64 bits
19                                        )
20    print(res)

Add secondary IPs to the primary network interface card in batch

You can add secondary IP address to the primary network interface card in batches with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14    private_ips = ["192.168.***.***", "192.168.***.***"]
15 res = client.batch_add_ip(instance_id="i-***", # Instance ID
16 private_ips=private_ips, #  Secondary IP addresses, up to 100 IPs, which cannot be used simultaneously with SecondaryPrivateIpAddressCount
17# secondary_private_ip_address_count=2, # Number of automatically allocated IPs, which cannot be used simultaneously with PrivateIps
18 allocate_multi_ipv6_addr=True  # Whether to allocate IPV6. Creating IPV6 must be true
19                              )
20    print(res)

Delete secondary IP address from network interface card in batches

You can delete secondary IP address to the network interface card in batches with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14    private_ips = ["192.168.***.***", "192.168.***.***"]
15 res = client.batch_delete_ip(instance_id="i-***", # Instance ID
16 private_ips=private_ips, # Secondary IP addresses, maximum 100 IPs
17                                )
18    print(res)

Release an instance (POST)

You can release a single postpaid cloud server instance with the following code:

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14 res = client.release_instance_with_related_resources(instance_id="i-***", # Instance ID
15 related_release_flag=True, # Whether to release both EIPs and data disks currently attached on instance
16 delete_cds_snapshot_flag=True, # Whether to release cloud disk server snapshots
17 delete_related_enis_flag=True, # Whether to delete the associated ENI upon instance release
18 bcc_recycle_flag=True, # Whether to move the instance to the recycle bin upon release
19                                                         )
20    print(res)

Release prepaid instance (POST)

Release prepaid cloud server instance. After release, the physical resources used by the instance are reclaimed, and all related data is lost and cannot be recovered. By default, only the cloud server instance and system disk are released during the release process. Users can select whether to release the EIP and data disks attached on the cloud server instance in association. The associated EIP and data disks must either be released entirely or not at all; partial release is not supported. When selecting to release the EIP and data disks in association, cloud disk server snapshots can also be selected for associated release. If data disks are not released in association, cloud disk server snapshots cannot be released in association either.

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14 res = client.release_prepaid_instance_with_related_resources(instance_id="i-***", # Instance ID
15 related_release_flag=True, # Whether to release the EIPs and data disks currently attached on the instance at the same time (the delete_cds_snapshot_flag field will only be valid if this field is true. If this field is false, the value of the delete_cds_snapshot_flag field is invalid).
16 delete_cds_snapshot_flag=True, # Whether to release cloud disk server snapshots
17 delete_related_enis_flag=True, # Whether to delete the associated ENI upon instance release
18    print(res)

Retrieve instance user data information (POST)

Retrieve instance user data information with the following codes

Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.bcc import bcc_client
4if __name__ == '__main__':
5# Set your AK, SK, and the region to be accessed
6    HOST = b'http://bcc.bj.baidubce.com'
7    AK = b'ak'
8    SK = b'sk'
9# Set default configuration
10    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
11                                    endpoint=HOST)
12# Create a BCC client
13    client = bcc_client.BccClient(config)
14    res = client.get_instance_user_data(instance_id='i-b34ycow2')
15    print(res)

Previous
Install the SDK Package
Next
Overview