### Start Backup Job (with Optional Parameters) Source: https://docs.k2.cloud/en/api/backup/actions/StartBackupJob.html Starts a backup job with additional optional parameters for lifecycle management and scheduling. This example sets the deletion period and the start window for the backup job. ```bash c2-bs StartBackupJob BackupVaultName Default ResourceArn arn:c2:ec2::my_project@my_customer:instance/i-00000000 IamRoleArn "" Lifecycle.DeleteAfterDays 3 StartWindowMinutes 120 ``` -------------------------------- ### Get Backup Selection Example Source: https://docs.k2.cloud/en/api/backup/actions/GetBackupSelection.html This example demonstrates how to call the GetBackupSelection API using the provided BackupPlanId and SelectionId. ```bash c2-bs GetBackupSelection BackupPlanId 0000-0000-0000 SelectionId 1111-1111-1111-1111 ``` -------------------------------- ### Start and Stop Instances with c2-ec2 Source: https://docs.k2.cloud/en/new/services/compute/instances/instructions.html Use these commands to start or stop instances. Ensure the c2-ec2 utility is installed and accessible. ```bash c2-ec2 StartInstances InstanceId.1 InstanceId.2 c2-ec2 StopInstances InstanceId.1 InstanceId.2 ``` -------------------------------- ### HTTP Request Example Source: https://docs.k2.cloud/en/api/iam/actions/ListUserProjectPolicies.html Demonstrates how to list project policies for a specific user via an HTTP GET request. Ensure to replace placeholder values with actual project and user names. ```http https://iam.k2.cloud/?Action=ListUserProjectPolicies &UserName=user-1 &ProjectName=project-1 ``` -------------------------------- ### List Users with c2-paas utility Source: https://docs.k2.cloud/en/api/paas/actions/ListUsers.html This command-line example shows how to list users for a PaaS service using the c2-paas utility. It requires the K2 Cloud API Client software suite to be installed. ```bash c2-paas ListUsers serviceId fm-cluster-7867D61F ``` -------------------------------- ### Create Backup Plan (Basic) Source: https://docs.k2.cloud/en/api/backup/actions/CreateBackupPlan.html This example demonstrates the basic creation of a backup plan with a name, a rule name, and a target backup vault. Use this for simple backup configurations. ```bash c2-bs CreateBackupPlan BackupPlan.BackupPlanName my_plan BackupPlan.Rules.1.RuleName my_rule BackupPlan.Rules.1.TargetBackupVaultName Default ``` -------------------------------- ### Create Network Interface with Switch ID Source: https://docs.k2.cloud/en/api/ec2/actions/network_interfaces/CreateNetworkInterface.html Creates a network interface specifying only the Switch ID. This is a basic example to get started. ```bash c2-ec2 CreateNetworkInterface SwitchId sw-12345678 ``` -------------------------------- ### Create Backup Plan (Advanced) Source: https://docs.k2.cloud/en/api/backup/actions/CreateBackupPlan.html This example shows how to create a backup plan with more detailed configurations, including completion and start window minutes, lifecycle rules for deletion, and a specific schedule expression. Use this for complex backup scheduling and retention policies. ```bash c2-bs CreateBackupPlan BackupPlan.BackupPlanName my_plan BackupPlan.Rules.1.RuleName my_rule BackupPlan.Rules.1.TargetBackupVaultName Default BackupPlan.Rules.1.CompletionWindowMinutes 120 BackupPlan.Rules.1.Lifecycle.DeleteAfterDays 2 BackupPlan.Rules.1.ScheduleExpression "cron(0 10 * * *)" BackupPlan.Rules.1.StartWindowMinutes 90 ``` -------------------------------- ### HTTP Request Example Source: https://docs.k2.cloud/en/api/iam/actions/ListIDProviderGroupProjectGroups.html Example of an HTTP GET request to the ListIDProviderGroupProjectGroups API. ```http https://iam.k2.cloud/?Action=ListIDProviderGroupProjectGroups &IDProviderName=company &IDProviderGroupName=AdminGroup &ProjectName=project-1 ``` -------------------------------- ### Get Hosted Zone Example Source: https://docs.k2.cloud/en/api/route53/actions/GetHostedZone.html Example of how to call the GetHostedZone action with a specific zone ID. ```bash c2-route53 GetHostedZone Id z-xxxxxxxx ``` -------------------------------- ### Install QEMU Guest Agent on Ubuntu Source: https://docs.k2.cloud/en/new/services/compute/instances/instructions.html Install the qemu-guest-agent package on Ubuntu systems using apt. ```bash sudo apt update sudo apt install qemu-guest-agent ``` -------------------------------- ### HTTP Request Example Source: https://docs.k2.cloud/en/api/directconnect/actions/DescribeVirtualInterfaces.html This example shows a basic HTTP GET request to the DescribeVirtualInterfaces API action. ```HTTP https://directconnect.ru-msk.k2.cloud/?Action=DescribeVirtualInterfaces ``` -------------------------------- ### Import Snapshot Example Source: https://docs.k2.cloud/en/api/ec2/actions/import_export/ImportSnapshot.html This example demonstrates how to import a snapshot using the ImportSnapshot command. It includes required disk container information and optional parameters like description, notification settings, and email. ```bash c2-ec2 ImportSnapshot Description "description" DiskContainer.Description "snap description" DiskContainer.Format "VMDK" DiskContainer.UserBucket.S3Bucket "snap description" DiskContainer.UserBucket.S3Key "snap.vmdk" Notify True Email test@test.test ``` -------------------------------- ### c2-iam CLI Usage Example Source: https://docs.k2.cloud/en/api/iam/actions/GetIDProvider.html Example of how to use the c2-iam command-line tool to get identity provider information. ```APIDOC ```bash c2-iam GetIDProvider IDProviderName company ``` ``` -------------------------------- ### Start Backup Job (Basic) Source: https://docs.k2.cloud/en/api/backup/actions/StartBackupJob.html Initiates a backup job with essential parameters. Ensure the BackupVaultName, ResourceArn, and IamRoleArn are correctly specified. ```bash c2-bs StartBackupJob BackupVaultName Default ResourceArn arn:c2:ec2::my_project@my_customer:instance/i-00000000 IamRoleArn "" ``` -------------------------------- ### List Databases using c2-paas utility Source: https://docs.k2.cloud/en/api/paas/actions/ListDatabases.html This command-line example shows how to list databases for a PaaS service using the c2-paas utility. It requires the K2 Cloud API Client software suite to be installed and configured. ```bash c2-paas ListDatabases serviceId fm-cluster-7867D61F ``` -------------------------------- ### HTTP Request Example for ListUserGlobalGroups Source: https://docs.k2.cloud/en/api/iam/actions/ListUserGlobalGroups.html This snippet shows an example HTTP GET request to the ListUserGlobalGroups API, specifying the UserName parameter. ```http https://iam.k2.cloud/?Action=ListUserGlobalGroups &UserName=user-1 ``` -------------------------------- ### Install QEMU Guest Agent on Ubuntu Source: https://docs.k2.cloud/en/new/services/backup/instructions.html Installs the QEMU Guest Agent and enables its service on Ubuntu systems. ```bash apt install qemu-guest-agent systemctl enable qemu-guest-agent ``` -------------------------------- ### HTTP Request Example Source: https://docs.k2.cloud/en/api/directconnect/actions/DescribeDirectConnectGatewayAssociations.html An example of an HTTP GET request to describe Direct Connect gateway associations, filtering by association ID. ```HTTP https://directconnect.ru-msk.k2.cloud/?Action=DescribeDirectConnectGatewayAssociations &associationId=dxassoc-4419A549 ``` -------------------------------- ### List PaaS Services using c2-paas utility Source: https://docs.k2.cloud/en/api/paas/actions/ListServices.html This command-line example shows how to list PaaS services using the c2-paas utility. Specify the service type as an argument. ```bash c2-paas ListServices serviceType redis ``` -------------------------------- ### Create and Configure .NET Project Source: https://docs.k2.cloud/en/api/tools/aws-sdk-net.html Create a new .NET console project and add the necessary AWS SDK packages. This sets up the project for S3 interaction. ```bash dotnet new console --name awsdotnets3 && cd awsdotnets3 dotnet add package AWSSDK.Core dotnet add package AWSSDK.S3 ``` -------------------------------- ### RunInstances with Network Interfaces Source: https://docs.k2.cloud/en/new/api/ec2/actions/instances/RunInstances.html Examples for launching instances with new or existing network interfaces, including configurations for public IP association, deletion on termination, and security groups. ```APIDOC ## RunInstances with Network Interfaces ### Description Launches EC2 instances by specifying one or more network interfaces, which can be new or existing. ### Method POST ### Endpoint /RunInstances ### Parameters #### Query Parameters - **ImageId** (string) - Required - The ID of the Amazon Machine Image (AMI) to use for the instance. - **InstanceType** (string) - Required - The type of instance to launch (e.g., m1.micro). - **MinCount** (integer) - Required - The minimum number of instances to launch. - **MaxCount** (integer) - Required - The maximum number of instances to launch. - **NetworkInterface** (list of objects) - Optional - A list of network interface specifications. - **DeviceIndex** (integer) - Required - The network interface's index. - **NetworkInterfaceId** (string) - Optional - The ID of an existing network interface to attach. - **SubnetId** (string) - Optional - The ID of the subnet for a new network interface. - **AssociatePublicIpAddress** (boolean) - Optional - Whether to associate a public IP address with a new network interface. - **DeleteOnTermination** (boolean) - Optional - Whether to delete the network interface when the instance terminates. - **Description** (string) - Optional - A description for the new network interface. - **Primary** (boolean) - Optional - Indicates if this is the primary network interface. - **PrivateIpAddress** (string) - Optional - The private IP address to assign to a new network interface. - **PrivateIpAddresses** (list of objects) - Optional - List of private IP addresses for a new network interface. - **SecurityGroupId** (list of strings) - Optional - List of security group IDs for a new network interface. ### Request Example ```bash # Single subnet interface (new, with additional security groups): c2-ec2 RunInstances ImageId InstanceType MinCount 1 MaxCount 1 NetworkInterface.1.DeviceIndex 0 NetworkInterface.1.SubnetId NetworkInterface.1.SecurityGroupId.1 NetworkInterface.1.SecurityGroupId.2 # Single existing interface (subnet or switch): c2-ec2 RunInstances ImageId InstanceType MinCount 1 MaxCount 1 NetworkInterface.1.DeviceIndex 0 NetworkInterface.1.NetworkInterfaceId # Multiple interfaces (new and existing): c2-ec2 RunInstances ImageId InstanceType MinCount 1 MaxCount 1 NetworkInterface.1.DeviceIndex 0 NetworkInterface.1.NetworkInterfaceId NetworkInterface.2.DeviceIndex 1 NetworkInterface.2.SubnetId NetworkInterface.2.Description "eth1_description..." NetworkInterface.2.DeleteOnTermination True ``` ### Response #### Success Response (200) - **_groupSet_** (List of SecurityGroup objects) - The security groups for the instance. - **_instancesSet_** (List of Instance objects) - Information about instances. - **_ownerId_** (String) - The ID of the project. - **_requestId_** (String) - The request ID. #### Response Example ```json { "_groupSet_": [ { "groupId": "sg-0123456789abcdef0" } ], "_instancesSet_": [ { "instanceId": "i-0123456789abcdef0" } ], "_ownerId_": "123456789012", "_requestId_": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### HTTP GET Policy Request Source: https://docs.k2.cloud/en/api/iam/actions/GetPolicy.html Example of an HTTP GET request to retrieve IAM policy details. Ensure the PolicyArn is correctly formatted. ```http https://iam.k2.cloud/?Action=GetPolicy &PolicyArn=arn:c2:iam::c2dev:policy/policy-1 ``` -------------------------------- ### HTTP Request Example for GetGroup Source: https://docs.k2.cloud/en/api/iam/actions/GetGroup.html This example demonstrates how to make an HTTP GET request to retrieve group information. Ensure the GroupArn parameter is correctly specified. ```http https://iam.k2.cloud/?Action=GetGroup &GroupArn=arn:c2:iam:::group/CloudAdministrators ``` -------------------------------- ### RunInstances with Multiple Network Interfaces Source: https://docs.k2.cloud/en/new/api/ec2/actions/instances/RunInstances.html Launches an instance with multiple network interfaces, including a mix of existing and new interfaces with specific configurations like description and termination settings. This allows for complex network setups. ```bash c2-ec2 RunInstances ImageId InstanceType MinCount 1 MaxCount 1 NetworkInterface.1.DeviceIndex 0 NetworkInterface.1.NetworkInterfaceId NetworkInterface.2.DeviceIndex 1 NetworkInterface.2.SubnetId NetworkInterface.2.Description "eth1_description..." NetworkInterface.2.DeleteOnTermination True ``` ```bash aws <...> run-instances --image-id --count 1 --instance-type --network-interfaces "[{"DeviceIndex": 0, "NetworkInterfaceId": ""}, {"DeviceIndex": 1, "SubnetId": "", "Description": "eth1_description...", "DeleteOnTermination": True}]" ``` -------------------------------- ### HTTP Request Example for GetProject Source: https://docs.k2.cloud/en/api/iam/actions/GetProject.html This example demonstrates how to make an HTTP GET request to the GetProject API. Ensure you replace 'project-1' with your actual project name. ```http https://iam.k2.cloud/?Action=GetProject &ProjectName=project-1 ``` -------------------------------- ### Create .NET Project and Add AWS SDK Packages Source: https://docs.k2.cloud/en/new/api/tools/aws-sdk-net.html Initialize a new .NET console project and add the necessary AWS SDK packages for core functionality and S3 access. ```bash dotnet new console --name awsdotnets3 && cd awsdotnets3 dotnet add package AWSSDK.Core dotnet add package AWSSDK.S3 ``` -------------------------------- ### Create DHCP Options with Multiple Configurations Source: https://docs.k2.cloud/en/api/ec2/actions/dhcp_options/CreateDhcpOptions.html This example demonstrates creating DHCP options with multiple configurations, including domain name, domain name servers, and NTP servers. ```bash c2-ec2 CreateDhcpOptions DhcpConfiguration.1.Key domain-name DhcpConfiguration.1.Value.1 example.com DhcpConfiguration.2.Key domain-name-servers DhcpConfiguration.2.Value.1 10.0.0.60 DhcpConfiguration.2.Value.2 8.8.8.8 DhcpConfiguration.3.Key ntp-servers DhcpConfiguration.3.Value.1 10.0.0.53 ``` -------------------------------- ### CLI Usage Example for GetIDProvider Source: https://docs.k2.cloud/en/new/api/iam/actions/GetIDProvider.html This example shows how to use the c2-iam command-line interface to get identity provider details. Specify the identity provider name as an argument. ```bash c2-iam GetIDProvider IDProviderName company ``` -------------------------------- ### RunInstances with Subnet or Switch Source: https://docs.k2.cloud/en/new/api/ec2/actions/instances/RunInstances.html Examples for launching instances using a single subnet or multiple switches. ```APIDOC ## RunInstances with Subnet or Switch ### Description Launches EC2 instances specifying network configuration through SubnetId or SwitchId. ### Method POST ### Endpoint /RunInstances ### Parameters #### Query Parameters - **ImageId** (string) - Required - The ID of the Amazon Machine Image (AMI) to use for the instance. - **InstanceType** (string) - Required - The type of instance to launch (e.g., m1.micro). - **MinCount** (integer) - Required - The minimum number of instances to launch. - **MaxCount** (integer) - Required - The maximum number of instances to launch. - **SubnetId** (string) - Optional - The ID of the subnet to launch the instance into. - **SwitchId** (list of strings) - Optional - The IDs of the virtual switches to attach the instance to. ### Request Example ```bash c2-ec2 RunInstances ImageId InstanceType MinCount 1 MaxCount 1 SubnetId ``` ### Response #### Success Response (200) - **_groupSet_** (List of SecurityGroup objects) - The security groups for the instance. - **_instancesSet_** (List of Instance objects) - Information about instances. - **_ownerId_** (String) - The ID of the project. - **_requestId_** (String) - The request ID. #### Response Example ```json { "_groupSet_": [ { "groupId": "sg-0123456789abcdef0" } ], "_instancesSet_": [ { "instanceId": "i-0123456789abcdef0" } ], "_ownerId_": "123456789012", "_requestId_": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### HTTP Request Example for GetIDProvider Source: https://docs.k2.cloud/en/new/api/iam/actions/GetIDProvider.html This example demonstrates how to make an HTTP GET request to retrieve identity provider information. Ensure you replace placeholder values with your actual parameters. ```http https://iam.k2.cloud/?Action=GetIDProvider &IDProviderName=company ``` -------------------------------- ### Describe EFS Mount Targets (HTTP GET Request) Source: https://docs.k2.cloud/en/api/efs/actions/DescribeMountTargets.html This is an example of an HTTP GET request to the EFS API endpoint for describing mount targets. It shows the basic structure of the request. ```http GET /2015-02-01/mount-targets HTTP/1.1 ``` -------------------------------- ### c2-iam CLI Usage Source: https://docs.k2.cloud/en/new/api/iam/actions/GetPolicy.html Example of how to use the c2-iam command-line tool to get policy information. ```APIDOC ## c2-iam CLI Example ### Description This example demonstrates how to retrieve IAM policy details using the `c2-iam` command-line interface. ### Command ```bash c2-iam GetPolicy PolicyArn arn:c2:iam::c2dev:policy/policy-1 ``` ``` -------------------------------- ### Update Backup Plan (Advanced) Source: https://docs.k2.cloud/en/api/backup/actions/UpdateBackupPlan.html This example demonstrates updating a backup plan with more detailed configurations, including lifecycle rules, schedule, and window settings. All parameters are optional and can be omitted if not needed. ```bash c2-bs UpdateBackupPlan BackupPlanId 0000-0000-0000-0000 BackupPlan.BackupPlanName my_plan BackupPlan.Rules.1.RuleName my_rule BackupPlan.Rules.1.TargetBackupVaultName Default BackupPlan.Rules.1.CompletionWindowMinutes 120 BackupPlan.Rules.1.Lifecycle.DeleteAfterDays 2 BackupPlan.Rules.1.ScheduleExpression "cron(0 10 * * *)" BackupPlan.Rules.1.StartWindowMinutes 90 ``` -------------------------------- ### HTTP Request Example for UpdateUser Source: https://docs.k2.cloud/en/api/iam/actions/UpdateUser.html Demonstrates how to update a user's details using an HTTP GET request. This example shows updating the display name, password, email, phone, and enabled status. ```http https://iam.k2.cloud/?Action=UpdateUser &UserName=user-1 &DisplayName=New Name &Password=CO198)r[CCpDS24gg &Email=new@gmail.com &Phone=+0 000 000 00 00 &Enabled=False ``` -------------------------------- ### Create PaaS User with c2-paas utility Source: https://docs.k2.cloud/en/api/paas/actions/CreateUser.html This command-line example demonstrates creating a PaaS service user using the c2-paas utility from the K2 Cloud API Client software suite. ```bash c2-paas CreateUser serviceId fm-cluster-7867D61F user.name user_name user.parameters.password passwd123#! ``` -------------------------------- ### DescribeDirectConnectGatewayAssociations HTTP Request Source: https://docs.k2.cloud/en/new/api/directconnect/actions/DescribeDirectConnectGatewayAssociations.html This example demonstrates how to call the DescribeDirectConnectGatewayAssociations API using an HTTP GET request. ```APIDOC ## DescribeDirectConnectGatewayAssociations ### Description Returns the list of Direct Connect gateway associations. ### Method GET ### Endpoint https://directconnect.ru-msk.k2.cloud/?Action=DescribeDirectConnectGatewayAssociations ### Parameters #### Query Parameters - **associationId** (String) - Optional - The ID of the association. - **associatedGatewayId** (String) - Optional - The ID of the associated gateway. - **directConnectGatewayId** (String) - Optional - The ID of the Direct Connect gateway. - **virtualGatewayId** (String) - Optional - The ID of the transit gateway. ### Response #### Success Response (200) - **directConnectGatewayAssociations** (List of DirectConnectGatewayAssociation objects) - The list of associations of the Direct Connect gateways. ### Response Example ```json { "directConnectGatewayAssociations": [ { "directConnectGatewayId": "dxgw-A1BF7297", "directConnectGatewayOwnerAccount": "user-1@c2dev", "associationState": "associated", "associatedGateway": { "id": "tgw-83EDA0ED", "type": "transitGateway", "ownerAccount": "user-1@c2dev" }, "associationId": "dxassoc-4419A549", "allowedPrefixesToDirectConnectGateway": [ { "cidr": "10.0.0.0/24" } ] } ] } ``` ``` -------------------------------- ### Install kubectl on Linux Source: https://docs.k2.cloud/en/new/services/kubernetes/overview.html Downloads, makes executable, and installs the kubectl client on a Linux system. Includes a command to verify the installation. ```bash curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl kubectl version --client #command to verify installation ``` -------------------------------- ### HTTP GET Policy Response Source: https://docs.k2.cloud/en/api/iam/actions/GetPolicy.html Example response from a GetPolicy request, containing full policy details. ```xml arn:c2:iam::c2dev:policy/policy-1 2cec7683-7ecf-470f-b3f1-498a140752da policy-1 self global 1724418895 1724419323 New description {"Statement": [{"Action": ["iam:ListUsers"]}]} b774fd7b-5cfb-4ccb-9610-6b990cd31a3c b774fd7b-5cfb-4ccb-9610-6b990cd31a3c ``` -------------------------------- ### Create PaaS Database with c2-paas utility Source: https://docs.k2.cloud/en/api/paas/actions/CreateDatabase.html This command-line example demonstrates how to create a PaaS service database using the c2-paas utility from the K2 Cloud API Client software suite. ```bash c2-paas CreateDatabase serviceId fm-cluster-7867D61F database.name database_name database.backupEnabled true database.users.1.name user_name ``` -------------------------------- ### GetService HTTP Request Source: https://docs.k2.cloud/en/new/api/iam/actions/GetService.html Example of an HTTP GET request to the GetService API endpoint. Requires the ServiceName parameter. ```http https://iam.k2.cloud/?Action=GetService &ServiceName=iam ``` -------------------------------- ### StartInstances Source: https://docs.k2.cloud/en/api/ec2/actions/instances/StartInstances.html Starts an instance that you’ve previously stopped. ```APIDOC ## StartInstances ### Description Starts an instance that you’ve previously stopped. ### Request Parameters #### Query Parameters - **InstanceId.N** (Array of strings) - Required - The instance IDs. ### Response Elements #### Success Response - **instancesSet** (List of Instance objects) - Information about instances. - **requestId** (String) - The request ID. ### Example ``` c2-ec2 StartInstances InstanceId.1 i-01234567 ``` ``` -------------------------------- ### HTTP Request to DeleteGroup Source: https://docs.k2.cloud/en/api/iam/actions/DeleteGroup.html Example of an HTTP GET request to delete an IAM group. Requires the GroupName parameter. ```http https://iam.k2.cloud/?Action=DeleteGroup &GroupName=group-1 ``` -------------------------------- ### VPN Connection Creation with Tags Source: https://docs.k2.cloud/en/api/ec2/actions/vpn_connections/CreateVpnConnection.html This example demonstrates how to create a VPN connection and apply tags to it simultaneously. Tags help organize and identify your AWS resources. ```bash c2-ec2 CreateVpnConnection \ CustomerGatewayId \ Type VpnGatewayId \ TagSpecification.1.ResourceType vpn-connection \ TagSpecification.1.Tag.1.Key "tag_key" \ TagSpecification.1.Tag.1.Value "tag_value" ``` -------------------------------- ### Get Object Retention Response Source: https://docs.k2.cloud/en/new/services/object_storage/instructions.html Example JSON response showing the current retention mode and date for an object version. ```json { "Retention": { "Mode": "GOVERNANCE", "RetainUntilDate": "2024-10-01T00:00:00.000000000Z" } } ``` -------------------------------- ### HTTP Request Example Source: https://docs.k2.cloud/en/api/iam/actions/ListProjectUsers.html Demonstrates how to make an HTTP request to list users for a project. Ensure the ProjectName parameter is correctly specified. ```http https://iam.k2.cloud/?Action=ListProjectUsers &ProjectName=project-1 ```