On your local machine, create your Python script and package the script and a boto3 library as a ZIP folder.



  1. On your local machine, create a vro-python-aws folder, and install the boto3 Python SDK on it.
    mkdir vro-python-aws
    cd vro-python-aws
    mkdir lib
    pip install boto3 -t lib/
  2. Open an editor, and create the main Python script. For this use case, you are using Visual Studio Code.
    import boto3
    def handler(context, inputs):
        ec2 = boto3.resource('ec2')
        filters = [{
            'Name': 'instance-state-name',
            'Values': ['running']
        instances = ec2.instances.filter(Filters=filters)
        for instance in instances:
            print('Instance: ' + instance.id)
    This Python script lists all running EC2 instances in a given region.
  3. Save the created script as a main.py file in the vro-python-aws folder.
  4. Log in to a command-line interface.
  5. Navigate to the vro-python-aws folder.
    cd vro-python-aws
  6. Create a ZIP package that contains the Python script.
    zip -r --exclude=*.zip -X vro-python-aws.zip .
    Note: You can also create the ZIP package by using a ZIP utility tool, such as 7-Zip.


You have created the base Python script, and prepared it for import into your vRealize Orchestrator deployment.