### Bootstrap CentOS Web Server with Shell Script Source: https://docs.ionos.com/cloud/compute-services/compute-engine/how-tos/boot-cloud-init This bash script automates the setup of a CentOS web server. It updates packages, installs Apache (httpd), starts and enables the service, and creates a basic index.html file. This is useful for quickly bootstrapping a functional web server instance. ```bash #!/bin/bash # Use this for your user data (script from top to bottom) # install httpd (Linux 2 version) yum update -y yum install -y httpd systemctl start httpd systemctl enable httpd echo "

Hello World from $(hostname -f)

" > /var/www/html/index.html ``` -------------------------------- ### Download Backup Agent Installer using wget Source: https://docs.ionos.com/cloud/storage-and-backup/backup-service/how-tos/install-acronis-backup-agent This snippet demonstrates how to download the Acronis Backup Agent installer using the `wget` command. It requires the direct download URL, which can be obtained by following the steps in the documentation and modifying the provided example URL. ```shell wget https://backup.profitbricks.com/download/u/baas/x.0//name_of_your_agent.bin ``` -------------------------------- ### Install Acronis Backup Agent on Windows Server Source: https://docs.ionos.com/llms.txt Steps to install the Acronis Backup Agent on Windows Server environments. This process usually involves downloading an installer and following a guided setup wizard to integrate the agent with the backup infrastructure. ```powershell Invoke-WebRequest -Uri "http://example.com/acronis-agent-installer.exe" -OutFile "acronis-agent-installer.exe" Start-Process -FilePath ".\acronis-agent-installer.exe" -ArgumentList "/S" -Wait ``` -------------------------------- ### IONOS Cloud API Basic Authentication Example Source: https://docs.ionos.com/cloud/reference/get-started Demonstrates how to authenticate with the IONOS Cloud API using Basic Authentication. This method involves generating a token and including it in the Authorization header as a Base64 encoded string. Ensure you have your username and password to generate the initial token. ```bash curl --location \ --request GET 'https://api.ionos.com/auth/v1/tokens/generate' \ --header 'Authorization: Basic WVhKemFHRmtMbUoxYzJoeVlVQnBiMjV2Y3k1amIyMDZJMUJoYTJsemRHRnVYekU9' \ --data '' ``` -------------------------------- ### Automate Server Setup with Cloud-Init for Postfix and OpenDKIM Source: https://docs.ionos.com/cloud/tutorials/network-services/cloud-dns/reversedns This Cloud-Init configuration automates the installation of Postfix and OpenDKIM on an Ubuntu server. It includes file generation for configuration files and a shell script to generate DKIM keys upon initialization. ```bash #cloud-config packages: - postfix - opendkim - opendkim-tools - mailutils write_files: - path: /etc/postfix/main.cf content: | # Postfix configuration smtpd_banner = ESMTP $mail_name (IONOS CloudDNS Mail) biff = no append_dot_mydomain = no readme_directory = no compatibility_level = 3.6 # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_security_level=may smtp_tls_CApath=/etc/ssl/certs smtp_tls_security_level=may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = ubuntu alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = $myhostname, , ubuntu, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all # Enable OpenDKIM milter milter_default_action = accept milter_protocol = 6 smtpd_milters = inet:localhost:12301 non_smtpd_milters = inet:localhost:12301 - path: /etc/opendkim.conf content: | # OpenDKIM configuration Syslog yes SyslogSuccess yes Canonicalization relaxed/simple OversignHeaders From Domain Selector mail KeyFile /etc/opendkim/keys//mail.private UserID opendkim UMask 007 Socket inet:12301@localhost PidFile /run/opendkim/opendkim.pid TrustAnchorFile /usr/share/dns/root.key - path: /etc/cloud-init/opendkim-keys.sh permissions: '0755' content: | #!/bin/bash mkdir -p /etc/opendkim/keys/ && opendkim-genkey -t -s mail -d && mv mail.private /etc/opendkim/keys// && chown -R opendkim:opendkim /etc/opendkim/keys/ && systemctl restart opendkim - path: /etc/mailname content: "" runcmd: - sudo apt-get update - sudo apt-get install -y postfix opendkim opendkim-tools mailutils - sudo systemctl enable postfix opendkim - sudo systemctl start postfix - /etc/cloud-init/opendkim-keys.sh ``` -------------------------------- ### Initialize and Benchmark PostgreSQL with pgbench Source: https://docs.ionos.com/cloud/databases/postgresql/overview These commands show how to initialize a PostgreSQL database for benchmarking using pgbench and then run read/write and read-only performance tests. The initialization scales the database, while the benchmark commands simulate different workloads. ```bash # Initialize database pgbench -i -s 1000 -h -U # Read/Write test pgbench -c 20 -T 300 -h -U # Read-only test pgbench -c 20 -T 300 -S -h -U ``` -------------------------------- ### IONOS Cloud API Bearer Token Authentication Example Source: https://docs.ionos.com/cloud/reference/get-started Shows how to authenticate with the IONOS Cloud API using Bearer Token Authentication. This method requires obtaining a secure token, which is then passed in the Authorization header. This is the recommended method, especially for accounts with 2FA enabled. ```bash curl --location \ --request GET 'https://api.ionos.com/auth/v1/tokens/generate' \ --header 'Authorization: Bearer eyJpZCI6MTUsInVzZXJuYW1lIjoia21pbmNoZWxsZSIsImVtYWlsIjoia21pbmNoZWxsZUBxcS5jb20iLCJmaXJzdE5hbWUiOiJKZWFubmUiLCJsYXN0TmFtZSI6IkhhbHZvcnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImltYWdlIjoiaHR0cHM6Ly9yb2JvaGFzaC5vcmcvYXV0cXVpYXV0LnBuZz9zaXplPTUweDUwJnNldD1zZXQxIiwiaWF0IjoxNjM1NzczOTYyLCJleHAiOjE2MzU3Nzc1NjJ9.n9PQX8w8ocKo0dMCw3g8bKhjB8Wo7f7IONFBDqfxKhs' \ --data '' ``` -------------------------------- ### Bootstrap System Configuration with Cloud-Config Source: https://docs.ionos.com/cloud/compute-services/cubes/dcd-how-tos/boot-cloud-init Examples of YAML-based cloud-config directives for cloud-init. Includes configurations for setting up swap partitions, mounting devices, resizing the root file system, and managing user accounts with SSH keys. ```yaml #cloud-config fs_setup: - label: mylabel device: /dev/vda filesystem: ext4 - label: swap device: /dev/vdb filesystem: swap mounts: - [ /dev/vda, /, ext4, defaults, 0, 0 ] - [ /dev/vdb, none, swap, sw, 0, 0 ] ``` ```yaml #cloud-config resize_rootfs: True users: - name: pb-user gecos: Demo User sudo: ALL=(ALL) NOPASSWD:ALL groups: users, admin ssh_import_id: None lock_passwd: true ssh_authorized_keys: - ssh-rsa AAAA... ``` -------------------------------- ### POST /servers Source: https://docs.ionos.com/cloud/network-services/vdc-networking/nic-multi-queue/api-how-tos/toggle-nic-multi-queue Create a new server instance with specific hardware configurations and availability settings. ```APIDOC ## POST /servers ### Description Creates a new server instance within the IONOS cloud infrastructure. This endpoint allows for the configuration of RAM, CPU architecture, availability zones, and performance features like NIC Multi-Queue. ### Method POST ### Endpoint /servers ### Parameters #### Request Body - **properties.ram** (integer) - Required - Memory size in MB (multiples of 256, min 256). - **properties.availabilityZone** (string) - Required - Enum: `AUTO`, `ZONE_1`, `ZONE_2`. - **properties.cpuFamily** (string) - Required - CPU architecture (e.g., `INTEL_ICELAKE`). - **properties.type** (string) - Required - Server type: `ENTERPRISE` or `VCPU`. - **properties.nicMultiQueue** (boolean) - Required - Enables/disables NIC Multi-Queue feature. ### Request Example { "properties": { "ram": 4096, "availabilityZone": "AUTO", "cpuFamily": "INTEL_ICELAKE", "type": "ENTERPRISE", "nicMultiQueue": true } } ``` -------------------------------- ### GET /auth/v1/tokens/generate Source: https://docs.ionos.com/cloud/reference/get-started Generates an access token required for subsequent API requests using either Basic Authentication or Bearer Token authentication. ```APIDOC ## GET /auth/v1/tokens/generate ### Description Generates an authentication token for the IONOS Cloud API. This token is required to authorize all subsequent API requests. ### Method GET ### Endpoint https://api.ionos.com/auth/v1/tokens/generate ### Parameters #### Request Headers - **Authorization** (string) - Required - Use 'Basic [Base64EncodedCredentials]' or 'Bearer [SecureToken]' ### Request Example ```bash curl --location \ --request GET 'https://api.ionos.com/auth/v1/tokens/generate' \ --header 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **access_token** (string) - The generated token string used for API authentication. #### Response Example { "access_token": "eyJpZCI6MTUsInVzZXJuYW1lIjoia21pbmNoZWxsZSIs..." } ``` -------------------------------- ### Install Nginx, Certbot, and Python3-pip with Cloud-Init Source: https://docs.ionos.com/cloud/tutorials/network-services/cloud-dns/certbot This Cloud-Init script installs Nginx, Certbot, and python3-pip on a server. It also installs the python3-pip certbot-dns-ionos-cloud package using pip. This is useful for setting up a web server with SSL capabilities. ```bash #cloud-config packages: - nginx - certbot - python3-pip runcmd: - pip3 install certbot-dns-ionos-cloud ``` -------------------------------- ### Start WireGuard Interface Source: https://docs.ionos.com/cloud/tutorials/network-services/vpn-gateway/wireguard-vdc-onprem Start the WireGuard interface ('wg0') using the `wg-quick up` command. This command automatically configures the interface, assigns the IP address, sets the MTU, and adds the necessary routing entries. ```bash wg-quick up wg0 ``` -------------------------------- ### Install acme.sh Source: https://docs.ionos.com/cloud/tutorials/network-services/cloud-dns/acme Installs the acme.sh client using a curl command. This is the initial step to get the certificate management tool on your system. ```bash curl https://get.acme.sh | sh ``` -------------------------------- ### Create PostgreSQL Database Source: https://docs.ionos.com/llms.txt Guide on how to set up a new PostgreSQL cluster. This involves defining the cluster's configuration and initial parameters. ```markdown - [Set Up a PostgreSQL Cluster](/cloud/databases/postgresql/api/v1-api/create-a-database.md) ``` -------------------------------- ### Example WireGuard Server Configuration Source: https://docs.ionos.com/cloud/tutorials/network-services/vpn-gateway/wireguard-vdc-onprem This is an example of a complete WireGuard server configuration file (`wg0.conf`). It shows the expected values for PrivateKey, Address, ListenPort, PublicKey, AllowedIPs, and Endpoint, which should be saved to `/etc/wireguard/wg0.conf`. ```ini [Interface] PrivateKey = kHKHABcC+67891= Address = 172.16.1.2/30 ListenPort = 51820 [Peer] PublicKey = defDEFhiH/98765= AllowedIPs = 192.168.1.0/24 Endpoint = 203.0.113.10 ``` -------------------------------- ### VPN Gateway API Source: https://docs.ionos.com/cloud/reference/get-started API for managing VPN Gateways. Uses Bearer Token authentication. ```APIDOC ## GET /vpn/v1 ### Description This endpoint provides access to the VPN Gateway API. ### Method GET ### Endpoint /vpn/v1 ### Parameters #### Query Parameters - **depth** (int) - Optional - The depth of query parameter used to specify how many levels of URIs should be expanded. ### Request Example ```json { "example": "No request body for GET request" } ``` ### Response #### Success Response (200) - **vpnGateways** (array) - Information about VPN Gateways. #### Response Example ```json { "example": "{\"vpnGateways\": []}" } ``` ``` -------------------------------- ### Dedicated Core Server Setup Source: https://docs.ionos.com/cloud/tutorials/network-services/cloud-dns/reversedns This section outlines the process of setting up a Dedicated Core Server, including network configuration. While it references UI steps, the core concepts involve network settings like Name, MAC, LAN, Firewall, and IP configuration. ```APIDOC ## Dedicated Core Server Network Configuration ### Description Configures the network settings for a Dedicated Core Server within the IONOS Cloud. ### Method (Implied PUT/POST for configuration, specific endpoint not provided in text) ### Endpoint (Specific endpoint not provided in text, likely within a server management API) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Conceptual - specific structure depends on the actual API) - **server_id** (string) - Required - The ID of the Dedicated Core Server. - **network_settings** (object) - Required - Contains the network configuration details. - **name** (string) - Required - A unique name for the server within the Virtual Data Center (VDC). - **lan_id** (integer) - Required - The ID of the LAN connection (e.g., 1 for internet-connected). - **firewall** (object) - Optional - Firewall configuration. - **enabled** (boolean) - Required - Whether the firewall is enabled. - **rules** (array) - Optional - List of firewall rules (e.g., allowing port 25 for UDP and TCP). - **ipv4_configuration** (object) - Required - IPv4 settings. - **ip_address** (string) - Required - The IPv4 address to assign to the server (should match A record). ### Request Example (Conceptual - actual request body will vary based on the specific API endpoint) ```json { "server_id": "your-server-id", "network_settings": { "name": "my-dedicated-server", "lan_id": 1, "firewall": { "enabled": true, "rules": [ { "port": 25, "protocol": "UDP", "action": "allow" }, { "port": 25, "protocol": "TCP", "action": "allow" } ] }, "ipv4_configuration": { "ip_address": "192.0.2.1" } } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the configuration update. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### POST /cloudapi/v6/datacenters Source: https://docs.ionos.com/cloud/reference/get-started Initiates the creation of a new datacenter. The operation is asynchronous and returns a 202 Accepted status. ```APIDOC ## POST /cloudapi/v6/datacenters ### Description Creates a new datacenter resource. The request is processed asynchronously, and the status can be tracked using the URL provided in the response headers. ### Method POST ### Endpoint /cloudapi/v6/datacenters ### Request Body - **properties** (object) - Required - Datacenter configuration properties. - **entities** (object) - Optional - Initial entity structure for the datacenter. ### Request Example { "properties": { "name": "Test resource", "description": "My Production Datacenter", "location": "us/las", "secAuthProtection": false }, "entities": { "servers": { "_links": {} }, "volumes": { "_links": {} }, "loadbalancers": { "_links": {} }, "lans": { "_links": {} } } } ### Response #### Success Response (202) - **Status** (string) - Accepted #### Response Example { "id": "xxxxea-0002-9925-X1X2-aXUAUnnana", "type": "datacenter", "href": "https://api.ionos.com/cloudapi/v6/datacenters/xxxxea-0002-9925-X1X2-aXUAUnnana", "metadata": { "state": "BUSY" }, "properties": { "name": "Test resource", "location": "us/las" } } ``` -------------------------------- ### Datacenter Operations Source: https://docs.ionos.com/cloud/reference/get-started Endpoints for managing datacenters, including retrieving datacenter details and listing datacenters with depth. ```APIDOC ## GET /datacenters/{datacenterId} ### Description Retrieves details for a specific datacenter. ### Method GET ### Endpoint /datacenters/{datacenterId} ### Parameters #### Path Parameters - **datacenterId** (string) - Required - The unique identifier of the datacenter. #### Query Parameters - **depth** (int) - Optional - The depth of query parameter used to specify how many levels of URIs should be expanded. ### Request Example ```json { "example": "No request body for GET request" } ``` ### Response #### Success Response (200) - **datacenter** (object) - Details of the specified datacenter. #### Response Example ```json { "example": "{\"datacenter\": {}}" } ``` ``` ```APIDOC ## GET /datacenters ### Description Lists all datacenters with optional depth expansion. ### Method GET ### Endpoint /datacenters ### Parameters #### Query Parameters - **depth** (int) - Optional - The depth of query parameter used to specify how many levels of URIs should be expanded. ### Request Example ```json { "example": "No request body for GET request" } ``` ### Response #### Success Response (200) - **datacenters** (array) - A list of datacenters. #### Response Example ```json { "example": "{\"datacenters\": []}" } ``` ``` -------------------------------- ### Create Swap Partition with Cloud-Config Source: https://docs.ionos.com/cloud/compute-services/compute-engine/how-tos/boot-cloud-init This cloud-config YAML script demonstrates how to set up a swap partition on a secondary block storage device. It defines the filesystem for the primary device and creates a swap filesystem on the secondary device, then configures the mount points. ```yaml #cloud-config fs_setup: - label: mylabel device: /dev/vda filesystem: ext4 - label: swap device: /dev/vdb filesystem: swap mounts: - [ /dev/vda, /, ext4, defaults, 0, 0 ] - [ /dev/vdb, none, swap, sw, 0, 0 ] ``` -------------------------------- ### Identity API Source: https://docs.ionos.com/cloud/reference/get-started Provides access to the Identity API, version 1. Supports Bearer Token authorization. ```APIDOC ## Identity API ### Description Accesses the Identity API, which is versioned as v1. This API supports Bearer Token for authorization. ### Method GET ### Endpoint https://api.ionos.com/docs/identity-policy/v1/ ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) Details about the Identity API documentation. ``` -------------------------------- ### CDN API Source: https://docs.ionos.com/cloud/reference/get-started Provides access to the CDN API, version 1. Supports Bearer Token authorization. ```APIDOC ## CDN API ### Description Accesses the CDN API, which is versioned as v1. This API supports Bearer Token for authorization. ### Method GET ### Endpoint https://api.ionos.com/docs/cdn/v1/ ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) Details about the CDN API documentation. ``` -------------------------------- ### Set Up Block Storage Source: https://docs.ionos.com/llms.txt Instructions for setting up block storage volumes in IONOS Cloud. This involves creating and attaching storage volumes to your virtual machines, configuring their size and performance characteristics. ```bash ionosctl volume create --size 100 --type SSD --name my-volume ionosctl vm attach-volume --vm-id --volume-id ``` -------------------------------- ### VM Auto Scaling API Source: https://docs.ionos.com/cloud/reference/get-started API for managing VM Auto Scaling. Uses Basic Auth authentication. ```APIDOC ## GET /vmautoscaling/v1.ea ### Description This endpoint provides access to the VM Auto Scaling API. ### Method GET ### Endpoint /vmautoscaling/v1.ea ### Parameters #### Query Parameters - **depth** (int) - Optional - The depth of query parameter used to specify how many levels of URIs should be expanded. ### Request Example ```json { "example": "No request body for GET request" } ``` ### Response #### Success Response (200) - **scalingGroups** (array) - Information about VM scaling groups. #### Response Example ```json { "example": "{\"scalingGroups\": []}" } ``` ``` -------------------------------- ### Create and Secure PostgreSQL Database Source: https://docs.ionos.com/cloud/databases/postgresql/api/v1-api/create-a-database This snippet demonstrates how to create a new database named 'example' and revoke all default permissions from the PUBLIC role. This is a crucial step for securing your database by controlling access from the outset. ```sql CREATE DATABASE example; REVOKE ALL ON DATABASE example FROM PUBLIC; ``` -------------------------------- ### Reseller API Source: https://docs.ionos.com/cloud/reference/get-started Provides access to the Reseller API, version 2. Supports Basic Auth and Bearer Token authorization. ```APIDOC ## Reseller API ### Description Accesses the Reseller API, which is versioned as v2. This API supports both Basic Auth and Bearer Token for authorization. ### Method GET ### Endpoint https://api.ionos.com/docs/reseller/v2 ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) Details about the Reseller API documentation. ``` -------------------------------- ### Quota API Source: https://docs.ionos.com/cloud/reference/get-started Provides access to the Quota API, version 1. Supports Basic Auth and Bearer Token authorization. ```APIDOC ## Quota API ### Description Accesses the Quota API, which is versioned as v1. This API supports both Basic Auth and Bearer Token for authorization. ### Method GET ### Endpoint https://api.ionos.com/docs/quota/v1/ ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) Details about the Quota API documentation. ``` -------------------------------- ### Connect to PostgreSQL Cluster Source: https://docs.ionos.com/cloud/databases/postgresql/api/v1-api/create-a-database Demonstrates how to connect to a provisioned PostgreSQL cluster using the psql command-line utility. Connections can be established using either the cluster's IP address or its DNS name. ```bash psql -h 192.168.1.100 -d postgres -U dsertionos ``` ```bash psql -h pg-3euh45am6idkppu3.postgresql.de-fra.ionos.com -d postgres -U dsertionos ```