AWS::CodeCommit::Repository - AWS CloudFormation

AWS::CodeCommit::Repository

Creates a new, empty repository.

Important

AWS CodeCommit is no longer available to new customers. Existing customers of AWS CodeCommit can continue to use the service as normal. Learn more"

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::CodeCommit::Repository", "Properties" : { "Code" : Code, "KmsKeyId" : String, "RepositoryDescription" : String, "RepositoryName" : String, "Tags" : [ Tag, ... ], "Triggers" : [ RepositoryTrigger, ... ] } }

YAML

Type: AWS::CodeCommit::Repository Properties: Code: Code KmsKeyId: String RepositoryDescription: String RepositoryName: String Tags: - Tag Triggers: - RepositoryTrigger

Properties

Code

Information about code to be committed to a repository after it is created in an AWS CloudFormation stack. Information about code is only used in resource creation. Updates to a stack will not reflect changes made to code properties after initial resource creation.

Note

You can only use this property to add code when creating a repository with a AWS CloudFormation template at creation time. This property cannot be used for updating code to an existing repository.

Required: No

Type: Code

Update requires: No interruption

KmsKeyId

The ID of the AWS Key Management Service encryption key used to encrypt and decrypt the repository.

Note

The input can be the full ARN, the key ID, or the key alias. For more information, see Finding the key ID and key ARN.

Required: No

Type: String

Pattern: ^[a-zA-Z0-9:/_-]+$

Update requires: No interruption

RepositoryDescription

A comment or description about the new repository.

Note

The description field for a repository accepts all HTML characters and all valid Unicode characters. Applications that do not HTML-encode the description and display it in a webpage can expose users to potentially malicious code. Make sure that you HTML-encode the description field in any application that uses this API to display the repository description on a webpage.

Required: No

Type: String

Maximum: 1000

Update requires: No interruption

RepositoryName

The name of the new repository to be created.

Note

The repository name must be unique across the calling AWS account. Repository names are limited to 100 alphanumeric, dash, and underscore characters, and cannot include certain characters. For more information about the limits on repository names, see Quotas in the AWS CodeCommit User Guide. The suffix .git is prohibited.

Required: Yes

Type: String

Pattern: [\w\.-]+

Minimum: 1

Maximum: 100

Update requires: No interruption

Tags

One or more tag key-value pairs to use when tagging this repository.

Required: No

Type: Array of Tag

Update requires: No interruption

Triggers

The JSON block of configuration information for each trigger.

Required: No

Type: Array of RepositoryTrigger

Update requires: No interruption

Return values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the repository ID.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

Arn

When you pass the logical ID of this resource, the function returns the Amazon Resource Name (ARN) of the repository.

CloneUrlHttp

When you pass the logical ID of this resource, the function returns the URL to use for cloning the repository over HTTPS.

CloneUrlSsh

When you pass the logical ID of this resource, the function returns the URL to use for cloning the repository over SSH.

Name

When you pass the logical ID of this resource, the function returns the repository's name.

Examples

The following examples can help you create CodeCommit repositories using AWS CloudFormation.

Example

The following example creates a CodeCommit repository named MyDemoRepo. The newly created repository is populated with code stored in an Amazon S3 bucket named MySourceCodeBucket and placed in a branch named development, which is the default branch for the repository.

JSON

{ "MyRepo": { "Type": "AWS::CodeCommit::Repository", "Properties": { "RepositoryName": "MyDemoRepo", "RepositoryDescription": "This is a repository for my project with code from MySourceCodeBucket.", "Code": { "BranchName": "development", "S3": { "Bucket": "MySourceCodeBucket", "Key": "MyKey", "ObjectVersion": "1" } } } } }

YAML

MyRepo: Type: AWS::CodeCommit::Repository Properties: RepositoryName: MyDemoRepo RepositoryDescription: This is a repository for my project with code from MySourceCodeBucket. Code: BranchName: development S3: Bucket: MySourceCodeBucket Key: MyKey ObjectVersion: 1

Example

The following example creates a CodeCommit repository with a trigger for all events in the development branch.

JSON

{ "MyRepo": { "Type": "AWS: : CodeCommit: : Repository", "Properties": { "RepositoryName": "MyRepoName", "RepositoryDescription": "a description", "Triggers": [ { "Name": "MyTrigger", "CustomData": "Project ID 12345", "DestinationArn": { "Ref": "SNSarn" }, "Branches": [ "development" ], "Events": [ "all" ] } ] } } }

YAML

MyRepo: Type: AWS::CodeCommit::Repository Properties: RepositoryName: MyRepoName RepositoryDescription: a description Triggers: - Name: MyTrigger CustomData: Project ID 12345 DestinationArn: Ref: SNSarn Branches: - development Events: - all