Skip to main content

Create Profile

https://infrahub-api.nexgencloud.com/v1/core/profiles

Creates a provisioning profile by saving the configuration of a virtual machine for future use. To create a profile, simply provide a name, description, and the configuration of the virtual machine you want to create a profile for in the data object, as shown below.

Choose the virtual machine configuration features that meet your requirements by following the instructions here.


Request body parameters


name string   Required

Name of the profile being created.
A string with a maximum length of 50 characters.


data string   Required

The data object that contains the configuration of the virtual machine profile being created.

Show child parameters
environment_name string   Required

Name of the environment within which your virtual machine will be created.


image_name string   Required

Name of the operating system image to be installed on your virtual machine. Use the GET /core/images endpoint to retrieve a list of images offered by Infrahub.

note

If you are creating a virtual machine from an existing bootable volume, do not provide a value for the image_name field, as the operating system is already installed on the existing bootable volume.


flavor_name string   Required

Name of the flavor corresponding to the hardware configuration (CPUs, memory, GPUs, storage and network devices) for your virtual machine. Use the GET /core/flavors endpoint to retrieve a list of available flavors.


key_name string   Required

Name of the SSH keypair to be used in gaining secure access to the virtual machine.


count integer   Required

Number of virtual machines to be deployed.


assign_floating_ip boolean  optional

Designates whether or not to assign a public IP address to the virtual machine. Setting assign_floating_ip to true makes the virtual machine publicly accessible using the SSH key pair. If you don't want your virtual machine to be publicly accessible, set the assign_floating_ip to false.


create_bootable_volume boolean  optional

Specify whether to create a virtual machine from a volume with an operating system image installed, known as a bootable volume. A true value enables creation from a bootable volume, and false disables it.

To create a virtual machine from a new bootable volume, include the desired operating system image in the image_name field and set the create_bootable_volume field to true.

If creating from an existing bootable volume, include the volume_name and set create_bootable_volume to true. For this option, do not provide a value for the image_name field, as the operating system is already installed on the existing bootable volume.


user_data string  optional

Initialization configuration data in the form of cloud-init scripts to be executed during virtual machine deployment.


callback_url string  optional

The URL where callback events will be sent whenever actions are executed on the virtual machine.


description string  optional

The optional description for the profile being created.
A string with a maximum length of 150 characters.


Attributes


status boolean

Specifies the status of the profile creation. true indicates success, while false indicates an error.


message string

A message describing the success or failure of the request to create a profile.


profile object

An object containing the configuration of the virtual machine saved in the created profile. For details on the attributes within the profile object, click here.


created_at date-time

The timestamp when the profile was created.

Request
curl -X POST "http://infrahub-api.nexgencloud.com/v1/core/profiles" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"name": "profile-1",
"description": "This is an example profile.",
"data": {
"environment_name": "Test-env",
"image_name": "Ubuntu Server 20.04 LTS",
"volume_name": "",
"create_bootable_volume": "false",
"flavor_name": "n1-cpu-medium",
"key_name": "key pair -1",
"user_data": "",
"callback_url": "",
"assign_floating_ip": "false",
"count": "1"
}
}'
Response
{
"status": true,
"message": "Profile created successfully",
"profile": {
"description": "This is an example profile.",
"id": 4,
"name": "profile-1",
"data": {
"environment_name": "Test-env",
"image_name": "Ubuntu Server 20.04 LTS",
"volume_name": "",
"create_bootable_volume": false,
"flavor_name": "n1-cpu-medium",
"key_name": "key pair -1",
"user_data": "",
"callback_url": "",
"assign_floating_ip": false,
"count": 1
}
"created_at": "2023-05-19T08:45:58"
}
}

Returns


The response includes the status of the request, a description of the status, and the profile object. This profile object contains the ID, profile name, and description (if provided). Additionally, within the profile, the data object contains the virtual machine configuration saved as a profile. For more details about the fields within the data object, click here.


Back to top