Certificates and Keys Question while Installing

As an absolute beginner, I am following the documentation while installing the open source mender server. One of the instructions include:
“CERT_API_CN=mender.example.com CERT_STORAGE_CN=s3.example.com …/keygen”.
Once I run this command with the proper DNS, I get the error:
mkdir: cannot create directory ‘api-gateway’: File exists
mkdir: cannot create directory ‘storage-proxy’: File exists
There are Nginx files inside these directories, so I’m confused here, what should I do?

Are you in the production directory when you try running this scripts? Because you should not have any nginx files inside these directories as they are at the top.

Did a test run and I see no problems,

integration/production ((HEAD detached at 2.0.0))
$ CERT_API_CN=mender.example.com CERT_STORAGE_CN=s3.example.com ../keygen
Generating an EC private key
writing new private key to 'private.key'
-----
Generating an EC private key
writing new private key to 'private.key'
-----
.........................................................++++
..............................++++
writing RSA key
......................................................................................++++
...................................................................++++
writing RSA key
All Mender Server keys and certificates have been generated in directory /home/mirzak/project/northern.tech/src/integration/production/keys-generated.
Please include them in your docker compose and device builds.
For more information please see https://docs.mender.io/Administration/Certificates-and-keys.

Thank you so much for the response. Turns out I was not on production directory like you said. If you don’ mind me asking, this setup also requires me to have a DNS for the Mender API Gateway. I’m kind of confused about this, what exactly should I provide for that part? Sorry if this is a sidetrack but any response will be appreciated!

The Mender API gateway is the primary access point for all Mender clients. In the setup above this is the mender.example.com entry. The certificate validation requires a domain name and not an IP address, thus the DNS requirement.