The KMS instance SDK lets you run cryptographic operations and retrieve secret values using keys managed by Key Management Service (KMS). This guide walks you through installing the Go SDK.
Prerequisites
Before you begin, make sure you have:
A KMS instance that is purchased and enabled. See Purchase and enable a KMS instance.
At least one key created in the KMS instance. See Software-protected keys or Hardware-protected keys.
(Optional) A secret, if your application needs to retrieve secret values. See Create a secret.
Network requirements
Your application must be able to reach the KMS instance VPC address: <KMS_INSTANCE_ID>.cryptoservice.kms.aliyuncs.com.
How you set this up depends on where your application runs:
Same region and VPC as the KMS instance: No additional configuration needed. The connection is established by default.
Same region, different VPC: Associate your application's VPC with the KMS instance. See how to access the KMS instance from multiple VPCs in the same region.
Local IDC: Configure network connectivity to reach the KMS instance without using domain names. See the application access FAQ.
Install the SDK
Choose either method.
Method 1: go get
go get -u github.com/aliyun/alibabacloud-dkms-gcs-go-sdkMethod 2: go.mod
Add the dependency to your go.mod file:
require (
github.com/aliyun/alibabacloud-dkms-gcs-go-sdk <VERSION>
)Replace <VERSION> with the latest version. To find the current version, check the open-source repository.
What's next
Application access FAQ: Troubleshoot connectivity issues when integrating the Go SDK.