Skip to content

Instantly share code, notes, and snippets.

@rhyskentish
Last active May 18, 2020 16:03
Show Gist options
  • Save rhyskentish/466837306ccd1938bf07cc47f657ea0f to your computer and use it in GitHub Desktop.
Save rhyskentish/466837306ccd1938bf07cc47f657ea0f to your computer and use it in GitHub Desktop.
const { KeyManagementServiceClient } = require('@google-cloud/kms');
const projectId = <YourProjectID>;
const locationId = <YourPreferedStorageLocationID>; //Based on the google cloud regions e.g. us-central1
const keyRingId = <KeyRingID>;
const kmsClient = new KeyManagementServiceClient();
const locationName = kmsClient.locationPath(projectId, locationId);
async function createKeyRing() {
const [keyRing] = await kmsClient.createKeyRing({
parent: locationName,
keyRingId: keyRingId
});
console.log(`Created key ring: ${keyRing.name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment