다음 코드 예제는 CreateProject
의 사용 방법을 보여 줍니다.
- 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 버전에 대한 세부 정보도 포함되어 있습니다.