Use an HTTP proxy - AWS SDK for Kotlin

Use an HTTP proxy

To access AWS through proxy servers using the AWS SDK for Kotlin, you can configure either JVM system properties or environment variables. If both are provided, the JVM system properties take precedence.

Use JVM system properties

The SDK looks for the JVM system properties https.proxyHost, https.proxyPort, and http.nonProxyHosts. For more information on these common JVM system properties, see Networking and Proxies in the Java documentation.

java -Dhttps.proxyHost=10.15.20.25 -Dhttps.proxyPort=1234 -Dhttp.nonProxyHosts=localhost|api.example.com MyApplication

Use environment variables

The SDK looks for the https_proxy, http_proxy, and no_proxy environment variables (and capitalized versions of each).

export http_proxy=http://10.15.20.25:1234 export https_proxy=http://10.15.20.25:5678 export no_proxy=localhost,api.example.com

Use a proxy on EC2 instances

If you configure a proxy on an EC2 instance launched with an attached IAM role, make sure to exempt the address that's used to access the instance metadata. To do this, set the http.nonProxyHosts JVM system property or no_proxy environment variable to the IP address of the Instance Metadata Service, which is 169.254.169.254. This address does not vary.

export no_proxy=169.254.169.254