Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ permalink: /documentation/products/guides/build/process-images/
---

import Tabs from '~/components/tabs/Tabs'
import Code from '~/components/Code/Code.astro'
import Apiv4Rollout from '~/includes/snippets/apiv4Rollout/en/snippet.mdx'

<Apiv4Rollout />

Through the [Image Processor](/en/documentation/products/build/edge-application/image-processor/) module, you can adjust image sizes, add filters and watermarks, or convert formats to suit for more efficient content delivery, bandwidth saving, and reduce object storage costs. These changes can be applied directly in the URL of your image by appending `ims` queries to the image's URL.

:::tip
If you're not sure which steps apply to your account, see [this guide](/en/documentation/products/guides/verify-account-migration/) to determine if your account has already been migrated.
:::

:::caution[warning]
If you wish to optimize your images, in addition to the **Image Processor module, the activation of the [Application Accelerator](/en/documentation/products/build/edge-application/application-accelerator/) module is recommended for cache efficiency. If these modules are activated, images processed and data transfer could generate usage-related costs. Check the [pricing page](/en/documentation/products/pricing/) for more information.
:::

---

<Tabs client:visible>
<Fragment slot="tab.console">Console</Fragment>
<Fragment slot="tab.api">API</Fragment>
<Fragment slot="tab.consoleworkloads">Console - Workloads</Fragment>
<Fragment slot="tab.consoledomain">Console - Domains</Fragment>
<Fragment slot="tab.apiv4">API v4</Fragment>
<Fragment slot="tab.apiv3">API v3</Fragment>

<Fragment slot="panel.console">
1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Edge Application**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ namespace: docs_guides_build_advanced_multi_origins
---

import Tabs from '~/components/tabs/Tabs'
import Code from '~/components/Code/Code.astro'
import Apiv4Rollout from '~/includes/snippets/apiv4Rollout/en/snippet.mdx'

<Apiv4Rollout />

When you [create an edge application](/en/documentation/products/start-with-a-template/), you need to define an origin. However, more complex and robust infrastructures may need multiple origins for the same application. The [Load Balancer](/en/documentation/products/build/edge-application/load-balancer/) module allows you to use load balancing algorithms to manage high access numbers and control the behaviors of your origin.

:::tip
If you're not sure which steps apply to your account, see [this guide](/en/documentation/products/guides/verify-account-migration/) to determine if your account has already been migrated.
:::

:::caution[warning]
If **Load Balancer** is activated, data transfer could generate usage-related costs. Check the [pricing page](/en/documentation/products/pricing/) for more information.
:::
Expand All @@ -42,10 +50,65 @@ Therefore, the setup would be:
---

<Tabs client:visible>
<Fragment slot="tab.console">Console</Fragment>
<Fragment slot="tab.api">API</Fragment>
<Fragment slot="tab.consoleworkloads">Console - Workloads</Fragment>
<Fragment slot="tab.consoledomain">Console - Domains</Fragment>
<Fragment slot="tab.apiv4">API v4</Fragment>
<Fragment slot="tab.apiv3">API v3</Fragment>

<Fragment slot="panel.consoleworkloads">

To configure load balancing via Workloads (using Edge Connectors):

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Edge Connectors**.

2. Create multiple Edge Connectors for your origins:

**For the primary server:**
- Click **+ Edge Connector**
- Name: `primary-server-connector`
- Type: **HTTP**
- Protocol: **HTTPS**
- Address: `example.com`
- Weight: `3` (higher capacity)
- Click **Save**

**For the secondary server:**
- Click **+ Edge Connector**
- Name: `secondary-server-connector`
- Type: **HTTP**
- Protocol: **HTTPS**
- Address: `example.net`
- Weight: `2` (medium capacity)
- Click **Save**

**For the backup server:**
- Click **+ Edge Connector**
- Name: `backup-server-connector`
- Type: **HTTP**
- Protocol: **HTTPS**
- Address: `example.org`
- Weight: `1` (low capacity)
- Status: **Inactive** (backup only)
- Click **Save**

3. Configure load balancing in your Workload:
- Go to **Workloads**
- Select your workload
- Navigate to **Deployment Settings**
- In **Edge Connectors**, add all three connectors
- Configure **Load Balancing Method** to **Round Robin**
- Set the weight distribution according to server capacity
- Click **Save**

:::note
With Workloads, Edge Connectors provide more granular control over load balancing and can be reused across different workloads.
:::

</Fragment>

<Fragment slot="panel.consoledomain">
To configure load balancing via traditional Domains interface:

<Fragment slot="panel.console">
First, to enable the **Load Balancer** module:

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Edge Application**.
Expand All @@ -64,7 +127,7 @@ To customize the origin according to the scenario described above:
3. Give your new origin a name.
4. Under **Type**, select **Load Balancer**.
5. In the **Method** field, select **Round-Robin**.
6. In the first **Address** field, specify the primary server. For example, example.com`.
6. In the first **Address** field, specify the primary server. For example, `example.com`.
7. Since this origin has a higher load capacity, in the **Weight** field, add a weight of `3` to this first origin.
8. In the **Server Role** field, keep **Primary** selected.
9. Keep this origin **Active**.
Expand All @@ -82,14 +145,100 @@ To customize the origin according to the scenario described above:
Wait a few minutes for the changes to propagate. Then, access your application or use the command line to make a request and check if the changes were made.
</Fragment>

<Fragment slot="panel.api">
<Fragment slot="panel.apiv4">

To configure load balancing via Edge Connectors API v4:

1. Create multiple Edge Connectors with different weights:

**Primary server connector:**
<Code lang="bash" code={`curl --request POST \\
--url https://api.azion.com/v4/edge_connector/connectors \\
--header 'Accept: application/json' \\
--header 'Authorization: Token [TOKEN VALUE]' \\
--header 'Content-Type: application/json' \\
--data '{
"name": "primary-server-connector",
"type": "http",
"endpoint": {
"protocol": "https",
"address": "example.com",
"weight": 3
}
}'`} />

