We highly recommend you check out the ECS credential provider emulator capability instead of using the Metadata service capability. But if needed, here are the steps:
Run commands:
sudoifconfiglo0169.254.169.254aliasecho"rdr pass on lo0 inet proto tcp from any to 169.254.169.254 port 80 -> 127.0.0.1 port 9091"|sudopfctl-ef-
Alternatively to persist the settings above on a Mac, download the plists and place them in /Library/LaunchDaemons and reboot or issue the following commands: