Skip to content

CodeConnections

CodeConnections is a service provided by Amazon Web Services (AWS) that enables you to connect your code repositories to your AWS resources. It allows you to create connections to your code repositories and integrate them with supported AWS services.

LocalStack provides a mock implementation of the CodeConnections API that allows you to create and manage connections to your code repositories. The supported APIs are available on our API Coverage section, which provides information on the extent of CodeConnections’s integration with LocalStack.

This guide is designed for users new to CodeConnections and assumes basic knowledge of the AWS CLI and our awslocal wrapper script.

Start your LocalStack container using your preferred method. We will demonstrate how to create a connection to a code repository using the CodeConnections API.

You can create a connection to a code repository using the CreateConnection API.

Terminal window
awslocal codeconnections create-connection \
--connection-name my-connection

You should see the connection in the output.

Output
{
"ConnectionArn": "arn:aws:codeconnections:eu-central-1:000000000000:connection/7c9f0d0b"
}
### List connections
You can list connections using the [`ListConnections`](https://docs.aws.amazon.com/codeconnections/latest/APIReference/API_ListConnections.html) API.
```bash
awslocal codeconnections list-connections
Output
{
"Connections": [
{
"ConnectionName": "my-connection",
"ConnectionArn": "arn:aws:codeconnections:us-east-1:000000000000:connection/023ff7e3",
"ProviderType": "GitHub",
"OwnerAccountId": "000000000000",
"ConnectionStatus": "AVAILABLE"
}
]
}

You can get a connection using the GetConnection API.

Terminal window
awslocal codeconnections get-connection --connection-arn arn:aws:codeconnections:us-east-1:000000000000:connection/023ff7e3

Replace the connection-arn with the ARN of the connection you want to get.

Output
{
"Connection": {
"ConnectionName": "my-connection",
"ConnectionArn": "arn:aws:codeconnections:us-east-1:000000000000:connection/023ff7e3",
"ProviderType": "GitHub",
"OwnerAccountId": "000000000000",
"ConnectionStatus": "AVAILABLE"
}
}

You can delete a connection using the DeleteConnection API.

Terminal window
awslocal codeconnections delete-connection --connection-arn arn:aws:codeconnections:us-east-1:000000000000:connection/023ff7e3

Replace the connection-arn with the ARN of the connection you want to delete.

OperationImplementedImage
Page 1 of 0