코드형 인프라(IaC)는 그래픽 사용자 인터페이스 또는 명령줄 스크립트 대신 코드를 사용하여 소프트웨어 애플리케이션 인프라를 프로비저닝하고 관리하는 프로세스입니다.
애플리케이션 인프라를 프로비저닝할 때는 일반적으로 가상 머신, 데이터베이스 연결, 스토리지, 기타 인프라 요소를 설정하고 관리해야 합니다. 이러한 인프라를 수동으로 관리하는 데 시간이 오래 걸리고 오류가 발생하기 쉬운데 대규모 애플리케이션을 관리할 때 특히 그렇습니다.
IaC를 사용하면 구성 파일로 인프라를 정의할 수 있으므로 안전하고 반복 가능한 방식으로 인프라를 빌드, 변경, 관리할 수 있습니다. 버전 관리, 재사용, 공유할 수 있는 리소스 구성을 정의할 수 있습니다. IaC를 사용하면 원하는 인프라 상태를 지정할 수 있습니다. 그런 다음 동일한 구성을 여러 번 배포하여 재현 가능한 개발, 테스트, 프로덕션 환경을 만들 수 있습니다.
IaC를 사용하면 애플리케이션 코드를 처리할 때와 동일한 방식으로 인프라 프로비저닝 및 구성을 처리할 수 있습니다. 소스 제어에 프로비저닝 구성 논리를 저장하고 지속적 통합 및 지속적 배포(CI/CD) 파이프라인을 활용할 수 있습니다.
IaC의 이점
IaC를 사용하여 애플리케이션 인프라를 설정하고 관리하는 것은 여러 일반적인 사용 사례에 권장됩니다. Google은 IaC로 시스템을 관리하고 이를 내부적으로 표준 관행으로 수립했습니다.
IaC의 이점은 다음과 같습니다.
요구사항에 따라 인프라를 정의하고 동일한 구성을 재사용하여 여러 환경을 일관되게 만들 수 있습니다.
배포 및 테스트 환경을 포함하여 클라우드 리소스의 생성 및 관리를 자동화할 수 있습니다.
인프라 변경사항을 애플리케이션 변경사항처럼 취급할 수 있습니다. 예를 들어 구성 변경사항이 검토되고 자동으로 검증되도록 할 수 있습니다. IaC를 사용하여 변경 제어 프로세스를 통해 프로덕션 환경을 관리하는 것이 좋습니다.
모든 구성 변경 기록을 유지할 수 있습니다. 변경사항을 감사하고 되돌릴 수 있습니다.
클라우드 인프라에 대한 단일 정보 소스를 확보할 수 있습니다.
Google Cloud용 IaC 도구
Google Cloud 는 많은 IaC 도구와 긴밀하게 통합되어 있습니다. 사용 사례에 따라 다음 도구 중 하나를 선택하세요.
Terraform
코드를 사용하여 Google Cloud 인프라를 구성하고 관리하려면 일반적으로 Google Cloud용 Terraform 제공업체를 사용합니다.
HashiCorp Terraform은 버전 관리, 재사용, 공유 가능한 인간이 읽을 수 있는 구성 파일로 클라우드 및 온프레미스의 리소스를 정의할 수 있게 해주는 IaC 도구입니다. 그런 다음 일관적인 워크플로를 사용하여 수명 주기 동안 모든 인프라를 프로비저닝하고 관리할 수 있습니다. 자세한 내용은 Google Cloud의 Terraform 개요를 참조하세요.
Infrastructure Manager
Terraform 구성 배포를 자동화하고 싶다면 Infrastructure Manager(Infra Manager)를 사용합니다.
Infra Manager는 Terraform을 사용하여Google Cloud 인프라 리소스의 배포 및 관리를 자동화합니다.
Infra Manager를 사용하면Google Cloud에 프로그래매틱 방식으로 배포할 수 있으므로 Google Cloud에서 Terraform과 함께 작동하도록 다른 도구 모음을 유지하는 대신 이 서비스를 사용할 수 있습니다. 자세한 내용은 Infra Manager 개요를 참조하세요.
Terraform Cloud 및 Terraform Enterprise
조직 전체에서 Terraform을 사용한 전체 변경 관리가 필요하면 Terraform Cloud 또는 Terraform Enterprise를 사용합니다.
Terraform Cloud는 안정적인 원격 환경에서 Terraform을 실행하고 상태와 보안 비밀을 안전하게 저장하는 Software as a service(SaaS) 애플리케이션입니다. 또한 Terraform Cloud는 Terraform CLI와 통합되며 GitHub, GitLab, Bitbucket과 같은 일반적인 버전 제어 시스템(VCS)에 연결됩니다. Terraform Cloud 작업공간을 VCS 저장소에 연결하면 새 커밋 및 변경사항이 Terraform 계획을 자동으로 트리거할 수 있습니다. 또한 Terraform Cloud은 기존 워크플로에 통합할 수 있는 API를 제공합니다.
Terraform Enterprise를 사용하면 Terraform Cloud의 자체 호스팅 배포를 설정할 수 있습니다. 맞춤설정 가능한 리소스 한도를 제공하며 보안 및 규정 준수 요구사항이 엄격한 조직에 적합합니다.
Hashicorp 구성 언어(HCL)를 사용하는 대신 범용 프로그래밍 언어로 인프라를 생성하려면 Terraform용 Cloud Development Kit(CDKTF)를 사용합니다.
CDKTF를 사용하면 프로그래밍 언어로 Terraform을 구성하여 Google Cloud 인프라를 정의하고 프로비저닝할 수 있으며, 테스트 및 종속 항목 관리와 같은 프로세스에 기존 도구 모음을 사용할 수 있습니다.
Pulumi
Pulumi는 프로그래밍 언어를 사용하여 인프라를 프로비저닝하는 데 사용할 수 있는 또 다른 도구입니다. Pulumi용 Google Cloud 제공업체를 사용하여 TypeScript, Python, Go, C#, Java, YAML과 같은 프로그래밍 언어를 통해 인프라 코드를 작성할 수 있습니다.
구성 컨트롤러 및 구성 커넥터
Kubernetes를 통해 Google Cloud 리소스를 관리하려면 구성 컨트롤러 및 구성 커넥터를 사용합니다.
구성 컨트롤러 및 구성 커넥터를 사용하면 Kubernetes 도구를 사용하여Google Cloud 서비스 및 리소스를 구성할 수 있습니다. 구성 동기화, Kubernetes API와 같은 GitOps 도구를 사용할 수 있으며 허용 웹훅 및 연산자와 같은 플랫폼 엔지니어링 기본 요소를 구성하고 사용할 수 있습니다.
Kubernetes를 통해 Google Cloud 리소스를 관리하는 또 다른 옵션은 Crossplane을 사용하는 것입니다.
Crossplane은 Kubernetes 클러스터를 Kubernetes 이외의 외부 리소스에 연결하고 플랫폼팀이 커스텀 Kubernetes API를 빌드하여 이러한 리소스를 사용할 수 있도록 합니다. Crossplane은 외부 리소스 상태를 감시하고 상태 적용을 제공하는 Kubernetes 컨트롤러 역할을 합니다.
Kubernetes 클러스터에 Crossplane이 설치된 상태에서 사용자는 Kubernetes와만 통신합니다. Crossplane은 Google Cloud와 같은 외부 리소스와의 통신을 관리합니다. Kubernetes 외부에서 리소스를 수정하거나 삭제하면 Crossplane은 변경사항을 되돌리거나 삭제된 리소스를 다시 만듭니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eInfrastructure as Code (IaC) allows for the management of software application infrastructure through code, enabling safer and more repeatable processes than manual methods.\u003c/p\u003e\n"],["\u003cp\u003eUsing IaC involves defining infrastructure with configuration files, allowing for versioning, reuse, and sharing, and enabling the creation of reproducible environments.\u003c/p\u003e\n"],["\u003cp\u003eIaC enables the management of infrastructure changes similarly to application code changes, allowing for review, automated validation, and historical tracking.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud integrates with numerous IaC tools, including Terraform, Infrastructure Manager, Cloud Development Kit for Terraform (CDKTF), Pulumi, and others, each catering to different use cases.\u003c/p\u003e\n"],["\u003cp\u003eTools like Config Controller, Config Connector, Crossplane, and Ansible provide options to use IaC through Kubernetes or for broader automation of IT processes.\u003c/p\u003e\n"]]],[],null,["# Infrastructure as Code on Google Cloud\n\nInfrastructure as Code (IaC) is the process of provisioning and managing software\napplication infrastructure using *code* instead of graphical user interfaces or\ncommand-line scripts.\n\nProvisioning application infrastructure typically involves setting up and\nmanaging virtual machines, database connections, storage, and other\ninfrastructure elements. Manually managing this infrastructure is time consuming\nand error prone, especially when managing applications at scale.\n\nIaC lets you define your infrastructure with configuration files, which allow\nyou to build, change, and manage your infrastructure in a safe and repeatable\nway. You can define resource configurations that you can version, reuse, and\nshare. IaC lets you specify the desired state of your infrastructure. You can\nthen deploy the same configuration multiple times to create reproducible\ndevelopment, test, and production environments.\n\nIaC allows you to treat your infrastructure provisioning and configuration in\nthe same manner as you handle application code. You can store your provisioning\nconfiguration logic in source control and you can take advantage of continuous\nintegration and continuous deployment (CI/CD) pipelines.\n\nBenefits of IaC\n---------------\n\nUsing IaC to set up and manage your application infrastructure is a best\npractice for a number of common use cases. [Google manages its\nsystems with\nIaC](https://www.usenix.org/publications/loginonline/prodspec-and-annealing-intent-based-actuation-google-production),\nand established it as a [standard\npractice](https://sre.google/workbook/configuration-design/) internally.\n\nIaC offers the following benefits:\n\n- You can define your infrastructure based on your requirements and reuse the same configuration to create multiple environments consistently.\n- You can automate the creation and management of your cloud resources, including for deployment and test environments.\n- You can treat infrastructure changes like you treat application changes. For example, you can ensure that changes to the configuration are reviewed and automatically validated. Managing production environments through change-controlled processes using IaC is a best practice.\n- You can keep a history of all configuration changes. Changes can be audited and reverted.\n- You can have a single source of truth for your cloud infrastructure.\n\nIaC tools for Google Cloud\n--------------------------\n\nGoogle Cloud is tightly integrated with many IaC tools. Choose one of the\nfollowing tools depending on your use case:\n\n- **Terraform**\n\n In general, to configure and manage Google Cloud infrastructure using\n code, use the Terraform provider for Google Cloud.\n\n HashiCorp Terraform is an IaC tool that lets you define\n resources in cloud and on-premises in human-readable configuration files\n that you can version, reuse, and share. You can then use a consistent\n workflow to provision and manage all of your infrastructure throughout its\n lifecycle. For more information, see\n [Overview of Terraform on Google Cloud](/docs/terraform/terraform-overview).\n- **Infrastructure Manager**\n\n If you're looking to automate the deployment of your Terraform\n configuration, use Infrastructure Manager (Infra Manager).\n\n Infra Manager automates the deployment and management of\n Google Cloud infrastructure resources using Terraform.\n Infra Manager lets you deploy programmatically to\n Google Cloud, allowing you to use this service rather than maintaining\n a different toolchain to work with Terraform on Google Cloud. For more\n information, see [Infra Manager\n overview](/infrastructure-manager/docs/overview).\n- **Terraform Cloud and Terraform Enterprise**\n\n If you require full change management with Terraform across your\n organization, use Terraform Cloud or Terraform Enterprise.\n\n Terraform Cloud is a software as a service (SaaS) application that runs Terraform in a stable,\n remote environment and securely stores state and secrets. Terraform Cloud\n also integrates with the Terraform CLI and connects to common version\n control systems (VCS) like GitHub, GitLab, and Bitbucket. When you connect a\n Terraform Cloud workspace to a VCS repository, new commits and changes can\n automatically trigger Terraform plans. Terraform Cloud also offers an API,\n allowing you to integrate it into existing workflows.\n\n Terraform Enterprise lets you set up a self-hosted distribution of Terraform\n Cloud. It offers customizable resource limits and is ideal for organizations\n with strict security and compliance requirements.\n\n For more information, see the [Terraform Editions page in the Hashicorp\n documentation](https://developer.hashicorp.com/terraform/intro/terraform-editions).\n- **Cloud Development Kit for Terraform**\n\n If you want to generate infrastructure with a general-purpose programming\n language instead of using Hashicorp Configuration Language (HCL), use Cloud\n Development Kit for Terraform (CDKTF).\n\n [CDKTF](https://developer.hashicorp.com/terraform/cdktf)\n lets you configure Terraform using a programming language to define and\n provision Google Cloud infrastructure and lets you use your existing\n toolchain for processes like testing and dependency management.\n- **Pulumi**\n\n [Pulumi](https://www.pulumi.com/docs/clouds/gcp/)\n is another tool you can use to provision infrastructure using programming\n languages. You can use Google Cloud provider for Pulumi to author\n infrastructure code using programming languages such as TypeScript, Python,\n Go, C#, Java or YAML.\n- **Config Controller and Config Connector**\n\n To manage Google Cloud resources through Kubernetes, use\n Config Controller and Config Connector.\n\n Config Controller and Config Connector let you configure\n Google Cloud services and resources using Kubernetes tooling. You can\n use GitOps tools like\n [Config Sync](/anthos-config-management/docs/config-sync-overview), and\n Kubernetes APIs, and you can configure and use platform-engineering\n primitives such as admission webhooks and operators.\n\n For more information see the\n [Config Controller overview](/anthos-config-management/docs/concepts/config-controller-overview)\n and [Config Connector overview](/config-connector/docs/overview).\n- **Crossplane**\n\n Another option to manage Google Cloud resources through Kubernetes is\n by using Crossplane.\n\n Crossplane connects your Kubernetes cluster to external, non-Kubernetes\n resources, and allows platform teams to build custom Kubernetes APIs to\n consume those resources. Crossplane acts as a\n [Kubernetes controller](https://kubernetes.io/docs/concepts/architecture/controller/)\n to watch the state of the external resources and provide state enforcement.\n With Crossplane installed in a Kubernetes cluster, users only communicate\n with Kubernetes. Crossplane manages the communication to external resources\n like Google Cloud. If something modifies or deletes a resource outside\n of Kubernetes, Crossplane reverses the change or recreates the deleted\n resource.\n\n For more information, see the\n [Crossplane documentation](https://docs.crossplane.io/v1.18/).\n- **Ansible**\n\n If you want to automate provisioning, configuration management, application\n deployment, orchestration, and other IT processes, use Ansible. For more\n information, see [Ansible for\n Google Cloud](https://docs.ansible.com/ansible/latest/collections/google/cloud/).\n\nWhat's next\n-----------\n\n- Learn more about [Terraform](/docs/terraform/terraform-overview)\n- Learn how to [create a basic web server on Compute Engine using Terraform](/docs/terraform/get-started-with-terraform)\n- Learn how to [store Terraform state in a Cloud Storage bucket](/docs/terraform/resource-management/store-state)"]]