Giter Club home page Giter Club logo

ec2metadatagetter's Introduction

ec2-metadata Build Status

This tool is a rewrite of the EC2 Instance Metadata API for PHP.

This is a fork of d9magai/Ec2MetadataGetter.

The differences from the fork are:

  • An additional method called getMultiple which fetches multiple instance attributes specified in an array
  • Caching support. The same request repeated twice on the same machine will give a cached response.
  • Custom caching directory. The constructor now takes a cache storage directory and uses that.
  • Support for returning dummy data

Usage:

In composer.json

"require": {
	"razorpay/ec2-metadata": "dev-master"
}

In your code:

<?php
use Razorpay\EC2Metadata\Ec2MetadataGetter;

$client = new Ec2MetadataGetter($cache_dir);

$client->getNetwork(); // Will return network info

// You can also enable use in dev environments with the following call:

$client->allowDummy();

$client->getAmiId(); // Will always return "ami-12345678"

// Another extra feature from the upstream is the inclusion of a getMultiple method:
// Dummy is always given priority

$client->getMultiple(['Network', ['AmiId']]);

// This returns both Network and AmiId in a properly keyed array

?>

LICENSE

This is licensed under the MIT License.

ec2metadatagetter's People

Contributors

guiwoda avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.