Skip to main content

branches

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

Overview

Namebranches
TypeResource
Idaws.amplify.branches

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
active_job_idstringThe ID of the active job for a branch of an Amplify app.
associated_resourcesarrayA list of custom resources that are linked to this branch.
backendobjectDescribes the backend associated with an Amplify Branch. This property is available to Amplify Gen 2 apps only. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.
backend_environment_arnstringThe Amazon Resource Name (ARN) for a backend environment that is part of an Amplify app. This property is available to Amplify Gen 1 apps only. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code. (pattern: <code>(?s).*</code>)
basic_auth_credentialsstringThe basic authorization credentials for a branch of an Amplify app. You must base64-encode the authorization credentials and provide them in the format user:password. (pattern: <code>(?s).*</code>)
branch_arnstringThe Amazon Resource Name (ARN) for a branch that is part of an Amplify app. (pattern: <code>(?s).*</code>)
branch_namestringThe name for the branch that is part of an Amplify app. (pattern: <code>(?s).+</code>)
build_specstringThe build specification (build spec) file for an Amplify app build. (pattern: <code>(?s).+</code>)
compute_role_arnstringThe Amazon Resource Name (ARN) of the IAM role for a branch of an SSR app. The Compute role allows the Amplify Hosting compute service to securely access specific Amazon Web Services resources based on the role's permissions. For more information about the SSR Compute role, see Adding an SSR Compute role in the Amplify User Guide. (pattern: <code>(?s).*</code>)
create_timestring (date-time)A timestamp of when Amplify created the branch.
custom_domainsarrayThe custom domains for a branch of an Amplify app.
descriptionstringThe description for the branch that is part of an Amplify app. (pattern: <code>(?s).*</code>)
destination_branchstringThe destination branch if the branch is a pull request branch. (pattern: <code>(?s).+</code>)
display_namestringThe display name for the branch. This is used as the default domain prefix. (pattern: <code>(?s).*</code>)
enable_auto_buildbooleanEnables auto-building on push for a branch of an Amplify app.
enable_basic_authbooleanEnables basic authorization for a branch of an Amplify app.
enable_notificationbooleanEnables notifications for a branch that is part of an Amplify app.
enable_performance_modebooleanEnables performance mode for the branch. Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out.
enable_pull_request_previewbooleanEnables pull request previews for the branch.
enable_skew_protectionbooleanSpecifies whether the skew protection feature is enabled for the branch. Deployment skew protection is available to Amplify applications to eliminate version skew issues between client and servers in web applications. When you apply skew protection to a branch, you can ensure that your clients always interact with the correct version of server-side assets, regardless of when a deployment occurs. For more information about skew protection, see Skew protection for Amplify deployments in the Amplify User Guide.
environment_variablesobjectThe environment variables specific to a branch of an Amplify app.
frameworkstringThe framework for a branch of an Amplify app. (pattern: <code>(?s).*</code>)
pull_request_environment_namestringThe Amplify environment name for the pull request. (pattern: <code>(?s).*</code>)
source_branchstringThe source branch if the branch is a pull request branch. (pattern: <code>(?s).+</code>)
stagestringThe current stage for the branch that is part of an Amplify app. (PRODUCTION, BETA, DEVELOPMENT, EXPERIMENTAL, PULL_REQUEST)
tagsobjectThe tag for the branch of an Amplify app.
thumbnail_urlstringThe thumbnail URL for the branch of an Amplify app.
total_number_of_jobsstringThe total number of jobs that are part of an Amplify app.
ttlstringThe content Time to Live (TTL) for the website in seconds. (pattern: <code>\d*</code>)
update_timestring (date-time)A timestamp for the last updated time for a branch.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_branchselectapp_id, branch_name, regionReturns a branch for an Amplify app.
list_branchesselectapp_id, regionnextToken, maxResultsLists the branches of an Amplify app.
create_branchinsertapp_id, region, branchNameCreates a new branch for an Amplify app.
create_deploymentinsertapp_id, branch_name, regionCreates a deployment for a manually deployed Amplify app. Manually deployed apps are not connected to a Git repository. The maximum duration between the CreateDeployment call and the StartDeployment call cannot exceed 8 hours. If the duration exceeds 8 hours, the StartDeployment call and the associated Job will fail.
update_branchupdateapp_id, branch_name, regionUpdates a branch for an Amplify app.
delete_branchdeleteapp_id, branch_name, regionDeletes a branch for an Amplify app.
start_jobexecapp_id, branch_name, region, jobTypeStarts a new job for a branch of an Amplify app.
start_deploymentexecapp_id, branch_name, regionStarts a deployment for a manually deployed app. Manually deployed apps are not connected to a Git repository. The maximum duration between the CreateDeployment call and the StartDeployment call cannot exceed 8 hours. If the duration exceeds 8 hours, the StartDeployment call and the associated Job will fail.
stop_jobexecapp_id, branch_name, job_id, regionStops a job that is in progress for a branch of an Amplify app.

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
app_idstringThe unique ID for an Amplify app.
branch_namestringThe name of the branch to use for the stop job request.
job_idstringThe unique id for the job.
regionstringAWS region (default: us-east-1)
maxResultsintegerThe maximum number of records to list in a single response.
nextTokenstringA pagination token. Set to null to start listing branches from the start. If a non-null pagination token is returned in a result, pass its value in here to list more branches.

