# NOT RUN {
names(metadata)
# }
# NOT RUN {
if (is_ec2()) {
metadata$versions()
metadata$items()
# get instance id
metadata$instance_id()
# get ami id
metadata$ami_id()
# get IAM role (NULL if none specified)
metadata$iam_info()
metadata$iam_role("myrole")
# get an arbitrary metadata item
metadata$item("meta-data/placement/availability-zone")
# get region from instance identity document
instance_document()$region
}
# Can also get ECS container metadata
if (is_ecs()) {
# Get ECS role credentials
metadata$ecs_task_role()
# or
ecs_metadata()
}
# }
Run the code above in your browser using DataLab