RustCloud is a rust library which hides the difference between different APIs provided by varied cloud providers (AWS, GCP, Azure etc.) and allows you to manage different cloud resources through a unified and easy to use API.
Compute -- Allows you to manage cloud and virtual servers.
Database -- Allows you to manage Compute storage.
Container -- Allows users to install and deploy containers onto container based virtualization platforms.
Load balancer -- Allows you to manager Load Balancer service.
DNS -- Allows you to manage DNS service.
- EC2 Compute Link to example
- EC2 Storage Link to example
- Amazon Elastic Container Service (Container) Link to example
- Elastic Load Balancing Link to example
- AWS Route53 (DNS) Link to example
- Google Compute Link to example
- Google Compute Storage Link to example
- Google Container Service (Container) Link to example
- Google Elastic Load Balancing Link to example
- Google DNS Link to example
- DigitalOcean Droplet Link to example
- DigitalOcean LoadBalancer Link to example
- DigitalOcean Storage Link to example
- DigitalOcean DNS Link to example
- ECS Compute Link to example
- ECS Storage Link to example
- Alibaba Cloud DNS Link to example
- Server Load Balancer Link to example
- Container Service Link to example
- Server Link to example
- Bare Metal Link to example
- Block Storage Link to example
- DNS Link to example
Currently, implementations for other cloud providers are being worked on.
-
Install golang.
$ sudo apt-get update -y $ sudo apt-get install golang -y
-
Set GOPATH environment variable. Run
gedit ~/.bashrc
.
Copy the following in your .bashrc file:
export GOPATH=$HOME/gopath
export GOBIN=$HOME/gopath/bin
- Test your installation by copying the following piece of code in a file. Save the file as gotest.go. Run the file using the command
go run gotest.go
. If that command returns “Hello World!”, then Go is successfully installed and functional.
package main
import "fmt"
func main() {
fmt.Printf("Hello World!\n")
}
- Now we need to fetch the gocloud repository and other necessary packages. Run the following commands in order:
$ go get github.com/cloudlibz/gocloud
$ go get golang.org/x/oauth2
$ go get cloud.google.com/go/compute/metadata
-
Create a directory called .gocloud in your HOME directory. Download your AWS, Google and DigitalOcean access credentials and store them in a file in your .gocloud folder.
Save your AWS credentials in a file named amazoncloudconfig.json.
{ "AWSAccessKeyID": "xxxxxxxxxxxx", "AWSSecretKey": "xxxxxxxxxxxx" }
Save your Google Cloud credentials in a file named googlecloudconfig.json. The file is downloaded in the required format.
Save your DigitalOcean credentials in a file named digioceancloudconfig.json.
{ "DigiOceanAccessToken": "xxxxxxxxxxxx" }
Save your Ali-cloud credentials in a file named alicloudconfig.json.
{ "AliAccessKeyID":"xxxxxxxxxxxx", "AliAccessKeySecret":"xxxxxxxxxxxx" }
Save your Vultr credentials in a file named vultrconfig.json.
{ "VultrAPIKey":"xxxxxxxxxxxx" }
You can also set your credentials as environment variables.
export AWSAccessKeyID = "xxxxxxxxxxxx" export AWSSecretKey = "xxxxxxxxxxxx"
export PrivateKey = "xxxxxxxxxxxx" export Type = "xxxxxxxxxxxx" export ProjectID = "xxxxxxxxxxxx" export PrivateKeyID = "xxxxxxxxxxxx" export ClientEmail = "xxxxxxxxxxxx" export ClientID = "xxxxxxxxxxxx" export AuthURI = "xxxxxxxxxxxx" export TokenURI = "xxxxxxxxxxxx" export AuthProviderX509CertURL = "xxxxxxxxxxxx" export ClientX509CertURL = "xxxxxxxxxxxx"
export DigiOceanAccessToken = "xxxxxxxxxxxx"
export AliAccessKeyID = "xxxxxxxxxxxx" export AliAccessKeySecret = "xxxxxxxxxxxx"
export VultrAPIKey = "xxxxxxxxxxxx"
-
You are all set to use gocloud! Check out the following YouTube videos for more information and usage examples: https://youtu.be/4LxsAeoonlY?list=PLOdfztY25UNnxK_0KRRHSngJIyVLDKZxq&t=3
$ git clone https://github.com/cloudlibz/gocloud
$ cd gocloud
$ cd gocloud
$ go test -v ./...
Please make sure to delete all your instances, storage blocks, load balancers, containers, and DNS settings once you run the tests by visiting the respective web portals of the cloud providers.