쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

AWS SDK 또는 CLI와 함께 CreateProject 사용

포커스 모드
AWS SDK 또는 CLI와 함께 CreateProject 사용 - AWS CodeBuild

다음 코드 예제는 CreateProject의 사용 방법을 보여 줍니다.

CLI
AWS CLI

예 1: AWS CodeBuild 빌드 프로젝트를 생성하는 방법

다음 create-project 예시에서는 S3 버킷의 소스 파일을 사용하여 CodeBuild 빌드 프로젝트를 생성합니다.

aws codebuild create-project \ --name "my-demo-project" \ --source "{\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-input-bucket/my-source.zip\"}" \ --artifacts {"\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-output-bucket\""} \ --environment "{\"type\": \"LINUX_CONTAINER\",\"image\": \"aws/codebuild/standard:1.0\",\"computeType\": \"BUILD_GENERAL1_SMALL\"}" \ --service-role "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role"

출력:

{ "project": { "arn": "arn:aws:codebuild:us-west-2:123456789012:project/my-demo-project", "name": "my-cli-demo-project", "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", "lastModified": 1556839783.274, "badge": { "badgeEnabled": false }, "queuedTimeoutInMinutes": 480, "environment": { "image": "aws/codebuild/standard:1.0", "computeType": "BUILD_GENERAL1_SMALL", "type": "LINUX_CONTAINER", "imagePullCredentialsType": "CODEBUILD", "privilegedMode": false, "environmentVariables": [] }, "artifacts": { "location": "codebuild-us-west-2-123456789012-output-bucket", "name": "my-cli-demo-project", "namespaceType": "NONE", "type": "S3", "packaging": "NONE", "encryptionDisabled": false }, "source": { "type": "S3", "location": "codebuild-us-west-2-123456789012-input-bucket/my-source.zip", "insecureSsl": false }, "timeoutInMinutes": 60, "cache": { "type": "NO_CACHE" }, "created": 1556839783.274 } }

예 2: 파라미터에 대한 JSON 입력 파일을 사용하여 AWS CodeBuild 빌드 프로젝트를 생성하는 방법

다음 create-project 예시에서는 필요한 파라미터를 모두 JSON 입력 파일에 전달하여 CodeBuild 빌드 프로젝트를 생성합니다. --generate-cli-skeleton parameter만 포함하여 명령을 실행하여 입력 파일 템플릿을 생성합니다.

aws codebuild create-project --cli-input-json file://create-project.json

입력 JSON 파일 create-project.json에는 다음 콘텐츠가 포함되어 있습니다.

{ "name": "codebuild-demo-project", "source": { "type": "S3", "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" }, "artifacts": { "type": "S3", "location": "codebuild-region-ID-account-ID-output-bucket" }, "environment": { "type": "LINUX_CONTAINER", "image": "aws/codebuild/standard:1.0", "computeType": "BUILD_GENERAL1_SMALL" }, "serviceRole": "serviceIAMRole" }

출력:

{ "project": { "name": "codebuild-demo-project", "serviceRole": "serviceIAMRole", "tags": [], "artifacts": { "packaging": "NONE", "type": "S3", "location": "codebuild-region-ID-account-ID-output-bucket", "name": "message-util.zip" }, "lastModified": 1472661575.244, "timeoutInMinutes": 60, "created": 1472661575.244, "environment": { "computeType": "BUILD_GENERAL1_SMALL", "image": "aws/codebuild/standard:1.0", "type": "LINUX_CONTAINER", "environmentVariables": [] }, "source": { "type": "S3", "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" }, "encryptionKey": "arn:aws:kms:region-ID:account-ID:alias/aws/s3", "arn": "arn:aws:codebuild:region-ID:account-ID:project/codebuild-demo-project" } }

자세한 내용은 AWS CodeBuild 사용 설명서의 빌드 프로젝트 생성(AWS CLI)을 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조의 CreateProject를 참조하세요.

JavaScript
SDK for JavaScript (v3)
참고

GitHub에 더 많은 내용이 있습니다. AWS 코드 예제 리포지토리에서 전체 예제를 찾고 설정 및 실행하는 방법을 배워보세요.

프로젝트 생성

import { ArtifactsType, CodeBuildClient, ComputeType, CreateProjectCommand, EnvironmentType, SourceType, } from "@aws-sdk/client-codebuild"; // Create the AWS CodeBuild project. export const createProject = async ( projectName = "MyCodeBuilder", roleArn = "arn:aws:iam::xxxxxxxxxxxx:role/CodeBuildAdmin", buildOutputBucket = "xxxx", githubUrl = "https://...", ) => { const codeBuildClient = new CodeBuildClient({}); const response = await codeBuildClient.send( new CreateProjectCommand({ artifacts: { // The destination of the build artifacts. type: ArtifactsType.S3, location: buildOutputBucket, }, // Information about the build environment. The combination of "computeType" and "type" determines the // requirements for the environment such as CPU, memory, and disk space. environment: { // Build environment compute types. // https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html computeType: ComputeType.BUILD_GENERAL1_SMALL, // Docker image identifier. // See https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html image: "aws/codebuild/standard:7.0", // Build environment type. type: EnvironmentType.LINUX_CONTAINER, }, name: projectName, // A role ARN with permission to create a CodeBuild project, write to the artifact location, and write CloudWatch logs. serviceRole: roleArn, source: { // The type of repository that contains the source code to be built. type: SourceType.GITHUB, // The location of the repository that contains the source code to be built. location: githubUrl, }, }), ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'b428b244-777b-49a6-a48d-5dffedced8e7', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // project: { // arn: 'arn:aws:codebuild:us-east-1:xxxxxxxxxxxx:project/MyCodeBuilder', // artifacts: { // encryptionDisabled: false, // location: 'xxxxxx-xxxxxxx-xxxxxx', // name: 'MyCodeBuilder', // namespaceType: 'NONE', // packaging: 'NONE', // type: 'S3' // }, // badge: { badgeEnabled: false }, // cache: { type: 'NO_CACHE' }, // created: 2023-08-18T14:46:48.979Z, // encryptionKey: 'arn:aws:kms:us-east-1:xxxxxxxxxxxx:alias/aws/s3', // environment: { // computeType: 'BUILD_GENERAL1_SMALL', // environmentVariables: [], // image: 'aws/codebuild/standard:7.0', // imagePullCredentialsType: 'CODEBUILD', // privilegedMode: false, // type: 'LINUX_CONTAINER' // }, // lastModified: 2023-08-18T14:46:48.979Z, // name: 'MyCodeBuilder', // projectVisibility: 'PRIVATE', // queuedTimeoutInMinutes: 480, // serviceRole: 'arn:aws:iam::xxxxxxxxxxxx:role/CodeBuildAdmin', // source: { // insecureSsl: false, // location: 'https://...', // reportBuildStatus: false, // type: 'GITHUB' // }, // timeoutInMinutes: 60 // } // } return response; };
AWS CLI

예 1: AWS CodeBuild 빌드 프로젝트를 생성하는 방법

다음 create-project 예시에서는 S3 버킷의 소스 파일을 사용하여 CodeBuild 빌드 프로젝트를 생성합니다.

aws codebuild create-project \ --name "my-demo-project" \ --source "{\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-input-bucket/my-source.zip\"}" \ --artifacts {"\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-output-bucket\""} \ --environment "{\"type\": \"LINUX_CONTAINER\",\"image\": \"aws/codebuild/standard:1.0\",\"computeType\": \"BUILD_GENERAL1_SMALL\"}" \ --service-role "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role"

출력:

{ "project": { "arn": "arn:aws:codebuild:us-west-2:123456789012:project/my-demo-project", "name": "my-cli-demo-project", "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", "lastModified": 1556839783.274, "badge": { "badgeEnabled": false }, "queuedTimeoutInMinutes": 480, "environment": { "image": "aws/codebuild/standard:1.0", "computeType": "BUILD_GENERAL1_SMALL", "type": "LINUX_CONTAINER", "imagePullCredentialsType": "CODEBUILD", "privilegedMode": false, "environmentVariables": [] }, "artifacts": { "location": "codebuild-us-west-2-123456789012-output-bucket", "name": "my-cli-demo-project", "namespaceType": "NONE", "type": "S3", "packaging": "NONE", "encryptionDisabled": false }, "source": { "type": "S3", "location": "codebuild-us-west-2-123456789012-input-bucket/my-source.zip", "insecureSsl": false }, "timeoutInMinutes": 60, "cache": { "type": "NO_CACHE" }, "created": 1556839783.274 } }

예 2: 파라미터에 대한 JSON 입력 파일을 사용하여 AWS CodeBuild 빌드 프로젝트를 생성하는 방법

다음 create-project 예시에서는 필요한 파라미터를 모두 JSON 입력 파일에 전달하여 CodeBuild 빌드 프로젝트를 생성합니다. --generate-cli-skeleton parameter만 포함하여 명령을 실행하여 입력 파일 템플릿을 생성합니다.

aws codebuild create-project --cli-input-json file://create-project.json

입력 JSON 파일 create-project.json에는 다음 콘텐츠가 포함되어 있습니다.

{ "name": "codebuild-demo-project", "source": { "type": "S3", "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" }, "artifacts": { "type": "S3", "location": "codebuild-region-ID-account-ID-output-bucket" }, "environment": { "type": "LINUX_CONTAINER", "image": "aws/codebuild/standard:1.0", "computeType": "BUILD_GENERAL1_SMALL" }, "serviceRole": "serviceIAMRole" }

출력:

{ "project": { "name": "codebuild-demo-project", "serviceRole": "serviceIAMRole", "tags": [], "artifacts": { "packaging": "NONE", "type": "S3", "location": "codebuild-region-ID-account-ID-output-bucket", "name": "message-util.zip" }, "lastModified": 1472661575.244, "timeoutInMinutes": 60, "created": 1472661575.244, "environment": { "computeType": "BUILD_GENERAL1_SMALL", "image": "aws/codebuild/standard:1.0", "type": "LINUX_CONTAINER", "environmentVariables": [] }, "source": { "type": "S3", "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" }, "encryptionKey": "arn:aws:kms:region-ID:account-ID:alias/aws/s3", "arn": "arn:aws:codebuild:region-ID:account-ID:project/codebuild-demo-project" } }

자세한 내용은 AWS CodeBuild 사용 설명서의 빌드 프로젝트 생성(AWS CLI)을 참조하세요.

  • API 세부 정보는 AWS CLI 명령 참조의 CreateProject를 참조하세요.

AWS SDK 개발자 가이드 및 코드 예시의 전체 목록은 AWS SDK와 함께 이 서비스 사용 단원을 참조하세요. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.