You can convert an import topic to a standard one or conversely, a standard topic to an import one.
Convert an import topic to a standard topic
To convert an import topic to a standard topic, clear the ingestion settings. Perform the following steps:
Console
In the Google Cloud console, go to the Topics page.
Click the import topic.
In the topic details page, click Edit.
Clear the option Enable ingestion.
Click Update.
gcloud
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Run the
gcloud pubsub topics update
command:gcloud pubsub topics update TOPIC_ID \ --clear-ingestion-data-source-settings
Replace TOPIC_ID with the topic ID.
Convert a standard topic to an import topic
To convert a standard topic to an import topic, first check that you meet all the prerequisites.
Console
-
In the Google Cloud console, go to the Topics page.
-
Click the topic that you want to convert to an import topic.
-
In the topic details page, click Edit.
-
Select the option Enable ingestion.
-
For ingestion source, select Amazon Kinesis Data Streams.
-
Enter the following details:
-
Kinesis Stream ARN: The ARN for the Kinesis Data Stream that you are planning to ingest into Pub/Sub. The ARN format is as follows:
arn:${Partition}:kinesis:${Region}:${Account}:stream/${StreamName}
. -
Kinesis Consumer ARN: The ARN of the consumer resource that is registered to the AWS Kinesis Data Stream. The ARN format is as follows:
arn:${Partition}:kinesis:${Region}:${Account}:${StreamType}/${StreamName}/consumer/${ConsumerName}:${ConsumerCreationTimpstamp}
. -
AWS Role ARN: The ARN of the AWS role. The ARN format of the role is as follows:
arn:aws:iam:${Account}:role/${RoleName}
. -
Service account: The service account that you created in Create a service account in Google Cloud.
-
-
Click Update.
gcloud
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
-
Run the
gcloud pubsub topics update
command with all the flags mentioned in the following sample:gcloud pubsub topics update TOPIC_ID
--kinesis-ingestion-stream-arn KINESIS_STREAM_ARN
--kinesis-ingestion-consumer-arn KINESIS_CONSUMER_ARN
--kinesis-ingestion-role-arn KINESIS_ROLE_ARN
--kinesis-ingestion-service-account PUBSUB_SERVICE_ACCOUNTReplace the following:
-
TOPIC_ID is the topic ID. This field cannot be updated.
-
KINESIS_STREAM_ARN is the ARN for the Kinesis Data Streams that you are planning to ingest into Pub/Sub. The ARN format is as follows:
arn:${Partition}:kinesis:${Region}:${Account}:stream/${StreamName}
. -
KINESIS_CONSUMER_ARN is the ARN of the consumer resource that is registered to the AWS Kinesis Data Streams. The ARN format is as follows:
arn:${Partition}:kinesis:${Region}:${Account}:${StreamType}/${StreamName}/consumer/${ConsumerName}:${ConsumerCreationTimpstamp}
. -
KINESIS_ROLE_ARN is the ARN of the AWS role. The ARN format of the role is as follows:
arn:aws:iam:${Account}:role/${RoleName}
. -
PUBSUB_SERVICE_ACCOUNT is the service account that you created in Create a service account in Google Cloud.
-
Before trying this sample, follow the Go setup instructions in the
Pub/Sub quickstart using
client libraries.
For more information, see the
Pub/Sub Go API
reference documentation.
To authenticate to Pub/Sub, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Before trying this sample, follow the Java setup instructions in the
Pub/Sub quickstart using
client libraries.
For more information, see the
Pub/Sub Java API
reference documentation.
To authenticate to Pub/Sub, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the
Pub/Sub quickstart using
client libraries.
For more information, see the
Pub/Sub Node.js API
reference documentation.
To authenticate to Pub/Sub, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Before trying this sample, follow the Python setup instructions in the
Pub/Sub quickstart using
client libraries.
For more information, see the
Pub/Sub Python API
reference documentation.
To authenticate to Pub/Sub, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Before trying this sample, follow the C++ setup instructions in the
Pub/Sub quickstart using
client libraries.
For more information, see the
Pub/Sub C++ API
reference documentation.
To authenticate to Pub/Sub, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Before trying this sample, follow the Node.js setup instructions in the
Pub/Sub quickstart using
client libraries.
For more information, see the
Pub/Sub Node.js API
reference documentation.
To authenticate to Pub/Sub, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Go
Java
Node.js
Python
C++
Node.js (TypeScript)
For more information about ARNs, see Amazon Resource Names (ARNs) and IAM Identifiers.