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 this Identity and Access Management guide.
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.
-
Go to Managed Service for GitLab.
-
Click Create instance.
-
At the top of the page:
-
Enter a name for your instance. It must be unique within Yandex Cloud.
- Length: between 3 and 63 characters.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Optionally, enter a description for the instance.
-
Optionally, add labels to break instances into logical groups.
-
Optionally, set instance protection against accidental deletion by users.
-
-
Under Configuration:
-
Select the instance type. After you create an instance, you can upgrade 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 to host the instance. 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 apply.
Configure your security group so that its rules allow incoming and outgoing traffic on the specified 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: the system will automatically create the relevant DNS records for it in the
.gitlab.yandexcloud.netdomain.The domain name must be unique within Yandex Cloud.
- It must be from 5 to 50 characters long.
- It can include lowercase Latin letters, numbers, and hyphens.
- It cannot not start or end with a hyphen.
-
Set up the automatic backup retention period in days.
-
Optionally, enable approval rules. To do this, select the appropriate configuration for approval rules.
Note
The configuration you select affects the cost of using the instance 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.
-
Optionally, under Advanced settings, enable deletion of untagged images. This setting affects the amount of free disk space on the instance.
-
Click Create.
-
Wait until the instance is ready: its status on the Managed Service for GitLab dashboard will change to Running. This may take a while.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
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. Follow these naming requirements:- Length: between 3 and 63 characters.
- 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. It determines the configuration of the VM 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 within Yandex Cloud.
- It must be from 5 to 50 characters long.
- It can include lowercase Latin letters, numbers, and hyphens.
- It cannot not start or end with a hyphen.
-
--deletion-protection: Instance protection against accidental deletion by users. -
--approval-rules: Approval rule configuration. The possible values are:BASICSTANDARDADVANCED
Note
The configuration you select affects the cost of using the instance 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. Follow these naming requirements:- Length: between 3 and 63 characters.
- 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. It determines the configuration of the VM 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 within Yandex Cloud.
- It must be from 5 to 50 characters long.
- It can include lowercase Latin letters, numbers, and hyphens.
- It cannot not start or end with a hyphen.
-
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 computing resources.
-
backup_retain_period_days: Automatic backup retention period, in days. -
deletion_protection: Instance protection against accidental deletion by users. The possible values aretrueorfalse.
For more information about
yandex_gitlab_instanceproperties, see this provider guide. -
-
Create the resources:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration 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, the system automatically generates an SSL certificate. Using HTTPS requires no advanced setup.
Activating a 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 access the GitLab web UI via the link, create a separate security group and configure it so that its 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 UI, get detailed information about your instance and follow the link in the Domain field.