Before the multi-cloud application can be run, there are a few necessary steps that need to be taken in order to establish a connection through the Apache Libcloud API. The file that you need to make changes to is config.py located in the app director.
In order to deploy an instance, a user needs to have both an AWS and GCP accounts, and create keys to connect to the respective cloud provider.
AWS:
- Log in to the AWS console here.
- Click on services in the navigation bar and select IAM.
- On the left side navigation pane, click on Users.
- Click on Add User and make sure that programmatic access is checked.
- Click next to assign permissions to the user. Click on Create Group and type in any group name. Then select AmazonEC2FullAccess from the selection of policies.
- Continue through the steps until the User is created. Once created, select the user from the Users page.
- Click on Create Access Key and a window will pop up with your new key.
- Copy the Access Key ID and the Secret Access Key to the variables EC2_ACCESS_ID and EC2_SECRET_KEY in the config.py file.
GCP:
- Log in to the GCP console here.
- Create a new project by clicking on the navigation bar at the top.
- Once created, copy the project ID to the variable GCP_PROJECT_ID in the config.py file. The project ID is listed on the home page of the project.
- Next, use the navigation pane to find APIs and Services. Click on Create Credential and select OAuth Client ID.
- Select Other and create a name for the key.
- Copy the client ID and client Secret to the GCP_CLIENT_ID and the GCP_SECRET_KEY variables in config.py.Note: GCP requires that billing is set up in order to use the Apache Libcloud API.
Now, wee are ready to run the application. In the directory that contains run.py, run the following command:Python run.py
Note: On first run, GCP sometimes requires a user to navigate to a website that is listed in the terminal and enter the code listed to allow connection. This is a one time thing.