Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::CodeCommit::Repository

The AWS::CodeCommit::Repository resource creates an AWS CodeCommit repository that is hosted by Amazon Web Services. For more information, see Create an AWS CodeCommit Repository in the AWS CodeCommit User Guide.

Syntax

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

JSON

Copy
{ "Type" : "AWS::CodeCommit::Repository", "Properties" : { "RepositoryDescription" : String, required, "RepositoryName" : String, "Triggers" : [ Trigger ] } }

YAML

Copy
Type: "AWS::CodeCommit::Repository" Properties: RepositoryDescription: String RepositoryName: String Triggers: - Trigger

Properties

RepositoryDescription

A description about the AWS CodeCommit repository. For constraints, see the CreateRepository action in the AWS CodeCommit API Reference.

Required: No

Type: String

Update requires: No interruption

RepositoryName

A name for the AWS CodeCommit repository.

Required: Yes

Type: String

Update requires: No interruption

Triggers

Defines the actions to take in response to events that occur in the repository. For example, you can send email notifications when someone pushes to the repository.

Required: No

Type: List of AWS CodeCommit Repository Trigger

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, such as 12a345b6-bbb7-4bb6-90b0-8c9577a2d2b9.

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

Fn::GetAtt

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

Arn

The Amazon Resource Name (ARN) of the repository, such as arn:aws:codecommit:us-east-1:123456789012:MyDemoRepo.

CloneUrlHttp

The URL to use for cloning the repository over HTTPS, such as https://codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo.

CloneUrlSsh

The URL to use for cloning the repository over SSH, such as ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos//v1/repos/MyDemoRepo.

Name

The name of the repository, such MyDemoRepo.

For more information about using Fn::GetAtt, see Fn::GetAtt.

Example

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

JSON

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

YAML

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