本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
建立與 GitHub企業伺服器 (CLI) 的連線
您可以使用 AWS Command Line Interface (AWS CLI) 建立連線。
若要這麼做,請使用 create-host 與 create-connection 命令。
重要
依預設,透過 AWS CLI 或建立 AWS CloudFormation 的連線處於PENDING
狀態。建立與 CLI 的連線之後 AWS CloudFormation,或使用主控台編輯連線以顯示其狀態AVAILABLE
。
步驟 1:若要建立 GitHub 企業伺服器 (CLI) 的主機
-
開啟終端機 (Linux、macOS 或 Unix) 或命令提示 (Windows)。使用 AWS CLI 來執行指create-host令,
--provider-endpoint
為您的連線指定--provider-type
、和。--name
在此範例中,第三方供應商名稱為GitHubEnterpriseServer
,而端點為my-instance.dev
。aws codeconnections create-host --name MyHost --provider-type GitHubEnterpriseServer --provider-endpoint "https://my-instance.dev"
如果成功,此命令會傳回類似下列內容的主機 Amazon Resource Name (ARN) 資訊。
{ "HostArn": "arn:aws:codeconnections:us-west-2:
account_id
:host/My-Host-28aef605" }完成此步驟後,主機會處於
PENDING
狀態。 -
使用主控台完成主機設定,並將主機變為
Available
狀態。如需詳細資訊,請參閱 設定待定主機。
步驟 2:在主控台中設定待處理主機
-
登入 AWS Management Console 並開啟開發人員工具主控台,位於https://console.aws.amazon.com/codesuite/settings/connections
。 -
使用主控台完成主機設定,並將主機變為
Available
狀態。請參閱設定待定主機。
步驟 3:若要建立 GitHub 企業伺服器 (CLI) 的連線
-
開啟終端機 (Linux、macOS 或 Unix) 或命令提示 (Windows)。使用 AWS CLI 來執行指create-connection令,
--connection-name
為您的連線指定--host-arn
和。aws codeconnections create-connection --host-arn arn:aws:codeconnections:us-west-2:
account_id
:host/MyHost-234EXAMPLE --connection-name MyConnection如果成功,此命令會傳回類似下列內容的連線 ARN 資訊。
{ "ConnectionArn": "arn:aws:codeconnections:us-west-2:
account_id
:connection/aEXAMPLE-8aad" } -
使用主控台來設定待定連線。如需詳細資訊,請參閱 更新待定連線。
步驟 4:若要在主控台中完成 GitHub 企業伺服器的連線
-
登入 AWS Management Console 並開啟開發人員工具主控台,位於https://console.aws.amazon.com/codesuite/settings/connections
。 -
使用主控台來設定待處理連線,並將連線移動到
Available
狀態。如需詳細資訊,請參閱 更新待定連線。