riki
riki

Reputation: 186

How to set SSL certificate from gcloud?

I have an application that turns like the storaged database in Google Cloud is linked by HTTP and not HTTPS which makes problems with all the private networks that the app can work on them. I want to set ssl certificate for my Storage. I searched and found a lot of options and tried all of them an get nothing. now I'm here, These are the commands I already made:

mkdir ssl_cert
cd ssl_cert
openssl genrsa -out example.key 2048
openssl req -new -key example.key -out example.csr
openssl x509 -req -days 365 -in example.csr -signkey example.key -out example.crt

then I wrote this commmand:

gcloud compute ssl-certificates create [SSL_CERTIFICATE] \
--certificate [CRT_FILE_PATH] \
--private-key [KEY_FILE_PATH]

Of course I exchanged the first [] with 'my_ss_cert' the second [] with 'example.key' and the third [] with 'example.crt' but I got an error that both example.key and example.crt files does not found. after all the command I anderstand it's suppose to be there.

it looks like:

gcloud compute ssl-certificates create riki \ --certificate example.crt \ -- 
private-key example.key

and i get this error: ERROR: (gcloud.compute.ssl-certificates.create) unrecognized arguments: --certificate example.crt --private-key example.key To search the help text of gcloud commands, run: gcloud help -- SEARCH_TERMS

any idea?

Upvotes: 2

Views: 1714

Answers (1)

DazWilkin
DazWilkin

Reputation: 40061

The value for [SSL_CERTIFICATE] is your user-defined name by which you wish to associate the cert.... e.g. fred. The two PATH values must be to your example.crt and example.key respectively:

gcloud compute ssl-certificates create fred \
--certificate=./example.crt \
--private-key=./example.key \
--project=${PROJECT}

Upvotes: 1

Related Questions