How can I globally disable IMDSv1 fallback with PHP SDK? #3163
-
I use AWS SDK on an EC2 instance. I was wondering if putenv('AWS_EC2_METADATA_V1_DISABLED=true') would work for me for disabling IMDSv1 fallback? Currently the fallbacks cause 401 errors because IMDSv2 token is mandatory. I have no idea how to debug the real issue when the client falls back to IMDSv1 instead of writing the real IMDSv2 error. I am not even sure if the client would retry automatically or do I have to write a retry script. Do you have any experience with this? Can you share any reference or any programming language about the concepts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @lajos-resnweb, Sorry to hear about the issues caused by the fallback. If you are using version 3.286.0 and up, you'll be able to disable the V1 fallback using the |
Beta Was this translation helpful? Give feedback.
Hi @lajos-resnweb,
Sorry to hear about the issues caused by the fallback. If you are using version 3.286.0 and up, you'll be able to disable the V1 fallback using the
AWS_EC2_METADATA_V1_DISABLED
env var, OR using theec2_metadata_v1_disabled
configuration either in the shared config file or in code by passing it into an instance ofInstanceProfileProvider
as a config option when setting thecredentials
configuration option on an AWS service client.