Skip to main content

projects

Creates, updates, deletes, gets or lists a projects resource.

Overview

Nameprojects
TypeResource
Idaws.codebuild.projects

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
projectsarrayInformation about the requested build projects.
projects_not_foundarrayThe names of build projects for which information could not be found.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
batch_get_projectsselectregionGets information about one or more build projects.
list_projectsselectregionGets a list of build project names, with each build project name representing a single build project.
create_projectinsertregion, name, source, artifacts, environment, serviceRoleCreates a build project.
create_webhookinsertregion, projectNameFor an existing CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, enables CodeBuild to start rebuilding the source code every time a code change is pushed to the repository. If you enable webhooks for an CodeBuild project, and the project is used as a build step in CodePipeline, then two identical builds are created for each commit. One build is triggered through webhooks, and one through CodePipeline. Because billing is on a per-build basis, you are billed for both builds. Therefore, if you are using CodePipeline, we recommend that you disable webhooks in CodeBuild. In the CodeBuild console, clear the Webhook box. For more information, see step 5 in Change a Build Project's Settings.
update_project_visibilityupdateregion, projectArn, projectVisibilityChanges the public visibility for a project. The project's build results, logs, and artifacts are available to the general public. For more information, see Public build projects in the CodeBuild User Guide. The following should be kept in mind when making your projects public: All of a project's build results, logs, and artifacts, including builds that were run when the project was private, are available to the general public. All build logs and artifacts are available to the public. Environment variables, source code, and other sensitive information may have been output to the build logs and artifacts. You must be careful about what information is output to the build logs. Some best practice are: Do not store sensitive values in environment variables. We recommend that you use an Amazon EC2 Systems Manager Parameter Store or Secrets Manager to store sensitive values. Follow Best practices for using webhooks in the CodeBuild User Guide to limit which entities can trigger a build, and do not store the buildspec in the project itself, to ensure that your webhooks are as secure as possible. A malicious user can use public builds to distribute malicious artifacts. We recommend that you review all pull requests to verify that the pull request is a legitimate change. We also recommend that you validate any artifacts with their checksums to make sure that the correct artifacts are being downloaded.
update_projectupdateregion, nameChanges the settings of a build project.
update_webhookupdateregion, projectNameUpdates the webhook associated with an CodeBuild build project. If you use Bitbucket for your repository, rotateSecret is ignored.
delete_projectdeleteregionDeletes a build project. When you delete a project, its builds are not deleted.
delete_webhookdeleteregionFor an existing CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, stops CodeBuild from rebuilding the source code every time a code change is pushed to the repository.
invalidate_project_cacheexecregion, projectNameResets the cache for a project.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Gets information about one or more build projects.

SELECT
projects,
projects_not_found
FROM aws.codebuild.projects
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a build project.

INSERT INTO aws.codebuild.projects (
name,
description,
source,
secondarySources,
sourceVersion,
secondarySourceVersions,
artifacts,
secondaryArtifacts,
cache,
environment,
serviceRole,
timeoutInMinutes,
queuedTimeoutInMinutes,
encryptionKey,
tags,
vpcConfig,
badgeEnabled,
logsConfig,
fileSystemLocations,
buildBatchConfig,
concurrentBuildLimit,
autoRetryLimit,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ source }}' /* required */,
'{{ secondarySources }}',
'{{ sourceVersion }}',
'{{ secondarySourceVersions }}',
'{{ artifacts }}' /* required */,
'{{ secondaryArtifacts }}',
'{{ cache }}',
'{{ environment }}' /* required */,
'{{ serviceRole }}' /* required */,
{{ timeoutInMinutes }},
{{ queuedTimeoutInMinutes }},
'{{ encryptionKey }}',
'{{ tags }}',
'{{ vpcConfig }}',
{{ badgeEnabled }},
'{{ logsConfig }}',
'{{ fileSystemLocations }}',
'{{ buildBatchConfig }}',
{{ concurrentBuildLimit }},
{{ autoRetryLimit }},
'{{ region }}'
RETURNING
project
;

UPDATE examples

Changes the public visibility for a project. The project's build results, logs, and artifacts are available to the general public. For more information, see Public build projects in the CodeBuild User Guide. The following should be kept in mind when making your projects public: All of a project's build results, logs, and artifacts, including builds that were run when the project was private, are available to the general public. All build logs and artifacts are available to the public. Environment variables, source code, and other sensitive information may have been output to the build logs and artifacts. You must be careful about what information is output to the build logs. Some best practice are: Do not store sensitive values in environment variables. We recommend that you use an Amazon EC2 Systems Manager Parameter Store or Secrets Manager to store sensitive values. Follow Best practices for using webhooks in the CodeBuild User Guide to limit which entities can trigger a build, and do not store the buildspec in the project itself, to ensure that your webhooks are as secure as possible. A malicious user can use public builds to distribute malicious artifacts. We recommend that you review all pull requests to verify that the pull request is a legitimate change. We also recommend that you validate any artifacts with their checksums to make sure that the correct artifacts are being downloaded.

UPDATE aws.codebuild.projects
SET
projectArn = '{{ projectArn }}',
projectVisibility = '{{ projectVisibility }}',
resourceAccessRole = '{{ resourceAccessRole }}'
WHERE
region = '{{ region }}' --required
AND projectArn = '{{ projectArn }}' --required
AND projectVisibility = '{{ projectVisibility }}' --required
RETURNING
project_arn,
project_visibility,
public_project_alias;

DELETE examples

Deletes a build project. When you delete a project, its builds are not deleted.

DELETE FROM aws.codebuild.projects
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Resets the cache for a project.

EXEC aws.codebuild.projects.invalidate_project_cache
@region='{{ region }}' --required
@@json=
'{
"projectName": "{{ projectName }}"
}'
;