0
0

More than 3 years have passed since last update.

[aws] CodeCommit リポジトリ作成と動作確認

Last updated at Posted at 2020-11-04

概要

CodeCommitによるソース管理を始めるための開始方法をスクショを入れてまとめます。
基本的に以下内容に沿った内容となっています。
https://docs.aws.amazon.com/ja_jp/codecommit/latest/userguide/getting-started.html

リポジトリの作成

https://console.aws.amazon.com/codesuite/codecommit/home にアクセスし、リポジトリを作成を押下

スクリーンショット 2020-11-04 10.24.08.png

リポジトリ名を設定し、作成を押下。

スクリーンショット 2020-11-04 10.31.52.png

SSHによるリポジトリのクローン

SSHでのリポジトリクローンはIAMユーザでのみ実行可能です。
CodeCommitように公開鍵を予め登録しておく必要があります。

$ ssh-keygen
$ cat ~/.ssh/id_rsa.pub

上記で出力された公開鍵をIAMユーザに登録します。

スクリーンショット 2020-11-04 10.49.09.png

ローカルマシンの~/.ssh/configに接続情報を記載します。
Userの値は公開鍵を登録した際のSSHキーIDです。

~/.ssh/config
Host git-codecommit.*.amazonaws.com
  User APKAZ6CO7NSLEFREIC4T
  IdentityFile ~/.ssh/id_rsa

ローカルマシンでcloneを行います。
cloneのURLはCodeCommitで作成したリポジトリの画面から確認できます。

$ git clone ssh://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/practice_ripo
Cloning into 'practice_ripo'...
warning: You appear to have cloned an empty repository.

gitの使い方は基本的に同じなため割愛します。

CloudFormationによるリポジトリの作成

リポジトリの作成を自動化するため、CloudFormationを使用し環境の作成を行います。

リポジトリを作成するだけであれば以下が最小単位となります。

AWSTemplateFormatVersion: '2010-09-09'
Resources:
  codecommit:
    Type: AWS::CodeCommit::Repository
    Properties:
      RepositoryName: practice
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0