tluck@M-C02ZJQ8GMD6M ~/my_src/atlas
$ atlas --profile=test-7 project apiKey create --role PROJ_OWNER --desc "test" --help
MongoDB returns the private API key only once. After you run this command, immediately copy, save, and secure both the public and private API keys.
Usage:
atlas projects apiKeys create [flags]
Examples:
# Create an organization API key with the ORG_OWNER role and assign it to the project with ID 5e2211c17a3e5a48f5497de3:
atlas projects apiKeys create --desc "My API key" --projectId 5e1234c17a3e5a48f5497de3 --role ORG_OWNER --output json
Flags:
--desc string Description of the API key.
-h, --help help for create
-o, --output string Output format. Valid values are json, json-path, go-template, or go-template-file.
--projectId string Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
--role strings Role or roles that you want to assign to the API key. To assign more than one role, you can specify each role with a separate role flag or specify all of the roles as a comma-separated list using one role flag. Valid values are ORG_OWNER, ORG_MEMBER, ORG_GROUP_CREATOR, ORG_BILLING_ADMIN, and ORG_READ_ONLY.
the roles for a project apiKey should be:
"roleName": "GROUP_CLUSTER_MANAGER"
"roleName": "GROUP_OWNER"
"roleName": "ORG_MEMBER"
"roleName": "GROUP_DATA_ACCESS_ADMIN"
"roleName": "GROUP_DATA_ACCESS_READ_WRITE"
"roleName": "GROUP_SEARCH_INDEX_EDITOR"
"roleName": "GROUP_READ_ONLY"
"roleName": "GROUP_DATA_ACCESS_READ_ONLY"
for example:
# atlas --profile=test-1 project apiKey create --role GROUP_OWNER --desc "cli 1"