Use AWS PrivateLink with Aiven services
AWS PrivateLink is a limited availability feature, which you can request from the sales team (sales@Aiven.io) or your account manager. During the limited availability stage, you can use the feature at no cost. If you want to continue using AWS PrivateLink after it reaches general availability, you’ll be billed according to the latest applicable price.
AWS PrivateLink brings Aiven
services to the selected virtual private cloud (VPC) in your AWS
account. In a traditional setup that uses VPC peering, traffic is routed through an AWS VPC peering connection to your Aiven
services. With PrivateLink, you can create a VPC endpoint to your own
VPC and access an Aiven service from that. The VPC endpoint creates
network interfaces (NIC) to the subnets and availability zones that you
choose and receives the private IP addresses that belong to the IP range
of your VPC. The VPC endpoint is routed to your Aiven service located in
one of Aiven’s AWS accounts.
You can enable PrivateLink for Aiven services located in project VPC.
Before you can set up AWS PrivateLink, create a VPC and launch the
services that you want to connect to that VPC. As there is no network
routing between the VPC, you can use any private IP range for the VPC,
unless you also want to connect to the project VPC using VPC peering
connections. This means that overlaps in the IP range are not an issue.
You can use either the Aiven Console
or the Aiven CLI to set up
AWS PrivateLink. You also need the AWS CLI to create a VPC endpoint.
Note: Aiven for Apache Cassandra® and Aiven for M3 services do not
currently support AWS PrivateLink.
Create an AWS PrivateLink resource on the Aiven service:
The Amazon Resource Name (ARN) for the principals that are allowed
to connect to the VPC endpoint service and the AWS network load
balancer requires your Amazon account ID. In addition, you can set
the access scope for an entire AWS account, a given user account,
or a given role. Only give permissions to roles that you trust, as
an allowed role can connect from any VPC.
Using the Aiven CLI, run the following command including your AWS
account ID, the access scope, and the name of your Aiven service:
$ avn service privatelink aws create --principal arn:aws:iam::$AWS_account_ID:$access_scope $Aiven_service_name
$ avn service privatelink aws create --principal arn:aws:iam::012345678901:user/mwf my-kafka
Using Aiven Console:
Log in to Aiven Console and select the service that you
want to use.
On the Overview page of your service, select Network from the sidebar.
On the Network page, select Create Privatelink .
In the Create Privatelink window, enter the Amazon Resource Names (ARN) for the principals that you want to use, and select Create .
This creates an AWS network load balancer dedicated to your Aiven
service and attaches it to an AWS VPC endpoint service that you can
later use to connect to your account’s VPC endpoint.
The PrivateLink resource stays in the initial
for up to a few minutes while the load balancer is being launched.
After the load balancer and VPC endpoint service have been created,
the state changes to
active and the
aws_service_name values are set.
In the AWS CLI, run the following command to create a VPC endpoint:
$ aws ec2 --region eu-west-1 create-vpc-endpoint --vpc-endpoint-type Interface --vpc-id $your_vpc_id --subnet-ids $space_separated_list_of_subnet_ids --security-group-ids $security_group_ids --service-name com.amazonaws.vpce.eu-west-1.vpce-svc-0b16e88f3b706aaf1
value with the value shown next to
> AWS service name
in Aiven Console
running the following command in the Aiven CLI:
$ avn service privatelink aws get aws_service_name
Note that for fault tolerance, you should specify a subnet ID for
each availability zone in the region. The security groups determine
the instances that are allowed to connect to the endpoint network
interfaces created by AWS into the specified subnets.
Alternatively, you can create the VPC endpoint in Aiven Console
under Integration endpoints
> Add new endpoint
. See the AWS documentation
Note: For Aiven for Apache Kafka® services, the security group
for the VPC endpoint must allow ingress in the port range
10000-31000 to accommodate the pool of Kafka broker ports used
in our PrivateLink implementation.
It takes a while before the endpoint is ready to use as AWS
provisions network interfaces to each of the subnets and connects
them to the Aiven VPC endpoint service. Once the AWS endpoint state
available , the connection is visible in Aiven.
Enable PrivateLink access for Aiven service components:
You can control each service component separately - for example,
you can enable PrivateLink access for Kafka while allowing Kafka
Connect to connect via VPC peering connections only.
It takes a couple of minutes before connectivity is available after
you enable a service component. This is because AWS requires an AWS
load balancer behind each VPC endpoint service, and the target rules
on the load balancer for the service nodes need at least two
successful heartbeats before they transition from the
healthy and are included in the active forwarding rules of the load balancer.
Note: Currently, you can only create one VPC endpoint for each
Once you have enabled PrivateLink access for a service component, a
switch for the
privatelink access route appears under Connection
information on the Overview page in Aiven Console. The
and for some service components such as Kafka,
port - values differ
from the default
dynamic access route that is used to connect to the
service. You can use the same credentials with any access route.
Updating the allowed principals list
To change the list of AWS accounts or IAM users or roles that are
allowed to connect a VPC endpoint:
Deleting a privatelink connection
This deletes the AWS load balancer and VPC service endpoint.