You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created two short functions that would be useful additions:
Get the aws instance id. Only run on an actual aws instance:
# Only run on aws instance
# Get the instance id
get_instance_id = function(verbose = FALSE) {
system(
"curl http://instance-data/latest/meta-data/instance-id",
intern = TRUE,
ignore.stderr = !verbose
)
}
Check if we are running on an instance.
is_instance = function() {
hostname <- system("hostname -d", intern = TRUE)
# Grep could be made better by checking for eu-west-1, etc.
length(grep("*.compute.internal$", hostname)) > 1
}
Thanks - I'm just getting to this for some reason. The aws.ec2metadata package now provides an is_ec2() function that checks whether R is running on EC2. The other ideas are great and I'll try to implement them.
I've created two short functions that would be useful additions:
Get the aws instance id. Only run on an actual aws instance:
Check if we are running on an instance.
Example use case:
The text was updated successfully, but these errors were encountered: