The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
aws.ec2metadata is a package for retrieving Amazon
EC2 instance metadata from within the running instance. The package
simply contains a single R list, metadata
, that contains a
number of functions for retrieving metadata from within an instance.
Most of these functions return character strings, but some will return
lists; they default to NULL
if no value is returned.
library("aws.ec2metadata")
# get instance id
$instance_id()
metadata
# get ami id
$ami_id()
metadata
# check for IAM role (NULL if none specified)
<- metadata$iam_info())
(role # get role credentials
if (!is.null(role)) {
$iam_role("myrole")
metadata
}
# get an arbitrary metadata item
$item("meta-data/placement/availability-zone") metadata
This package is on CRAN, but to install the latest development version you can install from the cloudyr drat repository:
# latest stable version
install.packages("aws.ec2metadata", repos = c(cloudyr = "http://cloudyr.github.io/drat", getOption("repos")))
Or, to pull a potentially unstable version directly from GitHub:
if (!require("remotes")) {
install.packages("remotes")
}::install_github("cloudyr/aws.ec2metadata") remotes
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.