Socket
Socket
Sign inDemoInstall

gcp-metadata

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcp-metadata

Get the metadata from a Google Cloud Platform environment


Version published
Weekly downloads
11M
decreased by-4.23%
Maintainers
3
Weekly downloads
 
Created

What is gcp-metadata?

The gcp-metadata npm package is a library that allows users to query Google Cloud Platform's (GCP) metadata service for information about the currently running instance and project. This can be useful for applications that need to understand their environment within GCP, such as retrieving instance attributes or project details.

What are gcp-metadata's main functionalities?

Instance Metadata

Retrieve metadata of the current GCP instance. This includes details like the instance ID, zone, and custom metadata.

const gcpMetadata = require('gcp-metadata');

async function getInstanceMetadata() {
  if (await gcpMetadata.isAvailable()) {
    const instanceMetadata = await gcpMetadata.instance();
    console.log(instanceMetadata);
  }
}
getInstanceMetadata();

Project Metadata

Fetch metadata of the current GCP project. This can include project-wide attributes like project ID and numeric project number.

const gcpMetadata = require('gcp-metadata');

async function getProjectMetadata() {
  if (await gcpMetadata.isAvailable()) {
    const projectMetadata = await gcpMetadata.project();
    console.log(projectMetadata);
  }
}
getProjectMetadata();

Check Metadata Server Availability

Determine if the GCP metadata server is available and reachable from the instance.

const gcpMetadata = require('gcp-metadata');

async function checkAvailability() {
  const isAvailable = await gcpMetadata.isAvailable();
  console.log('Metadata service available:', isAvailable);
}
checkAvailability();

Other packages similar to gcp-metadata

Keywords

FAQs

Package last updated on 13 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc