Deployment Manager GitHub 代码库包含由 Google 和 Deployment Manager 社区创建的示例,包括本演示中使用的示例。
gitclonehttps://github.com/GoogleCloudPlatform/deploymentmanager-samples
# open the samples foldercddeploymentmanager-samples/examples/v2/step_by_step_guide
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[[["\u003cp\u003eThis tutorial guides users through setting up and using Deployment Manager with the \u003ccode\u003egcloud\u003c/code\u003e command-line tool.\u003c/p\u003e\n"],["\u003cp\u003eA Google Cloud project is required, and new users can sign up for a free trial offering $300 in credits.\u003c/p\u003e\n"],["\u003cp\u003eUsers must enable the necessary APIs, such as the Compute Engine API and Deployment Manager API, for their project.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud\u003c/code\u003e CLI, which can be installed locally or accessed via Cloud Shell, needs to be set up with a default project ID, region, and zone.\u003c/p\u003e\n"],["\u003cp\u003eUsers should clone the Deployment Manager GitHub repository to access sample configurations and the walkthrough materials.\u003c/p\u003e\n"]]],[],null,["# Installation and Setup\n\nThis tutorial goes through Deployment Manager using the `gcloud`\ncommand-line tool. Follow the setup steps to prepare your local environment to\nuse Deployment Manager.\n\nCreate a project\n----------------\n\nDeployment Manager requires a Google Cloud project. If you already have a\nproject, you can use your existing project.\n\nIf you are new to Google Cloud, you can create a new project and take\nadvantage of [Google Cloud's free trial](/free-trial)\npackage, which gives you $300 to spend on all Google Cloud products\nover 90 days. To sign up for the free trial:\n\n1. Open the [Google Cloud console](https://console.cloud.google.com/freetrial).\n2. Follow the instructions to sign up for the free trial.\n3. When prompted to create a project, enter a name and a project ID that will be used to identify your project, or accept the defaults, and click **Create** .\n | **Important:** The name you use must be between 4 and 30 characters. When you type the name, the form will suggest a project ID, which you can edit. The project ID you use must be between 6 and 30 characters, with a lowercase letter as the first character. You can use a dash, lowercase letter, or digit for the remaining characters, but the last character cannot be a dash. You should be aware that some resource identifiers (such as project IDs) might be retained beyond the life of your project. For this reason, avoid storing sensitive information in resource identifiers.\n ...see naming guidelines\n\nEnable the APIs for the Google Cloud resources that you want to manage\n----------------------------------------------------------------------\n\nDeployment Manager uses the APIs of other Google Cloud services to\ncreate and manage your resources. To create these resources, you must first\nenable the services' APIs for your project.\n\nFor this walkthrough, you deploy Compute Engine resources, so\nyou need to enable the Compute Engine API.\n\n\n[Enable the Compute Engine API](https://console.cloud.google.com/start/api?id=compute.googleapis.com)\n\nNext, enable Deployment Manager:\n\n\n[Enable the Deployment Manager API](https://console.cloud.google.com/start/api?id=deploymentmanager)\n\n\u003cbr /\u003e\n\nInstall Google Cloud CLI\n------------------------\n\nThe Google Cloud CLI offers a command-line tool, `gcloud`, that makes interacting\nwith Deployment Manager easy.\n\nTo install gcloud CLI:\n\n1. [Download and authenticate `gcloud`](https://cloud.google.com/sdk/#Quick_Start).\n\n Alternatively, use\n [Cloud Shell](https://console.cloud.google.com?cloudshell=true),\n which comes with `gcloud` already installed.\n2. Set your project ID.\n\n Every command requires a project ID. Set a default project ID so you do not\n need to provide it every time. **Remember to replace `myproject` with your\n own project ID**. \n\n gcloud config set project \u003cvar translate=\"no\"\u003emyproject\u003c/var\u003e\n\n3. Set your default zone and region. Some Google Cloud resources require\n a zone or a region, and you can set a default zone or region, similar to a\n default project. To set a default zone or region, use `gcloud config set`.\n In this case, use `us-central1` as the region and `us-central1-f` as the\n zone:\n\n gcloud config set compute/region us-central1\n gcloud config set compute/zone us-central1-f\n\nClone the Deployment Manager GitHub repository\n----------------------------------------------\n\nThe Deployment Manager GitHub repository contains samples created by\nGoogle and the Deployment Manager community, including the samples used in\nthis walkthrough. \n\n git clone https://github.com/GoogleCloudPlatform/deploymentmanager-samples\n\n # open the samples folder\n cd deploymentmanager-samples/examples/v2/step_by_step_guide\n\nNow that you have set up your environment, you can start creating your\ndeployment."]]