Creating and activating a Managed Service for GitLab instance
Creating a GitLab instance
To create a Managed Service for GitLab instance, you need the vpc.user role and the gitlab.editor role or higher. For more information on assigning roles, see the Identity and Access Management documentation.
Warning
Once you have created an instance, you cannot change its network configuration, i.e., availability zone and subnet.
-
In the management console, select the folder where you want to create a GitLab instance.
-
Select Managed Service for GitLab.
-
Click Create instance.
-
At the top of the page:
-
Enter the instance name. It must be unique throughout Yandex Cloud.
- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
(Optional) Enter a description of the instance.
-
(Optional) Add tags to break instances into logical groups.
-
(Optional) Set instance protection against accidental deletion by the user.
-
-
Under Configuration:
-
Select the instance type. After you create an instance, you can change its type to a higher performing one.
-
Specify the availability zone. After you create an instance, you cannot change its availability zone.
-
Specify the subnet where the instance will be hosted. Currently, Yandex Cloud technical restrictions do not allow selecting a subnet with the
192.168.0.0/24address range. -
Select a security group or create a new one:
- Click Create group.
- Enter a name and description for the security group. You can add rules for the security group later in Virtual Private Cloud.
- Click Create.
If you do not specify a separate security group, the default security group created in the instance network will be used.
Configure your security group so that the rules allow incoming and outgoing traffic from the relevant ports and IP addresses.
Warning
The security group's setup determines the Managed Service for GitLab instance performance and availability.
If you have issues with setting up a security group, contact support
. -
Select the disk size. After you create an instance, you can increase its disk size.
-
Specify the instance domain name: relevant DNS records will be automatically created for it in the
.gitlab.yandexcloud.netdomain.The domain name must be unique throughout Yandex Cloud.
- Its length must be between 5 and 50 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must not start or end with a dash character.
-
Set up the retention period for automatic backups (in days).
-
(Optional) Enable code approval rules. To do this, select the appropriate configuration for approval rules.
Note
The configuration you select affects the cost of using the instance's computing resources.
-
-
Under Administrator data, specify:
- Email: Email address of the GitLab instance administrator. This is the address to receive the email with a link to create a password.
- Login: Administrator login.
-
(Optional) Under Advanced settings, enable deletion of untagged images. This setting affects the amount of free disk space on the instance.
-
Click Create.
-
Wait for the instance to get ready: its status on the Managed Service for GitLab dashboard will change to Running. This may take some time.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
See the description of the CLI command for creating a Managed Service for GitLab instance:
yc managed-gitlab instance create --help -
Select a subnet:
yc vpc subnet listResult:
+----------------------+---------------------------+----------------------+----------------+-------------------+-----------------+ | ID | NAME | NETWORK ID | ROUTE TABLE ID | ZONE | RANGE | +----------------------+---------------------------+----------------------+----------------+-------------------+-----------------+ | e9bnlm18l70a******** | default-ru-central1-a | enpe3m3fa00u******** | | ru-central1-a | [10.128.0.0/24] | +----------------------+---------------------------+----------------------+----------------+-------------------+-----------------+ -
Create a GitLab instance (this example does not use all available parameters):
yc managed-gitlab instance create \ --name first-instance \ --resource-preset-id <host_class> \ --disk-size <disk_size_in_GB> \ --admin-login <admin_login> \ --admin-email <admin_email_address> \ --domain-prefix <instance_domain_name> \ --deletion-protection \ --approval-rules <approval_rule_configuration> \ --subnet-id <subnet_ID>Where:
-
--name: Instance name, unique within Yandex Cloud. The naming requirements are as follows:- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
--resource-preset-id: Host class. Represents the configuration of the virtual machine to host the GitLab instance. The possible values are:s2.micro: 2 vCPUs, 8 GB RAMs2.small: 4 vCPUs, 16 GB RAMs2.medium: 8 vCPUs, 32 GB RAMs2.large: 16 vCPUs, 64 GB RAM
-
--disk-size: Disk size in GB. -
--admin-login: GitLab instance admin login. -
--admin-email: Instance admin email address. This is the address to receive the email with a link to create a password. -
--domain-prefix: Instance domain name. The system will automatically create the relevant DNS records for it in the.gitlab.yandexcloud.netdomain.The domain name must be unique throughout Yandex Cloud.
- Its length must be between 5 and 50 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must not start or end with a dash character.
-
--deletion-protection: Instance protection against accidental deletion by the user. -
--approval-rules: Approval rule configuration. The possible values are:BASICSTANDARDADVANCED
Note
The configuration you select affects the cost of using the instance's computing resources.
-
--subnet-id: ID of the selected subnet.
Result:
id: c17c60tpadua******** folder_id: b1g2slt7p9ug******** created_at: "2025-07-20T18:34:16.078Z" updated_at: "2025-07-20T18:34:16.078Z" name: test-cli resource_preset_id: s2.small disk_size: "107374182400" status: RUNNING admin_login: admin-gl admin_email: user@example.com domain: test-domain-user.gitlab.yandexcloud.net subnet_id: e9b4rrpuu2a******** backup_retain_period_days: "7" deletion_protection: true approval_rules_id: BASIC gitlab_version: 17.11.6For more information about this command, see the CLI reference.
-
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To create a GitLab instance:
-
In the Terraform configuration file, describe the resources you want to create:
resource "yandex_gitlab_instance" "my_gitlab_instance" { name = "<instance_name>" resource_preset_id = "<host_class>" disk_size = <disk_size_in_GB> admin_login = "<admin_login>" admin_email = "<admin_email_address>" domain = "<instance_domain_name>" subnet_id = "<subnet_ID>" approval_rules_id = "<approval_rule_configuration>" backup_retain_period_days = <backup_retention_period> deletion_protection = <true_or_false> }Where:
-
name: Instance name, unique within Yandex Cloud. The naming requirements are as follows:- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
resource_preset_id: Host class. Represents the configuration of the virtual machine to host the GitLab instance. The possible values are:s2.micro: 2 vCPUs, 8 GB RAMs2.small: 4 vCPUs, 16 GB RAMs2.medium: 8 vCPUs, 32 GB RAMs2.large: 16 vCPUs, 64 GB RAM
-
disk_size: Disk size in GB. -
admin_login: GitLab instance admin login. -
admin_email: Instance admin email address. This is the address to receive the email with a link to create a password. -
domain: Instance domain name in<name>.gitlab.yandexcloud.netformat. The system will automatically create the relevant DNS records for it in the.gitlab.yandexcloud.netdomain.The domain name must be unique throughout Yandex Cloud.
- Its length must be between 5 and 50 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must not start or end with a dash character.
-
subnet_id: ID of the selected subnet. -
approval_rules_id: Approval rule configuration. The possible values are:BASICSTANDARDADVANCED
Note
The configuration you select affects the cost of using the instance's computing resources.
-
backup_retain_period_days: Automatic backup retention period, in days. -
deletion_protection: Instance protection against accidental deletion by the user. The possible values aretrueorfalse.
For more information about
yandex_gitlab_instanceproperties, see the relevant provider documentation. -
-
Create the resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create all the required resources. You can check the new resources using the management console
or this CLI command:yc managed-gitlab instance list -
Use the Create REST API method for the Instance resource or the InstanceService/Create gRPC API call.
Note
When you create an instance in Managed Service for GitLab, it automatically generates an SSL certificate. No additional configuration for using HTTPS is required.
Activating the GitLab instance
After the instance status changes to Running, activate the instance:
-
Follow the link you received in your administrator mailbox after creating the instance.
If you cannot open the GitLab web interface, create a separate security group and configure it so that the rules allow incoming traffic from the required ports and IP addresses.
-
Change the administrator password.
-
Log in using the administrator username and password.
Further on, to open the GitLab web interface, get detailed information about your instance and follow the link in Domain.