Go SDK
Edge does not provide its own Go SDK. For Storage, use the AWS SDK for Go v2. For Compute, CDN, and DNS, use the REST API with net/http.
How it works
Edge Storage is S3-compatible. Use the aws-sdk-go-v2
S3 client with Edge's endpoint and static credentials. For Compute, CDN, and DNS, call the REST API at
https://api.edge.network
using the standard library net/http.
Storage: Installing and configuring
Add the AWS SDK for Go v2:
go get github.com/aws/aws-sdk-go-v2
go get github.com/aws/aws-sdk-go-v2/config
go get github.com/aws/aws-sdk-go-v2/service/s3
go get github.com/aws/aws-sdk-go-v2/credentials Configure the S3 client with Edge's endpoint (region us-east-1, path-style access):
package main
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
func newEdgeS3Client(accessKey, secretKey string) *s3.Client {
return s3.NewFromConfig(aws.Config{
Region: "us-east-1",
Credentials: credentials.NewStaticCredentialsProvider(
accessKey, secretKey, "",
),
}, func(o *s3.Options) {
o.BaseEndpoint = aws.String("https://storage.edge.network")
o.UsePathStyle = true
})
} Storage operations
Create a bucket:
_, err := client.CreateBucket(ctx, &s3.CreateBucketInput{
Bucket: aws.String("my-bucket"),
}) Upload a file:
_, err := client.PutObject(ctx, &s3.PutObjectInput{
Bucket: aws.String("my-bucket"),
Key: aws.String("deployments/app.tar.gz"),
Body: bytes.NewReader(data),
ContentType: aws.String("application/gzip"),
}) List objects:
out, err := client.ListObjectsV2(ctx, &s3.ListObjectsV2Input{
Bucket: aws.String("my-bucket"),
Prefix: aws.String("deployments/"),
})
for _, obj := range out.Contents {
fmt.Println(*obj.Key)
} Compute, CDN, DNS: REST API with net/http
For non-Storage products, use net/http:
req, _ := http.NewRequest("GET", "https://api.edge.network/api/compute/vms", nil)
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
// decode resp.Body to struct Use the same pattern for CDN deployments, DNS zones and records, and VM power operations. See the API Reference for endpoints.
Practical example: Deployment script
A simple script that builds a tarball and uploads it to Edge Storage:
func deploy(ctx context.Context, dir, bucket string) error {
var buf bytes.Buffer
gw := gzip.NewWriter(&buf)
tw := tar.NewWriter(gw)
// add files from dir to tar...
tw.Close()
gw.Close()
key := fmt.Sprintf("deployments/%s.tar.gz", time.Now().Format("20060102-150405"))
_, err := s3Client.PutObject(ctx, &s3.PutObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
Body: bytes.NewReader(buf.Bytes()),
ContentType: aws.String("application/gzip"),
})
return err
} Extend this with API calls to trigger VM restarts or CDN purges after upload. Combine Storage and REST API usage for full automation.