Skip to content

Commit

Permalink
cli and api for peering instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
wojcik-dorota committed Jan 17, 2025
1 parent 4a38bc4 commit 6c43914
Show file tree
Hide file tree
Showing 9 changed files with 449 additions and 38 deletions.
57 changes: 55 additions & 2 deletions docs/platform/howto/manage-org-vpc-peering-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ sidebar_label: AWS peering
import CollectDataAws from "@site/static/includes/vpc/collect-data-aws.md";
import AcceptPeeringAws from "@site/static/includes/vpc/accept-peering-aws.md";
import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Set up a peering connection between your Aiven organization VPC and an AWS VPC.

Expand All @@ -30,9 +32,11 @@ first collect required data from AWS:

### Create a peering in Aiven

Create an organization VPC peering connection in the [Aiven Console](https://console.aiven.io/)
using the [data collected from AWS](/docs/platform/howto/manage-org-vpc-peering-aws#collect-data-from-aws):
With the [data collected from AWS](/docs/platform/howto/manage-org-vpc-peering-aws#collect-data-from-aws),
create an organization VPC peering connection using a tool of your choice:

<Tabs groupId="group1">
<TabItem value="console" label="Aiven Console" default>
1. Log in to the [Aiven Console](https://console.aiven.io/), and click **Admin** in the
top navigation bar.
1. Click <ConsoleLabel name="organizationvpcs"/> in the sidebar.
Expand All @@ -46,6 +50,55 @@ using the [data collected from AWS](/docs/platform/howto/manage-org-vpc-peering-
- **AWS VPC ID**
1. Click **Add peering connection**.

</TabItem>
<TabItem value="cli" label="Aiven CLI">

Run the `avn organization vpc peering-connection create` command:

```bash
avn organization vpc peering-connection create \
--organization-id AIVEN_ORGANIZATION_ID \
--vpc-id AIVEN_ORGANIZATION_VPC_ID \
--peer-cloud-account AWS_ACCOUNT_ID \
--peer-vpc AWS_VPC_ID
```

Replace `AIVEN_ORGANIZATION_ID`, `AIVEN_ORGANIZATION_VPC_ID`, `AWS_ACCOUNT_ID`, and
`AWS_VPC_ID` as needed.

</TabItem>
<TabItem value="api" label="Aiven API">

Make an API call to the `OrganizationVpcCreate` endpoint:

```bash
curl --request POST \
--url https://api.aiven.io/v1/organization/ORGANIZATION_ID/vpcs \
--header 'Authorization: Bearer BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '
{
"cloud_name": "CLOUD_PROVIDER_REGION",
"network_cidr": "NETWORK_CIDR"
}
'
```

Replace the following placeholders with meaningful data:

- `ORGANIZATION_ID`
- `BEARER_TOKEN`
- `CLOUD_PROVIDER_REGION`
- `NETWORK_CIDR`

</TabItem>
<TabItem value="tf" label="Aiven Provider for Terraform">
Use the
[aiven_aws_organization_vpc_peering_connection](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/aws_organization_vpc_peering_connection)
resource.
</TabItem>
</Tabs>

This adds a connection with the **Pending peer** status in the
[Aiven Console](https://console.aiven.io/) and a connection pending acceptance in
the [AWS Management Console](https://console.aws.amazon.com).
Expand Down
58 changes: 55 additions & 3 deletions docs/platform/howto/manage-org-vpc-peering-google.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ first collect required data from Google Cloud:

### Create the peering in Aiven

Create an organization VPC peering connection in the [Aiven Console](https://console.aiven.io/)
using the
[data collected from Google Cloud](/docs/platform/howto/manage-org-vpc-peering-google#collect-data-from-google-cloud):
With the
[data collected from Google Cloud](/docs/platform/howto/manage-org-vpc-peering-google#collect-data-from-google-cloud),
create an organization VPC peering connection using a tool of your choice:

<Tabs groupId="group1">
<TabItem value="console" label="Aiven Console" default>

1. Log in to the [Aiven Console](https://console.aiven.io/), and click **Admin** in the
top navigation bar.
Expand All @@ -57,6 +60,55 @@ using the
1. Click <ConsoleLabel name="service settings"/> in the sidebar, and make a note of your
**Project name** in the **Project settings** field.

</TabItem>
<TabItem value="cli" label="Aiven CLI">

Run the `avn organization vpc peering-connection create` command:

```bash
avn organization vpc peering-connection create \
--organization-id AIVEN_ORGANIZATION_ID \
--vpc-id AIVEN_ORGANIZATION_VPC_ID \
--peer-cloud-account GOOGLE_CLOUD_PROJECT_ID \
--peer-vpc GOOGLE_CLOUD_VPC_NETWORK_NAME
```

Replace `AIVEN_ORGANIZATION_ID`, `AIVEN_ORGANIZATION_VPC_ID`, `GOOGLE_CLOUD_PROJECT_ID`,
and `GOOGLE_CLOUD_VPC_NETWORK_NAME` as needed.

</TabItem>
<TabItem value="api" label="Aiven API">

Make an API call to the `OrganizationVpcCreate` endpoint:

```bash
curl --request POST \
--url https://api.aiven.io/v1/organization/ORGANIZATION_ID/vpcs \
--header 'Authorization: Bearer BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '
{
"cloud_name": "CLOUD_PROVIDER_REGION",
"network_cidr": "NETWORK_CIDR"
}
'
```

Replace the following placeholders with meaningful data:

- `ORGANIZATION_ID`
- `BEARER_TOKEN`
- `CLOUD_PROVIDER_REGION`
- `NETWORK_CIDR`

</TabItem>
<TabItem value="tf" label="Aiven Provider for Terraform">
Use the
[aiven_gcp_organization_vpc_peering_connection](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/gcp_organization_vpc_peering_connection)
resource.
</TabItem>
</Tabs>

### Create the peering in Google Cloud

Use the
Expand Down
52 changes: 50 additions & 2 deletions docs/platform/howto/manage-org-vpc-peering-upcloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import CollectDataUpcloud from "@site/static/includes/vpc/collect-data-upcloud.m
import AcceptPeeringUpcloud from "@site/static/includes/vpc/accept-peering-upcloud.md";
import RenewLeaseUpcloud from "@site/static/includes/vpc/renew-lease-upcloud.md";
import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Set up a peering connection between your Aiven organization VPC and an UpCloud SDN network.

Expand Down Expand Up @@ -60,9 +62,12 @@ first collect required data from UpCloud using either the

### Create the peering in Aiven

Create an organization VPC peering connection in the [Aiven Console](https://console.aiven.io/)
using the [data collected from UpCloud](/docs/platform/howto/manage-org-vpc-peering-upcloud#collect-data-from-upcloud):
With the
[data collected from UpCloud](/docs/platform/howto/manage-org-vpc-peering-upcloud#collect-data-from-upcloud),
create an organization VPC peering connection using a tool of your choice:

<Tabs groupId="group1">
<TabItem value="console" label="Aiven Console" default>
1. Log in to the [Aiven Console](https://console.aiven.io/), and click **Admin** in the
top navigation bar.
1. Click <ConsoleLabel name="organizationvpcs"/> in the sidebar.
Expand All @@ -80,6 +85,49 @@ using the [data collected from UpCloud](/docs/platform/howto/manage-org-vpc-peer
Aiven VPC available in the **Aiven network ID** column of the VPC peering connections
table.

</TabItem>
<TabItem value="cli" label="Aiven CLI">

Run the `avn organization vpc peering-connection create` command:

```bash
avn organization vpc peering-connection create \
--organization-id AIVEN_ORGANIZATION_ID \
--vpc-id AIVEN_ORGANIZATION_VPC_ID \
--peer-cloud-account upcloud \
--peer-vpc UPCLOUD_SDN_NETWORK_UUID
```

Replace `AIVEN_ORGANIZATION_ID`, `AIVEN_ORGANIZATION_VPC_ID`, and `UPCLOUD_SDN_NETWORK_UUID` as needed.

</TabItem>
<TabItem value="api" label="Aiven API">

Make an API call to the `OrganizationVpcCreate` endpoint:

```bash
curl --request POST \
--url https://api.aiven.io/v1/organization/ORGANIZATION_ID/vpcs \
--header 'Authorization: Bearer BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '
{
"cloud_name": "CLOUD_PROVIDER_REGION",
"network_cidr": "NETWORK_CIDR"
}
'
```

Replace the following placeholders with meaningful data:

- `ORGANIZATION_ID`
- `BEARER_TOKEN`
- `CLOUD_PROVIDER_REGION`
- `NETWORK_CIDR`

</TabItem>
</Tabs>

### Create the peering in UpCloud

Use the Aiven VPC network ID
Expand Down
5 changes: 5 additions & 0 deletions docs/platform/howto/manage-organization-vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ Replace the following placeholders with meaningful data:
- `CLOUD_PROVIDER_REGION`
- `NETWORK_CIDR`

</TabItem>
<TabItem value="tf" label="Aiven Provider for Terraform">
Use the
[aiven_organization_vpc](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/project_vpc)
resource.
</TabItem>
</Tabs>

Expand Down
57 changes: 56 additions & 1 deletion docs/platform/howto/manage-project-vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Manage project virtual private clouds (VPCs) in Aiven
sidebar_label: Manage project VPCs
---

import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons"
import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Set up or delete a project-wide VPC in your Aiven organization. Deploy or migrate Aiven-managed services to your project VPC. Access resources within the project VPC from the public internet.

Expand All @@ -14,6 +16,8 @@ permissions

To create a [VPC for your Aiven project](/docs/platform/concepts/vpcs#project-vpcs):

<Tabs groupId="group1">
<TabItem value="console" label="Aiven Console" default>
1. Log in to [Aiven Console](https://console.aiven.io/), and click
<ConsoleLabel name="services"/> > <ConsoleLabel name="vpcs"/>.

Expand All @@ -40,6 +44,57 @@ To create a [VPC for your Aiven project](/docs/platform/concepts/vpcs#project-vp

The state of the VPC is shown in the table.

</TabItem>
<TabItem value="cli" label="Aiven CLI">
Run the
[avn vpc create](/docs/tools/cli/vpc#avn-vpc-create)
command:

```bash
avn vpc create \
--cloud CLOUD_PROVIDER_REGION \
--network-cidr NETWORK_CIDR \
--project PROJECT_NAME
```

Replace the following:

- `CLOUD_PROVIDER_REGION` with the cloud provider and region to host the VPC, for example
`aws-eu-west-1`
- `NETWORK_CIDR` with the CIDR block (a range of IP addresses) for the VPC, for example,
`10.0.0.0/24`
- `PROJECT_NAME` with the name of your Aiven project where to create the VPC

</TabItem>
<TabItem value="api" label="Aiven API">

Make an API call to the
[VpcCreate](https://api.aiven.io/doc/#tag/Project/operation/VpcCreate) endpoint:

```bash
curl --request POST \
--url https://api.aiven.io/v1/project/PROJECT_ID/vpcs \
--header 'Authorization: Bearer BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '
{
"cloud_name": "CLOUD_PROVIDER_REGION",
"network_cidr": "NETWORK_CIDR"
}
'
```

Replace `PROJECT_ID`, `BEARER_TOKEN`, `CLOUD_PROVIDER_REGION`, and `NETWORK_CIDR` with
meaningful data.

</TabItem>
<TabItem value="tf" label="Aiven Provider for Terraform">
Use the
[aiven_project_vpc](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/project_vpc)
resource.
</TabItem>
</Tabs>

## Deploy new services to a project VPC

**Prerequisite**: [Manage service configuration](/docs/platform/concepts/permissions#project-permissions)
Expand Down
Loading

0 comments on commit 6c43914

Please sign in to comment.