Overview
In this page, you learn how to use the Database Migration Service API to manage connection profiles for a PostgreSQL source database and a AlloyDB destination.
There are two ways that you can use the Database Migration Service API. You can make REST API calls or you can use the Google Cloud CLI (CLI).
To see high-level information about using gcloud
to manage Database Migration Serviceconnection profiles, click here.
Create a connection profile for a PostgreSQL source database
The following shows a request to create a connection profile for a PostgreSQL source database.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
- connection-profile-display-name: The connection profile display name
- host-ip-address: The source IP address
- username: The database user name
- password: The database user password
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles?connectionProfileId=connection-profile-id
Request JSON body:
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
gcloud
To see high-level information about using gcloud
to create Database Migration Service connection profiles, click here.
After creation, you can view the information about your connection profile
by calling the connectionProfiles/get
method.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
HTTP method and URL:
GET https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
gcloud
For more information on using gcloud
to retrieve information about your connection profile, click here.
Create a connection profile for a Cloud SQL for PostgreSQL source database
The following shows a request to create a connection profile for a Cloud SQL for PostgreSQL source database. This example uses a PostgreSQL connection profile because it connects to the PostgreSQL database engine, and not the Cloud SQL management layer.
To create the pairing between the source and replica using
Cloud SQL, you must provide the instance ID for your
Cloud SQL database. You can find the instance ID value by using the
databases/list
method
of the Cloud SQL Admin API.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
- connection-profile-display-name: The connection profile display name
- host-ip-address: The source IP address
- username: The database user name
- password: The database user password
- cloud-sql-instance-id: The Cloud SQL instance ID
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles?connectionProfileId=connection-profile-id
Request JSON body:
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
gcloud
To see high-level information about using gcloud
to create Database Migration Service connection profiles, click here.
Create a connection profile for an AlloyDB for PostgreSQL destination
The following shows a request to create a connection profile for an AlloyDB for PostgreSQL destination. Database Migration Service uses the information in this request to create a new AlloyDB instance.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
- connection-profile-display-name: The connection profile display name
- cluster-id: The AlloyDB cluster ID to create
- user: The user-name to give the initial user
- password: The password to give the initial user
- vpc-network: The VPC network the AlloyDB cluster will be connected with
- instance-id: The AlloyDB instance ID to create
- cpu-count: The number of CPUs to configure the instance with
All data stored within Google Cloud is encrypted at rest using the same hardened key management systems that we use for our own encrypted data. These key-management systems provide strict key access controls and auditing, and encrypt user data at rest using AES-256 encryption standards. No setup, configuration, or management is required. Google Cloud's default encryption at rest is the best choice for users who don't have specific requirements related to compliance or locality of cryptographic material.
HTTP method and URL:
POST https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles?connectionProfileId=connection-profile-id
Request JSON body:
{ "displayName": "connection-profile-display-name", "alloydb": { "cluster_id": "cluster-id" "settings": { "initial_user": { "user": "user", "password": "password", } "vpc_network": "vpc-network", "primary_instance_settings": { "id": "instance-id", "machine_config": { "cpu_count": cpu-count } } } } }
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591975557292-5a7e4b195623c-e350e3da-713dee7d", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T15:25:57.430715421Z", "target": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
gcloud
To see high-level information about using gcloud
to create Database Migration Service connection profiles, click here.
Get information about a connection profile
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
HTTP method and URL:
GET https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
gcloud
For more information on using gcloud
to retrieve information about your connection profile, click here.
List connection profiles
The following shows a request to retrieve information about all of your connection profiles.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
orderBy:
Use this filter to retrieve a listing of all connection profiles for a particular region in alphabetical order. For example, theorderBy=name
filter returns all connection profiles, alphabetically, by name.-
pageSize:
Use this filter to specify the maximum number of connection profiles that Database Migration Service retrieves and displays on a page. For example, by settingpageSize=10
, Database Migration Service will return up to 10 connection profiles for a page.
If there are more than 10 connection profiles, then they appear on other pages. At the end of each page, a nextPageToken
parameter and unique identifier appear. Use the identifier to retrieve the listing of the connection profiles for the following page.
HTTP method and URL:
GET https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
gcloud
For more information on using gcloud
to retrieve information about all of your connection profiles, click here.
Update a connection profile
The following shows a request to update the username and password fields of
an existing connection profile. By using the updateMask
parameter in the request,
only these fields need to be included in the request body.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
- username: The database user name
- password: The database user password
HTTP method and URL:
PATCH
Request JSON body:
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "verb": "update", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
gcloud
For more information on using gcloud
to update your connection profile, click here.
Delete a connection profile
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
HTTP method and URL:
DELETE https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "verb": "delete", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
gcloud
For more information on using gcloud
to delete your connection profile, click here.
Delete a connection profile and the associated AlloyDB instance
The following shows a request to delete a destination connection profile, as well as cascade-deleting the associated AlloyDB instance.
REST
Before using any of the request data, make the following replacements:
- project-id: The project ID
- region: The project region
- connection-profile-id: The connection profile ID
HTTP method and URL:
DELETE https://datamigration.googleapis.com/v1/projects/project-id/locations/region/connectionProfiles/connection-profile-id?force=true
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/project-id/locations/region/operations/operation-1591973161667-5a7e422cb0ba4-3004980d-2ae97165", "metadata": { "@type": "type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata", "createTime": "2020-06-12T14:46:01.744267779Z", "target": "projects/project-id/locations/region/connectionProfiles/connection-profile-id", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
gcloud
For more information on using gcloud
to delete both your connection profile and the associated AlloyDB instance, click here.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-19 UTC.