SELECT examples

Returns a branch for an Amplify app.

SELECT
active_job_id,
associated_resources,
backend,
backend_environment_arn,
basic_auth_credentials,
branch_arn,
branch_name,
build_spec,
compute_role_arn,
create_time,
custom_domains,
description,
destination_branch,
display_name,
enable_auto_build,
enable_basic_auth,
enable_notification,
enable_performance_mode,
enable_pull_request_preview,
enable_skew_protection,
environment_variables,
framework,
pull_request_environment_name,
source_branch,
stage,
tags,
thumbnail_url,
total_number_of_jobs,
ttl,
update_time
FROM aws.amplify.branches
WHERE app_id = '{{ app_id }}' -- required
AND branch_name = '{{ branch_name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a new branch for an Amplify app.

INSERT INTO aws.amplify.branches (
branchName,
description,
stage,
framework,
enableNotification,
enableAutoBuild,
enableSkewProtection,
environmentVariables,
basicAuthCredentials,
enableBasicAuth,
enablePerformanceMode,
tags,
buildSpec,
ttl,
displayName,
enablePullRequestPreview,
pullRequestEnvironmentName,
backendEnvironmentArn,
backend,
computeRoleArn,
app_id,
region
)
SELECT
'{{ branchName }}' /* required */,
'{{ description }}',
'{{ stage }}',
'{{ framework }}',
{{ enableNotification }},
{{ enableAutoBuild }},
{{ enableSkewProtection }},
'{{ environmentVariables }}',
'{{ basicAuthCredentials }}',
{{ enableBasicAuth }},
{{ enablePerformanceMode }},
'{{ tags }}',
'{{ buildSpec }}',
'{{ ttl }}',
'{{ displayName }}',
{{ enablePullRequestPreview }},
'{{ pullRequestEnvironmentName }}',
'{{ backendEnvironmentArn }}',
'{{ backend }}',
'{{ computeRoleArn }}',
'{{ app_id }}',
'{{ region }}'
RETURNING
branch
;

UPDATE examples

Updates a branch for an Amplify app.

UPDATE aws.amplify.branches
SET
description = '{{ description }}',
framework = '{{ framework }}',
stage = '{{ stage }}',
enableNotification = {{ enableNotification }},
enableAutoBuild = {{ enableAutoBuild }},
enableSkewProtection = {{ enableSkewProtection }},
environmentVariables = '{{ environmentVariables }}',
basicAuthCredentials = '{{ basicAuthCredentials }}',
enableBasicAuth = {{ enableBasicAuth }},
enablePerformanceMode = {{ enablePerformanceMode }},
buildSpec = '{{ buildSpec }}',
ttl = '{{ ttl }}',
displayName = '{{ displayName }}',
enablePullRequestPreview = {{ enablePullRequestPreview }},
pullRequestEnvironmentName = '{{ pullRequestEnvironmentName }}',
backendEnvironmentArn = '{{ backendEnvironmentArn }}',
backend = '{{ backend }}',
computeRoleArn = '{{ computeRoleArn }}'
WHERE
app_id = '{{ app_id }}' --required
AND branch_name = '{{ branch_name }}' --required
AND region = '{{ region }}' --required
RETURNING
branch;

DELETE examples

Deletes a branch for an Amplify app.

DELETE FROM aws.amplify.branches
WHERE app_id = '{{ app_id }}' --required
AND branch_name = '{{ branch_name }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Starts a new job for a branch of an Amplify app.

EXEC aws.amplify.branches.start_job
@app_id='{{ app_id }}' --required,
@branch_name='{{ branch_name }}' --required,
@region='{{ region }}' --required
@@json=
'{
"jobId": "{{ jobId }}",
"jobType": "{{ jobType }}",
"jobReason": "{{ jobReason }}",
"commitId": "{{ commitId }}",
"commitMessage": "{{ commitMessage }}",
"commitTime": "{{ commitTime }}"
}'
;