1
votes

I have a web application written in go and want to access a local google cloud storage - GCS (not datastore). I am not using GAE, I will be using GCE. How do I set up GCS locally and access it from Go?

1

1 Answers

0
votes
  1. Install gcloud
  2. In the console run gcloud beta auth application-default login
  3. Login with the google account that owns the project
  4. In your code, your configuration should be like this:

    cliente, err := storage.NewClient(ctx)

    if err != nil {
        log.Fatal(err)
    }
    clienteCS = cliente.Bucket(bucketName)
    

5)If you haven't created a bucket, I would recomend to creat manually from console or with gsutil because you won't be frequently creating buckets 6)Run your code, enjoy

Steps from documentation are valid too but is headache