The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): show PrivateLink resource IDs and use connection copy (#48967)
Stephen Morgan3d966e3709d9
diff --git a/apps/docs/content/guides/platform/privatelink.mdx b/apps/docs/content/guides/platform/privatelink.mdxindex a934dc535bd..8d079f5d3bc 100644--- a/apps/docs/content/guides/platform/privatelink.mdx+++ b/apps/docs/content/guides/platform/privatelink.mdx@@ -7,7 +7,6 @@ description: 'Secure private network connectivity to your Supabase database usin<Admonition type="note">PrivateLink is available only to Team and Enterprise customers.-Contact support if you would like to create a PrivateLink connection for a read-only replica.</Admonition>@@ -37,19 +36,24 @@ To use PrivateLink with your Supabase project:## Getting started-### Step 1: Add AWS account+### Step 1: Add connectionNavigate to your project's Integrations section to set up PrivateLink:1. Go to your Supabase project dashboard2. Navigate to [**Settings** > **Integrations**](/dashboard/project/_/settings/integrations)3. Find the **AWS PrivateLink** section-4. Click **Add Account**-5. Enter your AWS Account ID-6. Provide a description for the account (recommended)-7. Click **Add Account** to submit+4. Click **Add connection**+5. Provide a description (recommended)+6. Select the database target: the primary database or a specific read replica+7. Enter your AWS account ID+8. Click **Add connection** to submit-After submission, Supabase creates a VPC Lattice Resource Configuration for your project and sends an AWS Resource Share to the specified AWS Account ID. This process may take a few moments. Once complete, the account will show a "Ready" status, indicating that the resource share has been sent to your AWS account and is ready to be accepted.+Each database, whether the primary or a read replica, needs its own connection. Create a separate connection for every database you want to reach over PrivateLink.++After submission, Supabase creates a VPC Lattice Resource Configuration for your project and sends an AWS Resource Share to the specified AWS account ID. This process may take a few moments. Once complete, the connection will show a "Ready" status, indicating that the resource share has been sent to your AWS account and is ready to be accepted. You must accept the resource share within 12 hours, or the request expires and can no longer be accepted in AWS. You'll need to create a new connection to try again.++Once ready, select **View connection** to see the VPC Lattice resource configuration ID and ARNs for the connection. This is useful for confirming which resource configuration corresponds to which database when a project has multiple connections, for example one for the primary database and one for each read replica.### Step 2: Accept resource share@@ -61,6 +65,7 @@ Supabase will send you an AWS Resource Share containing the VPC Lattice Resource3. Go to [Shared with me > Resource shares](https://console.aws.amazon.com/ram/home#SharedResourceShares)4. Locate the resource share from Supabase.- The resource share has the format `sspl-[project_ref]-[random alphanumeric string]`+ - If your project has multiple connections, for example one for the primary database and one for each read replica, match the share's ARN to the **Resource share ARN** shown for that connection in **View connection** to confirm you're accepting the correct one5. Click on the resource share name to view details. Review the list of resource shares - it should only include resources of type vpc-lattice:ResourceConfiguration.6. Click **Accept resource share**7. Confirm the acceptance in the dialog box@@ -95,6 +100,7 @@ In your AWS account, you have two options to establish connectivity:5. Under Type, select **Resources**6. In the **Resource configurations** section select the appropriate resource configuration- The resource configuration name will be in the format `[organisation]-[project-ref]-rc`+ - If you have multiple connections, match the **Resource configuration ID** shown for that connection in **View connection** to confirm you select the configuration for the correct database7. Select your VPC from the dropdown. This should match the VPC you selected for your security group in Step 38. Enable the **Enable DNS name** option if you want to use a DNS record instead of the endpoints IP address(es)9. Choose the appropriate subnets for your network@@ -115,6 +121,7 @@ In your AWS account, you have two options to establish connectivity:4. In the service network details, go to the **Resource configuration associations** tab5. Click **Create associations**6. Select the appropriate **Resource configuration** from the dropdown+ - If you have multiple connections, match the **Resource configuration ID** shown for that connection in **View connection** to confirm you select the configuration for the correct database7. Click **Save changes**8. After creation, you will see the resource configuration in the Resource configurations section of your service network with the status "Active"9. For connectivity, click on the association details and the domain name will be listed in the **DNS entries** section@@ -174,7 +181,7 @@ For maximum security, you can restrict public database access in your project se## Limitations-- **Read Replicas**: To establish PrivateLink with a Read Replica, reach out to your account rep.+- **Service Scope**: PrivateLink only supports database connections (Postgres and PgBouncer). Other Supabase services (API, Storage, Auth, Realtime) will continue to operate over public internet connections.- **Feature Evolution**: The setup process and capabilities may evolve as we refine the offering## Compatibilitydiff --git a/apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/DropReplicaConfirmationModal.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/DropReplicaConfirmationModal.tsxindex 91f7c2fb97f..0e769e290bf 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/DropReplicaConfirmationModal.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/DropReplicaConfirmationModal.tsx@@ -34,7 +34,7 @@ export const DropReplicaConfirmationModal = ({<span>Remove the replica{' '}<InlineLink href={`/project/${projectRef}/settings/integrations`}>- PrivateLink association+ PrivateLink connection</InlineLink>{' '}before dropping this read replica</span>diff --git a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsx b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsxindex 6d7af86331d..f383d3e71eb 100644--- a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsx+++ b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsx@@ -8,6 +8,9 @@ import {DropdownMenuItem,DropdownMenuSeparator,DropdownMenuTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger,} from 'ui'import { formatDatabaseID } from '@/data/read-replicas/replicas.utils'@@ -17,6 +20,9 @@ interface AWSPrivateLinkAccountItemProps {account_name?: stringdatabase_type?: 'PRIMARY' | 'READ_REPLICA'database_identifier?: string+ resource_access_manager_resource_config_id?: string+ resource_access_manager_resource_config_arn?: string+ resource_access_manager_share_arn?: stringstatus:| 'CREATING'| 'READY'@@ -34,6 +40,9 @@ export const AWSPrivateLinkAccountItem = ({account_name,database_type,database_identifier,+ resource_access_manager_resource_config_id,+ resource_access_manager_resource_config_arn,+ resource_access_manager_share_arn,status,onEdit,onDelete,@@ -65,9 +74,30 @@ export const AWSPrivateLinkAccountItem = ({return (<CardContent className="flex items-center justify-between text-sm gap-4"><div className="flex-1">- <div>{aws_account_id}</div>- <div className="text-xs text-foreground-lighter">{databaseTarget}</div>- <div className="text-sm text-foreground-lighter">{account_name || 'No description'}</div>+ {account_name && <div className="font-medium text-foreground">{account_name}</div>}+ <div className="text-xs text-foreground-lighter">Database: {databaseTarget}</div>+ <div className="text-xs text-foreground-lighter">Destination account: {aws_account_id}</div>+ {resource_access_manager_resource_config_id && (+ <div className="flex items-center gap-x-1 text-xs text-foreground-lighter">+ <span>Resource configuration:</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="font-mono">{resource_access_manager_resource_config_id}</span>+ </TooltipTrigger>+ {(resource_access_manager_resource_config_arn ||+ resource_access_manager_share_arn) && (+ <TooltipContent side="bottom" className="max-w-xs break-all">+ {resource_access_manager_resource_config_arn && (+ <p>Resource config ARN: {resource_access_manager_resource_config_arn}</p>+ )}+ {resource_access_manager_share_arn && (+ <p>Resource share ARN: {resource_access_manager_share_arn}</p>+ )}+ </TooltipContent>+ )}+ </Tooltip>+ </div>+ )}</div>{getStatusBadge()}@@ -79,12 +109,12 @@ export const AWSPrivateLinkAccountItem = ({<DropdownMenuContent align="end" className="w-40"><DropdownMenuItem onClick={onEdit} className="gap-x-2"><Edit size={14} />- <span>View account</span>+ <span>View connection</span></DropdownMenuItem><DropdownMenuSeparator /><DropdownMenuItem onClick={onDelete} className="gap-x-2"><Trash size={14} />- <span>Delete account</span>+ <span>Delete connection</span></DropdownMenuItem></DropdownMenuContent></DropdownMenu>diff --git a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsxindex a41ec80e7b3..52b0ba6ac35 100644--- a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx+++ b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx@@ -25,6 +25,7 @@ import {SheetTitle,} from 'ui'import { Admonition } from 'ui-patterns/Admonition'+import { Input as CopyableInput } from 'ui-patterns/DataInputs/Input'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'import { InlineLink } from '@/components/ui/InlineLink'@@ -76,24 +77,24 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLi: account?.status === 'READY'? 'Connection is ready to accept': account?.status === 'CREATING'- ? 'This account connection is being created'+ ? 'This connection is being created': account?.status === 'DELETING'- ? 'This account is being deleted'+ ? 'This connection is being deleted': account?.status === 'ASSOCIATION_REQUEST_EXPIRED'- ? 'Account acceptance request has expired'+ ? 'This request has expired': account?.status === 'CREATION_FAILED'- ? 'Failed to create account'- : 'This account needs to be accepted by the AWS account owner.'+ ? "Couldn't create this connection"+ : 'This connection needs to be accepted by the AWS account owner.'const description =account?.status === 'ASSOCIATION_ACCEPTED'- ? 'The resource share has been accepted by the AWS account owner and the connection is established.'+ ? 'The AWS account owner has accepted the resource share.': account?.status === 'READY'- ? 'It may be waiting acceptance from the AWS account owner. Association requests are automatically deleted if not accepted within 12 hours.'+ ? 'It may be waiting acceptance from the AWS account owner. Requests expire after 12 hours.': account?.status === 'ASSOCIATION_REQUEST_EXPIRED'- ? 'Reconnect this account to initiate a new connection request'+ ? 'Add a new connection to try again.': account?.status === 'CREATION_FAILED'- ? 'Reconnect this account to initiate a new connection request'+ ? 'Add a new connection to try again.': ''const onSubmit = (values: FormValues) => {@@ -112,7 +113,7 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLi{onSuccess: () => {form.reset(defaultValues)- toast.success('Successfully added AWS account')+ toast.success('Connection added')onOpenChange(false)},}@@ -133,15 +134,17 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLi<Sheet open={open} onOpenChange={onOpenChange}><SheetContent className="flex flex-col gap-0"><SheetHeader>- <SheetTitle>{isNew ? 'Add AWS Account' : 'AWS Account Details'}</SheetTitle>+ <SheetTitle>{isNew ? 'Add connection' : 'Connection details'}</SheetTitle><SheetDescription>- Connect to your Supabase project from your AWS VPC using AWS PrivateLink.{' '}+ {isNew+ ? 'Enter an AWS account to connect. You’ll need to accept the share in AWS. '+ : 'These values identify the resource share in AWS. '}<InlineLink href={`${DOCS_URL}/guides/platform/privatelink`}>Learn more</InlineLink></SheetDescription></SheetHeader><Form {...form}>- <form onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col flex-1">- <SheetSection className="space-y-4 flex-1">+ <form onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col flex-1 min-h-0">+ <SheetSection className="space-y-4 flex-1 overflow-y-auto">{!isNew && account && (<><Admonition@@ -192,7 +195,7 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLirel="noopener noreferrer"href={`${DOCS_URL}/guides/platform/privatelink#step-2-accept-resource-share`}>- How to accept?+ How to accept</Link></Button>)@@ -200,6 +203,28 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLi/></>)}+ <FormField+ control={form.control}+ name="accountName"+ render={({ field }) => (+ <FormItemLayout+ label="Description"+ description="A description for this connection."+ >+ <FormControl>+ <Input+ {...field}+ readOnly={!isNew}+ onFocus={(e) => {+ if (!isNew) {+ e.target.blur()+ }+ }}+ />+ </FormControl>+ </FormItemLayout>+ )}+ />{(showPrivateLinkReadReplica || !isNew) && (<FormFieldcontrol={form.control}@@ -207,7 +232,7 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLirender={({ field }) => (<FormItemLayoutlabel="Database target"- description="Associations are created per database target. The same AWS account can be associated with both primary and replica databases."+ description="Each database needs its own connection. The same AWS account can connect to both primary and replica databases."><FormControl><Select@@ -245,7 +270,7 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLiname="awsAccountId"render={({ field }) => (<FormItemLayout- label="AWS Account ID"+ label="AWS account ID"description="The ID of the AWS account you want to connect to."><FormControl>@@ -263,28 +288,38 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLi</FormItemLayout>)}/>- <FormField- control={form.control}- name="accountName"- render={({ field }) => (- <FormItemLayout- label="Account Name"- description="A name for this account connection."- >- <FormControl>- <Input- {...field}- readOnly={!isNew}- onFocus={(e) => {- if (!isNew) {- e.target.blur()- }- }}- />- </FormControl>- </FormItemLayout>- )}- />+ {!isNew && account?.resource_access_manager_resource_config_id && (+ <FormItemLayout+ label="Resource Configuration ID"+ description="The AWS VPC Lattice resource configuration ID for this connection."+ >+ <CopyableInput+ readOnly+ copy+ value={account.resource_access_manager_resource_config_id}+ />+ </FormItemLayout>+ )}+ {!isNew && account?.resource_access_manager_resource_config_arn && (+ <FormItemLayout+ label="Resource Configuration ARN"+ description="The ARN of the AWS VPC Lattice resource configuration."+ >+ <CopyableInput+ readOnly+ copy+ value={account.resource_access_manager_resource_config_arn}+ />+ </FormItemLayout>+ )}+ {!isNew && account?.resource_access_manager_share_arn && (+ <FormItemLayout+ label="Resource Share ARN"+ description="The ARN of the AWS RAM resource share."+ >+ <CopyableInput readOnly copy value={account.resource_access_manager_share_arn} />+ </FormItemLayout>+ )}</SheetSection><SheetFooter>@@ -293,7 +328,7 @@ export const AWSPrivateLinkForm = ({ account, open, onOpenChange }: AWSPrivateLi</Button>{isNew && (<Button type="submit" loading={isPending}>- Add Account+ Add connection</Button>)}</SheetFooter>diff --git a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsxindex e8d1595f239..ecc6759da42 100644--- a/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx+++ b/apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx@@ -34,7 +34,7 @@ export const AWSPrivateLinkSection = () => {const { mutate: deleteAccount, isPending: isDeleting } = useAWSAccountDeleteMutation({onSuccess: () => {- toast.success('Account will be deleted shortly')+ toast.success('Connection will be deleted shortly')setShowDeleteModal(false)setSelectedAccount(undefined)},@@ -80,9 +80,7 @@ export const AWSPrivateLinkSection = () => {<PageSectionSummary><PageSectionTitle>AWS PrivateLink</PageSectionTitle><PageSectionDescription>- Connect to your Supabase project from your AWS VPC using AWS PrivateLink. Create a- private connection between your AWS VPC and your Supabase project without traffic- traversing the public internet.+ Connect to this project from your AWS VPC without using the public internet.</PageSectionDescription></PageSectionSummary></div>@@ -92,17 +90,17 @@ export const AWSPrivateLinkSection = () => {{promptPlanUpgrade && (<UpgradeToProlayout="vertical"- primaryText="Only available on Team or Enterprise Plan and above"- secondaryText="Connect your AWS VPC privately to your Supabase project using AWS PrivateLink."+ primaryText="Available on Team and Enterprise plans"+ secondaryText="Upgrade to add a PrivateLink connection."buttonText="Upgrade to Team"source="aws-privatelink-integration"/>)}<div className={cn(promptPlanUpgrade && 'opacity-25 pointer-events-none')}><div className="flex items-center justify-between mb-3">- <h3 className="text-sm font-medium text-foreground">AWS Accounts</h3>+ <h3 className="text-sm font-medium text-foreground">Connections</h3><Button variant="default" onClick={onAddAccount}>- Add account+ Add connection</Button></div>{(accounts?.length ?? 0) > 0 ? (@@ -119,7 +117,7 @@ export const AWSPrivateLinkSection = () => {) : (<Card><CardContent>- <p className="text-foreground-lighter text-sm">No accounts connected</p>+ <p className="text-foreground-lighter text-sm">No connections yet</p></CardContent></Card>)}@@ -133,15 +131,15 @@ export const AWSPrivateLinkSection = () => {<ConfirmationModalvariant="destructive"visible={showDeleteModal}- title="Confirm to delete AWS Account"+ title="Delete connection"confirmLabel="Delete"loading={isDeleting}onCancel={() => setShowDeleteModal(false)}onConfirm={onConfirmDelete}><p className="text-sm text-foreground-light">- Are you sure you want to delete the AWS account connection for{' '}- {selectedAccount?.aws_account_id}?+ This removes the PrivateLink connection for {selectedAccount?.aws_account_id}.+ Applications using this private path will lose access.</p><p className="text-sm text-foreground-lighter mt-1">Database:{' '}diff --git a/apps/studio/data/aws-accounts/aws-account-create-mutation.ts b/apps/studio/data/aws-accounts/aws-account-create-mutation.tsindex 9bfe6bedf8c..060e6f9e566 100644--- a/apps/studio/data/aws-accounts/aws-account-create-mutation.ts+++ b/apps/studio/data/aws-accounts/aws-account-create-mutation.ts@@ -56,7 +56,7 @@ export const useAWSAccountCreateMutation = ({},async onError(data, variables, context) {if (onError === undefined) {- toast.error(`Failed to create AWS account: ${data.message}`)+ toast.error(`Failed to create connection: ${data.message}`)} else {onError(data, variables, context)}diff --git a/apps/studio/data/aws-accounts/aws-account-delete-mutation.ts b/apps/studio/data/aws-accounts/aws-account-delete-mutation.tsindex 9389d2eca95..2fc22aa974a 100644--- a/apps/studio/data/aws-accounts/aws-account-delete-mutation.ts+++ b/apps/studio/data/aws-accounts/aws-account-delete-mutation.ts@@ -63,7 +63,7 @@ export const useAWSAccountDeleteMutation = ({},async onError(data, variables, context) {if (onError === undefined) {- toast.error(`Failed to delete AWS account: ${data.message}`)+ toast.error(`Failed to delete connection: ${data.message}`)} else {onError(data, variables, context)}diff --git a/apps/studio/data/aws-accounts/aws-accounts-query.ts b/apps/studio/data/aws-accounts/aws-accounts-query.tsindex 19f2208ef0a..ca378da61fd 100644--- a/apps/studio/data/aws-accounts/aws-accounts-query.ts+++ b/apps/studio/data/aws-accounts/aws-accounts-query.ts@@ -11,11 +11,14 @@ type AWSAccountsVariables = {projectRef?: string}-// [Joshen] API types should be updated with these 2 parameters, so remove once verified+// [Joshen] API types should be updated with these parameters, so remove once verifiedexport type AWSAccount =components['schemas']['GetPrivateLinkResponse']['private_link_associations'][number] & {database_type?: 'PRIMARY' | 'READ_REPLICA'database_identifier?: string+ resource_access_manager_resource_config_id?: string+ resource_access_manager_resource_config_arn?: string+ resource_access_manager_share_arn?: string}async function getAWSAccounts({ projectRef }: AWSAccountsVariables, signal?: AbortSignal) {