-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ec2_instance_metadata
and create ec2_instance_region
#349
Conversation
bors try |
tryBuild failed: |
c1b2dd6
to
095251b
Compare
Seems like I missed a patch. I took this opportunity to make the testset nicer too |
bors try |
095251b
to
c349663
Compare
tryBuild failed: |
bors try |
Does this resolve #287? Or maybe it needs
|
That issue in particular will need support for |
bors try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
351: Use a constant for the default region r=mattBrzezinski a=omus Mainly just some code refactoring. Could be useful in conjunction with #349 such that you can do: ```julia global_aws_config(; region=something(AWS.ec2_instance_region(), AWS.DEFAULT_REGION)) ``` Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
Why is that? I think it would be useful. Right now we set the config in |
Replaces the
_ec2_metadata
with the more generalizedec2_instance_metadata
. The main change here is using HTTP.jl'sconnect_timeout
which lets this function fail fast if running in and environment where the EC2 metadata is not available.Additionally I added a
ec2_instance_region
function which determines the region of an instance when executed on the instance. I originally was planning on using this function as the default foraws_get_region
but decided against it. It should still be useful in use cases such as:The one caveat with this change is that it requires a much newer version of HTTP.jl. Note the
connect_timeout
keyword was available in earlier revisions but had issues. Additionally, the special exception we're using was only available starting in HTTP.jl 0.9.6.