Python task to check AWS connectivity from Morpheus application node

In a scenario where an AWS cloud is failing to integrate with Morpheus app due to issues with the infrastructure. This simple python script may come in handy to confirm if the issue is related to Morpheus or something outside of Morpheus. The script will simply lists all VPCs in the specified region.

The script requires the following python modules which can be installed via pip:
morpheus-cypher
boto3

The script will pull the AWS creds from the Morpheus cypher. So if you are running the task outside of Morpheus then please modify the variables ‘access_key’ and ‘access_secret’ as required.

#AWS creds loaded from Morpheus Cypher
c = Cypher(morpheus=morpheus,ssl_verify=False)
access_key=c.get("secret/aws_access_key")
access_secret=c.get("secret/aws_access_secret")

Specify AWS region you want to connect to:

default_region="eu-west-2"

To run the task from Morpheus configure the task as shown below:

Make sure you specify the Additional Packages as shown.

When successfully executed the task will list VPCs available on the specified region.

Test via proxy server
If the appliance node is behind a proxy server, then to test connectivity via proxy please modify the following variable as required.

#No proxy
proxy_definitions = {}

#With proxy creds
#proxy_definitions = {
#    'https': 'username:password@proxy_address:3128'
#}

#Without proxy creds
#proxy_definitions = {
#    'https': 'proxy_address:3128'
#}
3 Likes