Deribit AWS Endpoint Service instruction

  • Updated

In order to offer its customers residing in AWS a direct connection to its backend systems, Deribit has created an AWS Endpoint Service for customers to directly connect to. The solution is based on AWS PrivateLink, a managed service built for service provider/service consumer connectivity models. This instruction describes how customers can connect to the Deribit Endpoint Service from their AWS environment. The Service is available within several AWS regions. 

As with any service provider/service consumer model, AWS PrivateLink will only allow connectivity to be initiated from your VPC to the Deribit VPC, never in the other direction, so you have complete control over which network traffic will be able to go through the VPC Endpoint. The Deribit Endpoint Service will be accessible on the same TCP ports as via the internet (443, 8020, 8021, 8022 and 8025). Consult Deribit for the port number that’s best for you. 

  1. Create VPC Endpoint

    In order to connect to the Deribit service, you first have to create a VPC Endpoint which will be connected through PrivateLink to the Deribit VPC Endpoint Service. In order to create this VPC Endpoint log in to the AWS Console, go to the AWS Account in which to create the VPC Endpoint, choose the appropriate AWS region and go to the VPC from which you want to access the Deribit service. From the menu choose ‘Endpoints’, ‘Create Endpoint’. Select ‘PrivateLink Ready partner services’: 

    aws_endpoint_privatelink_ready_partner_services.png

    Fill in the name belonging to your specific region and click ‘Verify Service’:

    Table 3. Deribit services for AWS regions

    AWS region

    Deribit service name

    eu-west-2 (London)

    com.amazonaws.vpce.eu-west-2.vpce-svc-040cd502947f69842

    ap-northeast-1 (Tokyo)

    com.amazonaws.vpce.ap-northeast-1.vpce-svc-04de4df0469ee98af


    The following status should appear indicating that the Deribit service was successfully located:

    aws_endpoint_service_name_verified.png

    In order to connect to the Endpoint using custom private DNS (explained further), make sure default private DNS is not enabled under Additional settings: 

    aws_endpoint_enable_dns_name.png

    Now select the VPC in which the VPC Endpoint should be created, followed by the Availability Zones in which to enable the VPC Endpoint. For redundancy/high availability purposes, Deribit has made its service available in two Availability Zones per region:

    Table 4. Availability Zones for AWS regions

    AWS region

    Availability Zones

    eu-west-2 (London)

    euw-az2 & euw-az3

    ap-northeast-1 (Tokyo)

    apne1-az1 & apne1-az4


    We recommend creating the VPC Endpoint in both AZ’s and recommend your application is also available in both AZ’s. 

    You can create and attach a Security Group to the VPC Endpoint for security purposes, and add Tags according to your company policies. If you do not define a Security Group, the Default Security Group will be associated: 

    aws_endpoint_default_security_group.png

    Make sure the associated Security Group has Inbound Rules allowing traffic from your VPC to access the Endpoint. To edit go to the ‘Inbound Rules’ tab, click ‘Edit Inbound Rules’. Click ‘Add rule’ and define which traffic is allowed to access the Deribit backend. For example in this case my entire VPC with CIDR range 10.0.0.0/16 over destination port 8020: 

    aws_endpoint_inbound_rule.png

    Click ‘Save rules’. Click ‘Create Endpoint’ to finalize. 

  2. Connection Acceptance

    The connection request that was created in Step 1, has to be accepted in the Deribit AWS account, until that happens the VPC Endpoint in your account will remain in the ‘pending acceptance’ state:

    aws_endpoint_pending_acceptance.png

    In order to inform Deribit you have created a connection request, please send an email to ‘aws-support@sentillia.com’ following the below guidelines:

    • Include the following in the mail subject:

      • #acceptance request - <your company name> - <UID>

    • Include the following in the email body:

      • The VPC Endpoint-ID you just created (‘vpce-xxx’)...

      • The AWS region in which you made the connection acceptance request.

      • Your Deribit UID

    Deribit will then accept the connection request, inform you by email and after a few minutes the status of the VPC Endpoint will change to ‘available’. It is now ready for use:

    aws_endpoint_status_available.png
  3. Route network traffic to VPC Endpoint

    The next step is to enable services within your VPC, like for example EC2 instances or Lambdas, to access the VPC Endpoint. We recommend the use of a Private Hosted Zone in the Route53 AWS DNS service. If you will be accessing the Deribit service over TCP port 443 your DNS record needs to be ‘gateway’ in the ‘deribit.com’ hosted zone, in order for the SSL certificate to match ‘gateway.deribit.com’. If you are using any of the other TCP ports (8020, 8021, 8022 or 8025), there is no SSL certificate so you can choose your own record and zone.

    Go to Route53 in the AWS Console, create a Private Hosted Zone if you don’t have one already, otherwise use one you were already using. For this example we will use the zone ‘deribit.int’ (‘deribit.com’ if you are using TCP 443).

    Within that hosted zone choose ‘Create record’, select the ‘Simple Routing’ policy:

    aws_endpoint_simple_routing_policy.png

    Click Next and choose ‘Define simple record’. Fill in the record details:

    • Record name – choose your own record, in this example we will use ‘test’ (‘gateway’ if you are using TCP 443);

    • Record type – A ‘Routes traffic to an IPv4 address and some AWS resources’;

    • Value/route traffic to – choose ‘Alias to VPC Endpoint’;

    • Region – choose the region in which you created the Endpoint’;

    • Choose endpoint – select the Endpoint created in Step 1. Note to choose the one with the region (for example ‘eu-west-2’ or ‘ap-northeast-1’), not the one ending with ‘a/b’.

    aws_endpoint_define_simple_record.png

    Select ‘Define simple record’ and ‘Create records’. It is being created and will take a few minutes to become available.

  4. Test the connection

    From your EC2 instance or Lambda service test the connection with for example telnet, using the created private DNS record in Step 3 followed by one of the TCP ports (In our example: ‘telnet test.deribit.int 8020’). The test should result in an active connection, it is now available for your regular requests for the Deribit backend.

Troubleshooting

Why am I getting a response error 404 ?

Verify the following:

  1. Your VPCE is in the correct zone, either London or Tokyo, depending on which region you’ve requested.

  2. Confirm that step number 3 in the setup guide is correctly configured, and that the DNS point to gateway.deribit.com

IP whitelisting - I wish to whitelist my IP

This can be done via the API itself directly without our intervening, If you wish to be sure about the IP address? Simply send a request and let us know with your UID alongside the exact time window so we can trace it back from the logs for you.