Skip to content

Code notes

ArthurMitchell42 edited this page Jul 5, 2021 · 6 revisions

Global definitions and start up

Code

The environment variable AWS_CONFIG_PATH has been added to help implementation in docker. In the docker file there is an ENV definition to set it to /config, where the volume mount point goes. On other systems it can be left blank to use the working directory as the config & log location or be set to an OS specific value.

The configuration file

Code

See the read-me file for the format and details.

The credentials file

Code

The assumption is that your credential file is either in the default location, in which case the BOTO3 functions pick up on it automatically, or the AWS_SHARED_CREDENTIALS_FILE environment variable is set to give a custom location for the system.
The code looks first for the s3_user profile and if that isn’t present it try’s the default profile. This is a good strategy if you use a shared, or common credential file as you will need multiple profiles to isolate access to AWS features and services.
If the default profile isn’t found a session object is created with no profile listed. When a BOTO3 function needs authorisation it then falls back to the two environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY which explicitly list credential information.

Getting the external IP address

Code

The Get_External_IP_From_AWS method uses a call to http://checkip.amazonaws.com to get the external address. This URL neatly returns just a string with the address.

Clone this wiki locally