選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

使用 AWS CloudShell 來使用 AWS App Runner

焦點模式
使用 AWS CloudShell 來使用 AWS App Runner - AWS App Runner

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AWS CloudShell 是以瀏覽器為基礎的預先驗證 Shell,您可以直接從 啟動 AWS Management Console。您可以使用您偏好的 shell (Bash、PowerShell 或 Z shell AWS App Runner) 對 AWS 服務 (包括) 執行 AWS CLI 命令。另外,您無需下載或安裝命令列工具即可執行此操作。

AWS CloudShell 從 啟動 AWS Management Console ,而您用來登入 主控台的 AWS 登入資料會自動在新的 shell 工作階段中使用。此預先驗證 AWS CloudShell 使用者可讓您在使用 AWS CLI 版本 2 與 App Runner 等 AWS 服務互動時略過設定登入資料 (預先安裝在 shell 的運算環境)。

取得 的 IAM 許可 AWS CloudShell

AWS Identity and Access Management管理員可以使用 提供的存取管理資源,將許可授予 IAM 使用者,讓他們可以存取 AWS CloudShell 和使用環境的功能。

管理員授予使用者存取權的最快方式是透過 AWS 受管政策。AWS 受管政策是由 AWS建立並管理的獨立政策。下列適用於 CloudShell 的 AWS 受管政策可以連接到 IAM 身分:

  • AWSCloudShellFullAccess:授予許可,以 AWS CloudShell 完整存取所有功能。

如果您想要限制 IAM 使用者可執行的動作範圍 AWS CloudShell,您可以建立使用 AWSCloudShellFullAccess受管政策做為範本的自訂政策。如需限制 CloudShell 中使用者可用的動作的詳細資訊,請參閱AWS CloudShell 《 使用者指南》中的使用 IAM 政策管理 AWS CloudShell 存取和用量

注意

您的 IAM 身分也需要 政策,授予對 App Runner 呼叫的許可。如需詳細資訊,請參閱App Runner 如何與 IAM 搭配使用

使用 與 App Runner 互動 AWS CloudShell

AWS CloudShell 從 啟動後 AWS Management Console,您可以立即開始使用命令列界面與 App Runner 互動。

在下列範例中,您會使用 CloudShell AWS CLI 中的 擷取其中一個 App Runner 服務的相關資訊。

注意

使用 AWS CLI 時 AWS CloudShell,您不需要下載或安裝任何其他資源。此外,因為您已經在 Shell 中驗證身分,因此無需設定憑證即可呼叫。

範例 使用 擷取 App Runner 服務資訊 AWS CloudShell
  1. 從 中 AWS Management Console,您可以選擇導覽列上可用的下列選項來啟動 CloudShell:

    • 選擇 CloudShell 圖示。

    • 開始cloudshell在搜尋方塊中輸入 ,然後在搜尋結果中看到 CloudShell 選項時選擇此選項。

  2. 若要在主控台工作階段的 AWS 區域中列出您 AWS 帳戶中所有目前的 App Runner 服務,請在 CloudShell 命令列中輸入下列命令:

    $ aws apprunner list-services

    輸出會列出 服務的摘要資訊。

    { "ServiceSummaryList": [ { "ServiceName": "my-app-1", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceArn": "arn:aws:apprunner:us-east-2:123456789012:service/my-app-1/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "Status": "RUNNING" }, { "ServiceName": "my-app-2", "ServiceId": "ab8f94cfe29a460fb8760afd2ee87555", "ServiceArn": "arn:aws:apprunner:us-east-2:123456789012:service/my-app-2/ab8f94cfe29a460fb8760afd2ee87555", "ServiceUrl": "e2m8rrrx33.us-east-1.awsapprunner.com", "CreatedAt": "2020-11-06T23:15:30Z", "UpdatedAt": "2020-11-23T13:21:22Z", "Status": "RUNNING" } ] }
  3. 若要取得特定 App Runner 服務的詳細說明,請使用上一個步驟中擷取的其中一個 ARNs,在 CloudShell 命令列中輸入下列命令:

    $ aws apprunner describe-service --service-arn arn:aws:apprunner:us-east-2:123456789012:service/my-app-1/8fe1e10304f84fd2b0df550fe98a71fa

    輸出會列出您指定服務的詳細描述。

    { "Service": { "ServiceName": "my-app-1", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceArn": "arn:aws:apprunner:us-east-2:123456789012:service/my-app-1/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "Status": "RUNNING", "SourceConfiguration": { "CodeRepository": { "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" }, "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "[pip install -r requirements.txt]", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "API" } }, "AutoDeploymentsEnabled": true, "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-2:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" }, "HealthCheckConfiguration": { "Protocol": "TCP", "Path": "/", "Interval": 10, "Timeout": 5, "HealthyThreshold": 1, "UnhealthyThreshold": 5 }, "AutoScalingConfigurationSummary": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-2:123456789012:autoscalingconfiguration/DefaultConfiguration/1/00000000000000000000000000000001", "AutoScalingConfigurationName": "DefaultConfiguration", "AutoScalingConfigurationRevision": 1 } } }

使用 驗證您的 App Runner 服務 AWS CloudShell

當您建立 App Runner 服務時,App Runner 會為您的服務網站建立預設網域,並在主控台中顯示它 (或在 API 呼叫結果中傳回它)。您可以使用 CloudShell 來呼叫您的網站,並驗證其是否正常運作。

例如,在您如 所述建立 App Runner 服務之後App Runner 入門,請在 CloudShell 中執行下列命令:

$ curl https://qxuadi4qwp.us-east-2.awsapprunner.com/; echo

輸出應會顯示預期的頁面內容。

瀏覽器視窗 AWS CloudShell 顯示 命令,以顯示 App Runner 服務頁面的內容

下一個主題:

疑難排解

上一個主題:

App Runner API
隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。