を使用した App Runner の例 AWS CLI - AWS Command Line Interface

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

を使用した App Runner の例 AWS CLI

次のコード例は、App Runner AWS Command Line Interface で を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

アクションはより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には、完全なソースコードへのリンクが含まれています。このリンクには、コンテキスト内でコードをセットアップして実行する方法の手順が記載されています。

トピック

アクション

次の例は、associate-custom-domain を使用する方法を説明しています。

AWS CLI

ドメイン名と www サブドメインをサービスに関連付けるには

次のassociate-custom-domain例では、ユーザーが制御するカスタムドメイン名を App Runner サービスに関連付けます。ドメイン名はルートドメイン でexample.com、大文字と小文字のサブドメイン が含まれますwww.example.com

aws apprunner associate-custom-domain \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com", "EnableWWWSubdomain": true }

出力:

{ "CustomDomain": { "CertificateValidationRecords": [ { "Name": "_70d3f50a94f7c72dc28784cf55db2f6b.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_1270c137383c6307b6832db02504c4b0.bsgbmzkfwj.acm-validations.aws." }, { "Name": "_287870d3f50a94f7c72dc4cf55db2f6b.www.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_832db01270c137383c6307b62504c4b0.mzkbsgbfwj.acm-validations.aws." } ], "DomainName": "example.com", "EnableWWWSubdomain": true, "Status": "CREATING" }, "DNSTarget": "psbqam834h.us-east-1.awsapprunner.com", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }
  • API 詳細については、「 コマンドリファレンスAssociateCustomDomain」の「」を参照してください。 AWS CLI

次の例は、create-auto-scaling-configuration を使用する方法を説明しています。

AWS CLI

高可用性の自動スケーリング設定を作成するには

次のcreate-auto-scaling-configuration例では、 を 5 MinSizeに設定することで、高可用性に最適化された自動スケーリング設定を作成します。この設定では、App Runner は、 AWS リージョンに応じて最大 5 つのアベイラビリティーゾーンにサービスインスタンスを分散しようとします。

呼び出しは、他の設定がデフォルトに設定されているAutoScalingConfigurationオブジェクトを返します。この例では、これは という名前の設定を作成する最初の呼び出しですhigh-availability。リビジョンは 1 に設定され、最新のリビジョンです。

aws apprunner create-auto-scaling-configuration \ --cli-input-json file://input.json

input.json の内容:

{ "AutoScalingConfigurationName": "high-availability", "MinSize": 5 }

出力:

{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1/2f50e7656d7819fead0f59672e68042e", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 1, "CreatedAt": "2020-11-03T00:29:17Z", "Latest": true, "Status": "ACTIVE", "MaxConcurrency": 100, "MaxSize": 50, "MinSize": 5 } }

次のコード例は、create-connection を使用する方法を示しています。

AWS CLI

GitHub 接続を作成するには

次のcreate-connection例では、プライベート GitHub コードリポジトリへの接続を作成します。呼び出しが成功した後の接続ステータスは ですPENDING_HANDSHAKE。これは、プロバイダーとの認証ハンドシェイクがまだ行われていないためです。App Runner コンソールを使用してハンドシェイクを完了します。

aws apprunner create-connection \ --cli-input-json file://input.json

input.json の内容:

{ "ConnectionName": "my-github-connection", "ProviderType": "GITHUB" }

出力:

{ "Connection": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection", "ConnectionName": "my-github-connection", "Status": "PENDING_HANDSHAKE", "CreatedAt": "2020-11-03T00:32:51Z", "ProviderType": "GITHUB" } }

詳細については、App Runner デベロッパーガイドの「App Runner 接続の管理」を参照してください。 AWS

  • API 詳細については、「 コマンドリファレンスCreateConnection」の「」を参照してください。 AWS CLI

次の例は、create-service を使用する方法を説明しています。

AWS CLI

例 1: ソースコードリポジトリサービスを作成するには

次のcreate-service例では、Python ソースコードリポジトリに基づいて App Runner サービスを作成します。

aws apprunner create-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceName": "python-app", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" }, "CodeConfiguration": { "ConfigurationSource": "API", "CodeConfigurationValues": { "Runtime": "PYTHON_3", "BuildCommand": "pip install -r requirements.txt", "StartCommand": "python server.py", "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] } } } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }

例 2: ソースコードリポジトリサービスを作成するには

次のcreate-service例では、Python ソースコードリポジトリに基づいて App Runner サービスを作成します。

aws apprunner create-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceName": "python-app", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" }, "CodeConfiguration": { "ConfigurationSource": "API", "CodeConfigurationValues": { "Runtime": "PYTHON_3", "BuildCommand": "pip install -r requirements.txt", "StartCommand": "python server.py", "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] } } } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }

例 3: ソースイメージリポジトリサービスを作成するには

次のcreate-service例では、Elastic Container Registry () に保存されているイメージに基づいて App Runner サービスを作成しますECR。

aws apprunner create-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceName": "golang-container-app", "SourceConfiguration": { "AuthenticationConfiguration": { "AccessRoleArn": "arn:aws:iam::123456789012:role/my-ecr-role" }, "AutoDeploymentsEnabled": true, "ImageRepository": { "ImageIdentifier": "123456789012.dkr.ecr.us-east-1.amazonaws.com/golang-app:latest", "ImageConfiguration": { "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] }, "ImageRepositoryType": "ECR" } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-06T23:15:30Z", "UpdatedAt": "2020-11-06T23:15:30Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/golang-container-app/51728f8a20ce46d39b25398a6c8e9d1a", "ServiceId": "51728f8a20ce46d39b25398a6c8e9d1a", "ServiceName": "golang-container-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "AccessRoleArn": "arn:aws:iam::123456789012:role/my-ecr-role" }, "AutoDeploymentsEnabled": true, "ImageRepository": { "ImageIdentifier": "123456789012.dkr.ecr.us-east-1.amazonaws.com/golang-app:latest", "ImageConfiguration": { "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] }, "ImageRepositoryType": "ECR" } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }
  • API 詳細については、「 コマンドリファレンスCreateService」の「」を参照してください。 AWS CLI

次のコード例は、delete-auto-scaling-configuration を使用する方法を示しています。

AWS CLI

例 1: 自動スケーリング設定の最新のアクティブなリビジョンを削除するには

次のdelete-auto-scaling-configuration例では、App Runner 自動スケーリング設定の最新のアクティブなリビジョンを削除します。最新のアクティブなリビジョンを削除するには、リビジョンコンポーネントを使用せずに、設定名で終わる Amazon リソースネーム (ARN) を指定します。

この例では、このアクションの前に 2 つのリビジョンがあります。したがって、リビジョン 2 (最新) は削除されます。ただし、削除後に最新のアクティブなリビジョンではなくなる"Latest": falseため、 が表示されるようになりました。

aws apprunner delete-auto-scaling-configuration \ --cli-input-json file://input.json

input.json の内容:

{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability" }

出力:

{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/2/e76562f50d78042e819fead0f59672e6", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 2, "CreatedAt": "2021-02-25T17:42:59Z", "DeletedAt": "2021-03-02T08:07:06Z", "Latest": false, "Status": "INACTIVE", "MaxConcurrency": 30, "MaxSize": 90, "MinSize": 5 } }

例 2: 自動スケーリング設定の特定のリビジョンを削除するには

次のdelete-auto-scaling-configuration例では、App Runner Auto Scaling 設定の特定のリビジョンを削除します。特定のリビジョンを削除するには、リビジョン番号ARNを含む を指定します。

この例では、このアクションの前に複数のリビジョンがあります。アクションはリビジョン を削除します1

aws apprunner delete-auto-scaling-configuration \ --cli-input-json file://input.json

input.json の内容:

{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1" }

出力:

{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1/2f50e7656d7819fead0f59672e68042e", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 1, "CreatedAt": "2020-11-03T00:29:17Z", "DeletedAt": "2021-03-02T08:07:06Z", "Latest": false, "Status": "INACTIVE", "MaxConcurrency": 100, "MaxSize": 50, "MinSize": 5 } }

次の例は、delete-connection を使用する方法を説明しています。

AWS CLI

接続を削除するには

次のdelete-connection例では、App Runner 接続を削除します。呼び出しが成功した後の接続ステータスは ですDELETED。これは、接続が利用できなくなったためです。

aws apprunner delete-connection \ --cli-input-json file://input.json

input.json の内容:

{ "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection" }

出力:

{ "Connection": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection", "ConnectionName": "my-github-connection", "Status": "DELETED", "CreatedAt": "2020-11-03T00:32:51Z", "ProviderType": "GITHUB" } }
  • API 詳細については、「 コマンドリファレンスDeleteConnection」の「」を参照してください。 AWS CLI

次の例は、delete-service を使用する方法を説明しています。

AWS CLI

サービスを削除するには

次のdelete-service例では、App Runner サービスを削除します。

aws apprunner delete-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }
  • API 詳細については、「 コマンドリファレンスDeleteService」の「」を参照してください。 AWS CLI

次の例は、describe-auto-scaling-configuration を使用する方法を説明しています。

AWS CLI

例 1: 自動スケーリング設定の最新のアクティブなリビジョンを記述するには

次のdescribe-auto-scaling-configuration例では、App Runner Auto Scaling 設定の最新アクティブリビジョンの説明を取得します。最新のアクティブなリビジョンを記述するには、リビジョンコンポーネントを使用せずに、設定名でARN終わる を指定します。

この例では、2 つのリビジョンがあります。したがって、リビジョン 2 (最新) について説明します。結果のオブジェクトには が表示されます"Latest": true

aws apprunner describe-auto-scaling-configuration \ --cli-input-json file://input.json

input.json の内容:

{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability" }

出力:

{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/2/e76562f50d78042e819fead0f59672e6", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 2, "CreatedAt": "2021-02-25T17:42:59Z", "Latest": true, "Status": "ACTIVE", "MaxConcurrency": 30, "MaxSize": 90, "MinSize": 5 } }

例 2: 自動スケーリング設定の特定リビジョンを記述するには

次のdescribe-auto-scaling-configuration例では、App Runner Auto Scaling 設定の特定のリビジョンの説明を取得します。特定のリビジョンを記述するには、リビジョン番号ARNを含む を指定します。

この例では、複数のリビジョンが存在し、リビジョン1がクエリされます。結果のオブジェクトには が表示されます"Latest": false

aws apprunner describe-auto-scaling-configuration \ --cli-input-json file://input.json

input.json の内容:

{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1" }

出力:

{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1/2f50e7656d7819fead0f59672e68042e", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 1, "CreatedAt": "2020-11-03T00:29:17Z", "Latest": false, "Status": "ACTIVE", "MaxConcurrency": 100, "MaxSize": 50, "MinSize": 5 } }

次のコード例は、describe-custom-domains を使用する方法を示しています。

AWS CLI

サービスに関連付けられたカスタムドメイン名の説明を取得するには

次のdescribe-custom-domains例では、App Runner サービスに関連付けられたカスタムドメイン名の説明とステータスを取得します。

aws apprunner describe-custom-domains \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com", "EnableWWWSubdomain": true }

出力:

{ "CustomDomains": [ { "CertificateValidationRecords": [ { "Name": "_70d3f50a94f7c72dc28784cf55db2f6b.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_1270c137383c6307b6832db02504c4b0.bsgbmzkfwj.acm-validations.aws." }, { "Name": "_287870d3f50a94f7c72dc4cf55db2f6b.www.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_832db01270c137383c6307b62504c4b0.mzkbsgbfwj.acm-validations.aws." } ], "DomainName": "example.com", "EnableWWWSubdomain": true, "Status": "PENDING_CERTIFICATE_DNS_VALIDATION" }, { "CertificateValidationRecords": [ { "Name": "_a94f784c70d3f507c72dc28f55db2f6b.deals.example.com", "Status": "SUCCESS", "Type": "CNAME", "Value": "_2db02504c1270c137383c6307b6834b0.bsgbmzkfwj.acm-validations.aws." } ], "DomainName": "deals.example.com", "EnableWWWSubdomain": false, "Status": "ACTIVE" } ], "DNSTarget": "psbqam834h.us-east-1.awsapprunner.com", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }
  • API 詳細については、「 コマンドリファレンスDescribeCustomDomains」の「」を参照してください。 AWS CLI

次のコード例は、describe-service を使用する方法を示しています。

AWS CLI

サービスを記述するには

次のdescribe-service例では、App Runner サービスの説明を取得します。

aws apprunner describe-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "RUNNING", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }
  • API 詳細については、「 コマンドリファレンスDescribeService」の「」を参照してください。 AWS CLI

次のコード例は、disassociate-custom-domain を使用する方法を示しています。

AWS CLI

サービスからドメイン名の関連付けを解除するには

次のdisassociate-custom-domain例では、App Runner サービスexample.comからドメインの関連付けを解除します。この呼び出しは、ルートドメインwww.example.comに関連付けられているサブドメインの関連付けも解除します。

aws apprunner disassociate-custom-domain \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com" }

出力:

{ "CustomDomain": { "CertificateValidationRecords": [ { "Name": "_70d3f50a94f7c72dc28784cf55db2f6b.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_1270c137383c6307b6832db02504c4b0.bsgbmzkfwj.acm-validations.aws." }, { "Name": "_287870d3f50a94f7c72dc4cf55db2f6b.www.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_832db01270c137383c6307b62504c4b0.mzkbsgbfwj.acm-validations.aws." } ], "DomainName": "example.com", "EnableWWWSubdomain": true, "Status": "DELETING" }, "DNSTarget": "psbqam834h.us-east-1.awsapprunner.com", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }
  • API 詳細については、「 コマンドリファレンスDisassociateCustomDomain」の「」を参照してください。 AWS CLI

次のコード例は、list-auto-scaling-configurations を使用する方法を示しています。

AWS CLI

App Runner の自動スケーリング設定のページ分割されたリストを取得するには

次のlist-auto-scaling-configurations例では、アカウント内のすべての App Runner Auto Scaling 設定を一覧表示します AWS 。各レスポンスには、最大 5 つのオートスケーリング設定が一覧表示されます。 AutoScalingConfigurationNameLatestOnlyは指定されません。それらのデフォルトにより、すべてのアクティブな設定の最新リビジョンが一覧表示されます。

この例では、レスポンスに 2 つの結果が含まれており、追加の結果がないため、 NextTokenは返されません。

aws apprunner list-auto-scaling-configurations \ --cli-input-json file://input.json

input.json の内容:

{ "MaxResults": 5 }

出力:

{ "AutoScalingConfigurationSummaryList": [ { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/2/e76562f50d78042e819fead0f59672e6", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 2 }, { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/low-cost/1/50d7804e7656fead0f59672e62f2e819", "AutoScalingConfigurationName": "low-cost", "AutoScalingConfigurationRevision": 1 } ] }

次のコード例は、list-connections を使用する方法を示しています。

AWS CLI

例 1: すべての接続を一覧表示するには

次のlist-connections例では、アカウント内のすべての App Runner 接続を一覧表示します AWS 。

aws apprunner list-connections

出力:

{ "ConnectionSummaryList": [ { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection", "ConnectionName": "my-github-connection", "Status": "AVAILABLE", "CreatedAt": "2020-11-03T00:32:51Z", "ProviderType": "GITHUB" }, { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-org-connection", "ConnectionName": "my-github-org-connection", "Status": "AVAILABLE", "CreatedAt": "2020-11-03T02:54:17Z", "ProviderType": "GITHUB" } ] }

例 2: 接続を名前で一覧表示するには

次のlist-connections例では、接続を名前で一覧表示します。

aws apprunner list-connections \ --cli-input-json file://input.json

input.json の内容:

{ "ConnectionName": "my-github-org-connection" }

出力:

{ "ConnectionSummaryList": [ { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-org-connection", "ConnectionName": "my-github-org-connection", "Status": "AVAILABLE", "CreatedAt": "2020-11-03T02:54:17Z", "ProviderType": "GITHUB" } ] }
  • API 詳細については、「 コマンドリファレンスListConnections」の「」を参照してください。 AWS CLI

次の例は、list-operations を使用する方法を説明しています。

AWS CLI

サービスで発生したオペレーションを一覧表示するには

次のlist-operations例では、これまでに App Runner サービスで発生したすべてのオペレーションを一覧表示します。この例では、サービスは新しく、 タイプのオペレーションCREATE_SERVICEが 1 回のみ発生しています。

aws apprunner list-operations \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "OperationSummaryList": [ { "EndedAt": 1606156217, "Id": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "StartedAt": 1606156014, "Status": "SUCCEEDED", "TargetArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "Type": "CREATE_SERVICE", "UpdatedAt": 1606156217 } ] }
  • API 詳細については、「 コマンドリファレンスListOperations」の「」を参照してください。 AWS CLI

次の例は、list-services を使用する方法を説明しています。

AWS CLI

App Runner サービスのページ分割されたリストを取得するには

次のlist-services例では、アカウント内のすべての App Runner サービスを一覧表示します AWS 。各レスポンスには、最大 2 つのサービスが一覧表示されます。この例は、最初のリクエストを示しています。レスポンスには、次のリクエストで使用できる 2 つの結果とトークンが含まれます。後続のレスポンスにトークンが含まれていない場合、すべてのサービスが一覧表示されます。

aws apprunner list-services \ --cli-input-json file://input.json

input.json の内容:

{ "MaxResults": 2 }

出力:

{ "NextToken": "eyJDdXN0b21lckFjY291bnRJZCI6IjI3MDIwNTQwMjg0NSIsIlNlcnZpY2VTdGF0dXNDb2RlIjoiUFJPVklTSU9OSU5HIiwiSGFzaEtleSI6IjI3MDIwNTQwMjg0NSNhYjhmOTRjZmUyOWE0NjBmYjg3NjBhZmQyZWU4NzU1NSJ9", "ServiceSummaryList": [ { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "Status": "RUNNING" }, { "CreatedAt": "2020-11-06T23:15:30Z", "UpdatedAt": "2020-11-23T13:21:22Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/golang-container-app/ab8f94cfe29a460fb8760afd2ee87555", "ServiceId": "ab8f94cfe29a460fb8760afd2ee87555", "ServiceName": "golang-container-app", "ServiceUrl": "e2m8rrrx33.us-east-1.awsapprunner.com", "Status": "RUNNING" } ] }
  • API 詳細については、「 コマンドリファレンスListServices」の「」を参照してください。 AWS CLI

次の例は、list-tags-for-resource を使用する方法を説明しています。

AWS CLI

App Runner サービスに関連付けられたタグを一覧表示するには

次のlist-tags-for-resource例では、App Runner サービスに関連付けられているすべてのタグを一覧表示します。

aws apprunner list-tags-for-resource \ --cli-input-json file://input.json

input.json の内容:

{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "Tags": [ { "Key": "Department", "Value": "Retail" }, { "Key": "CustomerId", "Value": "56439872357912" } ] }
  • API 詳細については、「 コマンドリファレンスListTagsForResource」の「」を参照してください。 AWS CLI

次の例は、pause-service を使用する方法を説明しています。

AWS CLI

サービスを一時停止するには

次のpause-service例では、App Runner サービスを一時停止します。

aws apprunner pause-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }
  • API 詳細については、「 コマンドリファレンスPauseService」の「」を参照してください。 AWS CLI

次のコード例は、resume-service を使用する方法を示しています。

AWS CLI

サービスを再開するには

次のresume-service例では、App Runner サービスを再開します。

aws apprunner resume-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }
  • API 詳細については、「 コマンドリファレンスResumeService」の「」を参照してください。 AWS CLI

次のコード例は、start-deployment を使用する方法を示しています。

AWS CLI

手動デプロイを開始するには

次のstart-deployment例では、App Runner サービスへの手動デプロイを実行します。

aws apprunner start-deployment \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }

出力:

{ "OperationId": "853a7d5b-fc9f-4730-831b-fd8037ab832a" }
  • API 詳細については、「 コマンドリファレンスStartDeployment」の「」を参照してください。 AWS CLI

次のコード例は、tag-resource を使用する方法を示しています。

AWS CLI

App Runner サービスにタグを追加するには

次のtag-resource例では、App Runner サービスに 2 つのタグを追加します。

aws apprunner tag-resource \ --cli-input-json file://input.json

input.json の内容:

{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "Tags": [ { "Key": "Department", "Value": "Retail" }, { "Key": "CustomerId", "Value": "56439872357912" } ] }

このコマンドでは何も出力されません。

  • API 詳細については、「 コマンドリファレンスTagResource」の「」を参照してください。 AWS CLI

次のコード例は、untag-resource を使用する方法を示しています。

AWS CLI

App Runner サービスからタグを削除するには

次のuntag-resource例では、App Runner サービスから 2 つのタグを削除します。

aws apprunner untag-resource \ --cli-input-json file://input.json

input.json の内容:

{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "TagKeys": [ "Department", "CustomerId" ] }

このコマンドでは何も出力されません。

  • API 詳細については、「 コマンドリファレンスUntagResource」の「」を参照してください。 AWS CLI

次のコード例は、update-service を使用する方法を示しています。

AWS CLI

メモリサイズを更新するには

次のupdate-service例では、App Runner サービスのインスタンス (スケーリングユニット) のメモリサイズを 2048 MiB に更新します。

呼び出しが成功すると、App Runner は非同期更新プロセスを開始します。呼び出しによって返されるService構造は、この呼び出しによって適用される新しいメモリ値を反映します。

aws apprunner update-service \ --cli-input-json file://input.json

input.json の内容:

{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "InstanceConfiguration": { "Memory": "4 GB" } }

出力:

{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "4 GB" } } }
  • API 詳細については、「 コマンドリファレンスUpdateService」の「」を参照してください。 AWS CLI