**Secondary server connector:**
<Code lang="bash" code={`curl --request POST \\
--url https://api.azion.com/v4/edge_connector/connectors \\
--header 'Accept: application/json' \\
--header 'Authorization: Token [TOKEN VALUE]' \\
--header 'Content-Type: application/json' \\
--data '{
"name": "secondary-server-connector",
"type": "http",
"endpoint": {
"protocol": "https",
"address": "example.net",
"weight": 2
}
}'`} />

**Backup server connector:**
<Code lang="bash" code={`curl --request POST \\
--url https://api.azion.com/v4/edge_connector/connectors \\
--header 'Accept: application/json' \\
--header 'Authorization: Token [TOKEN VALUE]' \\
--header 'Content-Type: application/json' \\
--data '{
"name": "backup-server-connector",
"type": "http",
"endpoint": {
"protocol": "https",
"address": "example.org",
"weight": 1
},
"active": false
}'`} />

2. Configure workload deployment with load balancing:

<Code lang="bash" code={`curl --request POST \\
--url https://api.azion.com/v4/workspace/workloads/<workload_id>/deployments \\
--header 'Accept: application/json' \\
--header 'Authorization: Token [TOKEN VALUE]' \\
--header 'Content-Type: application/json' \\
--data '{
"name": "Load Balanced Deployment",
"current": true,
"active": true,
"strategy": {
"type": "load_balanced",
"attributes": {
"method": "round_robin",
"edge_connectors": [
<primary_connector_id>,
<secondary_connector_id>,
<backup_connector_id>
]
}
}
}'`} />

:::tip
Check the [Edge Connectors API v4 documentation](https://api.azion.com/v4#/operations/GetEdgeConnectorConnectors) for more details.
:::

</Fragment>

<Fragment slot="panel.apiv3">
To configure load balancing via API v3:

1. Run the following `GET` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/) and `<edge_application_id>` variable with [your edge application ID](/en/documentation/products/guides/build/configure-main-settings/) to retrieve your default origin's `<origin_key>`, which is a UUID value:

```bash
curl --location 'https://api.azionapi.net/edge_applications/<edge_application_id> \
--header 'Accept: application/json; version=3' \
--header 'Authorization: Token [TOKEN VALUE]'
```
<Code lang="bash" code={`curl --request GET \\
--url https://api.azionapi.net/edge_applications/<edge_application_id> \\
--header 'Accept: application/json; version=3' \\
--header 'Authorization: Token [TOKEN VALUE]'`} />

2. You'll receive a response similar to this:

Expand All @@ -108,38 +257,37 @@ curl --location 'https://api.azionapi.net/edge_applications/<edge_application_id
3. Copy the `<origin_key>` value.
4. Run the following `PATCH` request to modify the default origin as follows, replacing the key and application id in the URL:

```bash
curl --location --request PATCH 'https://api.azionapi.net/edge_applications/<edge_application_id>/origins/<origin_key>' \
--header 'Accept: application/json; version=3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token [TOKEN VALUE]' \
--data '{
<Code lang="bash" code={`curl --request PATCH \\
--url https://api.azionapi.net/edge_applications/<edge_application_id>/origins/<origin_key> \\
--header 'Accept: application/json; version=3' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Token [TOKEN VALUE]' \\
--data '{
"name": "Default Origin (RR3)",
"origin_type": "load_balancer",
"addresses": [
{
"address": "example.com",
"weight": 3,
"server_role": "primary",
"is_active": true
},
{
"address": "example.net",
"weight": 2,
"server_role": "primary",
"is_active": true
},
{
"address": "example.org",
"weight": 1,
"server_role": "backup",
"is_active": false
}
{
"address": "example.com",
"weight": 3,
"server_role": "primary",
"is_active": true
},
{
"address": "example.net",
"weight": 2,
"server_role": "primary",
"is_active": true
},
{
"address": "example.org",
"weight": 1,
"server_role": "backup",
"is_active": false
}
],
"host_header": "${host}",
"host_header": "\${host}",
"method": "round_robin"
}'
```
}'`} />

5. You'll receive a response similar to this, confirming the changes have been made:

Expand Down Expand Up @@ -170,7 +318,7 @@ curl --location --request PATCH 'https://api.azionapi.net/edge_applications/<edg
"is_active": false
}
]
"host_header": "${host}",
"host_header": "\${host}",
"method": "round_robin"
...
}
Expand All @@ -180,7 +328,7 @@ curl --location --request PATCH 'https://api.azionapi.net/edge_applications/<edg
6. Wait a few minutes for the propagation to occur.

:::tip
Check the [Azion API documentation](https://api.azion.com/) and the [OpenAPI specification](https://github.com/aziontech/azionapi-openapi/) to know more about all features available via API.
Check the [Load Balancer API v3 documentation](https://api.azionapi.net/api/v3#/Origins) for more details.
:::
</Fragment>

Expand Down
Loading