Skip to content
Access to EC2 Instance Metadata
Branch: master
Clone or download
Latest commit 71adea3 Jul 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github add .github files Mar 8, 2018
R More spellchecks Jul 15, 2019
inst initial commit (closes #1) Dec 19, 2016
man More spellchecks Jul 15, 2019
.Rbuildignore Add cran comments Jul 15, 2019
.gitignore Ignore revdeps [ci skip] Apr 24, 2019
.travis.yml Update test matrix Jul 8, 2019
DESCRIPTION Update release date Jul 15, 2019
NAMESPACE Update docs and namespace May 31, 2018 Fix spelling Jul 15, 2019 Update docs about changes Jul 12, 2019
appveyor.yml initial commit (closes #1) Dec 19, 2016 Update testing notes Jul 15, 2019 initial commit (closes #1) Dec 19, 2016

Get EC2 Instance Metadata

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.


# get instance id

# get ami id

# check for IAM role (NULL if none specified)
(role <- metadata$iam_info())
# get role credentials
if (!is.null(role)) {

# get an arbitrary metadata item


CRAN Downloads Travis Build Status Appveyor Build Status

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 = "", getOption("repos")))

Or, to pull a potentially unstable version directly from GitHub:

if (!require("remotes")) {

cloudyr project logo

You can’t perform that action at this time.