Dokumentasi ini AWS CLI hanya untuk Versi 1.
Kami mengumumkan akhir dukungan yang akan datang untuk AWS CLI versi 1. Kami menyarankan Anda bermigrasi ke AWS CLI versi 2. Untuk tanggal, detail tambahan, dan informasi tentang cara bermigrasi, lihat pengumuman
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Contoh App Runner menggunakan AWS CLI
Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan AWS Command Line Interface dengan App Runner.
Tindakan merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.
Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakanassociate-custom-domain.
- AWS CLI
-
Untuk mengaitkan nama domain dan subdomain www dengan layanan
associate-custom-domainContoh berikut mengaitkan nama domain kustom yang Anda kontrol dengan layanan App Runner. Nama domain adalah domain rootexample.com, termasuk subdomain kasus khusus.www.example.comaws apprunner associate-custom-domain \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com", "EnableWWWSubdomain": true }Output:
{ "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" }-
Untuk detail API, lihat AssociateCustomDomain
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-auto-scaling-configuration.
- AWS CLI
-
Untuk membuat konfigurasi penskalaan otomatis ketersediaan tinggi
create-auto-scaling-configurationContoh berikut membuat konfigurasi penskalaan otomatis yang dioptimalkan untuk ketersediaan tinggi dengan menyetMinSizeel ke 5. Dengan konfigurasi ini, App Runner mencoba menyebarkan instans layanan Anda di Zona Ketersediaan sebanyak mungkin, hingga lima, tergantung pada Wil AWS ayah.Panggilan mengembalikan
AutoScalingConfigurationobjek dengan pengaturan lain diatur ke defaultnya. Dalam contoh, ini adalah panggilan pertama untuk membuat konfigurasi bernamahigh-availability. Revisi diatur ke 1, dan ini adalah revisi terbaru.aws apprunner create-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "AutoScalingConfigurationName": "high-availability", "MinSize": 5 }Output:
{ "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 } }-
Untuk detail API, lihat CreateAutoScalingConfiguration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-connection.
- AWS CLI
-
Untuk membuat GitHub koneksi
create-connectionContoh berikut membuat koneksi ke repositori GitHub kode pribadi. Status koneksi setelah panggilan berhasil adalahPENDING_HANDSHAKE. Ini karena jabat tangan otentikasi dengan penyedia masih belum terjadi. Selesaikan jabat tangan menggunakan konsol App Runner.aws apprunner create-connection \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ConnectionName": "my-github-connection", "ProviderType": "GITHUB" }Output:
{ "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" } }Untuk informasi selengkapnya, lihat Mengelola koneksi App Runner di Panduan Pengembang AWS App Runner.
-
Untuk detail API, lihat CreateConnection
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-service.
- AWS CLI
-
Contoh 1: Untuk membuat layanan repositori kode sumber
create-serviceContoh berikut membuat layanan App Runner berdasarkan repositori kode sumber Python.aws apprunner create-service \ --cli-input-jsonfile://input.jsonIsi dari
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" } }Output:
{ "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" } } }Contoh 2: Untuk membuat layanan repositori kode sumber
create-serviceContoh berikut membuat layanan App Runner berdasarkan repositori kode sumber Python.aws apprunner create-service \ --cli-input-jsonfile://input.jsonIsi dari
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" } }Output:
{ "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" } } }Contoh 3: Untuk membuat layanan repositori gambar sumber
create-serviceContoh berikut membuat layanan App Runner berdasarkan gambar yang disimpan di Elastic Container Registry (ECR).aws apprunner create-service \ --cli-input-jsonfile://input.jsonIsi dari
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" } }Output:
{ "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" } } }-
Untuk detail API, lihat CreateService
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-auto-scaling-configuration.
- AWS CLI
-
Contoh 1: Untuk menghapus revisi aktif terbaru dari konfigurasi penskalaan otomatis
delete-auto-scaling-configurationContoh berikut menghapus revisi aktif terbaru dari konfigurasi penskalaan otomatis App Runner. Untuk menghapus revisi aktif terbaru, tentukan Nama Sumber Daya Amazon (ARN) yang diakhiri dengan nama konfigurasi, tanpa komponen revisi.Dalam contoh, ada dua revisi sebelum tindakan ini. Oleh karena itu, revisi 2 (terbaru) dihapus. Namun, sekarang ditampilkan
"Latest": false, karena, setelah dihapus, itu bukan revisi aktif terbaru lagi.aws apprunner delete-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability" }Output:
{ "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 } }Contoh 2: Untuk menghapus revisi tertentu dari konfigurasi penskalaan otomatis
delete-auto-scaling-configurationContoh berikut menghapus revisi tertentu dari konfigurasi penskalaan otomatis App Runner. Untuk menghapus revisi tertentu, tentukan ARN yang menyertakan nomor revisi.Dalam contoh, beberapa revisi ada sebelum tindakan ini. Tindakan menghapus revisi
1.aws apprunner delete-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1" }Output:
{ "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 } }-
Untuk detail API, lihat DeleteAutoScalingConfiguration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-connection.
- AWS CLI
-
Untuk menghapus koneksi
delete-connectionContoh berikut menghapus koneksi App Runner. Status koneksi setelah panggilan berhasil adalahDELETED. Ini karena koneksi tidak lagi tersedia.aws apprunner delete-connection \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection" }Output:
{ "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" } }-
Untuk detail API, lihat DeleteConnection
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-service.
- AWS CLI
-
Untuk menghapus layanan
delete-serviceContoh berikut menghapus layanan App Runner.aws apprunner delete-service \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "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" } } }-
Untuk detail API, lihat DeleteService
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-auto-scaling-configuration.
- AWS CLI
-
Contoh 1: Untuk menjelaskan revisi aktif terbaru dari konfigurasi penskalaan otomatis
describe-auto-scaling-configurationContoh berikut mendapatkan deskripsi revisi aktif terbaru dari konfigurasi penskalaan otomatis App Runner. Untuk menjelaskan revisi aktif terbaru, tentukan ARN yang diakhiri dengan nama konfigurasi, tanpa komponen revisi.Dalam contoh ini, ada dua revisi. Oleh karena itu, revisi
2(terbaru) dijelaskan. Objek yang dihasilkan menunjukkan"Latest": true.aws apprunner describe-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability" }Output:
{ "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 } }Contoh 2: Untuk menjelaskan revisi spesifik dari konfigurasi penskalaan otomatis
describe-auto-scaling-configurationContoh berikut mendapatkan deskripsi revisi spesifik dari konfigurasi penskalaan otomatis App Runner. Untuk menjelaskan revisi tertentu, tentukan ARN yang menyertakan nomor revisi.Dalam contoh, beberapa revisi ada dan revisi
1ditanyakan. Objek yang dihasilkan menunjukkan"Latest": false.aws apprunner describe-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1" }Output:
{ "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 } }-
Untuk detail API, lihat DescribeAutoScalingConfiguration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-custom-domains.
- AWS CLI
-
Untuk mendapatkan deskripsi nama domain khusus yang terkait dengan layanan
describe-custom-domainsContoh berikut mendapatkan deskripsi dan status nama domain kustom yang terkait dengan layanan App Runner.aws apprunner describe-custom-domains \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com", "EnableWWWSubdomain": true }Output:
{ "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" }-
Untuk detail API, lihat DescribeCustomDomains
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-service.
- AWS CLI
-
Untuk mendeskripsikan suatu layanan
describe-serviceContoh berikut mendapatkan deskripsi layanan App Runner.aws apprunner describe-service \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "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" } } }-
Untuk detail API, lihat DescribeService
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandisassociate-custom-domain.
- AWS CLI
-
Memisahkan nama domain dari layanan
disassociate-custom-domainContoh berikut memisahkan domainexample.comdari layanan App Runner. Panggilan juga memisahkan subdomainwww.example.comyang dikaitkan bersama dengan domain root.aws apprunner disassociate-custom-domain \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com" }Output:
{ "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" }-
Untuk detail API, lihat DisassociateCustomDomain
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-auto-scaling-configurations.
- AWS CLI
-
Untuk mendapatkan daftar halaman konfigurasi penskalaan otomatis App Runner
list-auto-scaling-configurationsContoh berikut mencantumkan semua konfigurasi penskalaan otomatis App Runner di AWS akun Anda. Hingga lima konfigurasi penskalaan otomatis tercantum di setiap respons.AutoScalingConfigurationNamedanLatestOnlytidak ditentukan. Defaultnya menyebabkan revisi terbaru dari semua konfigurasi aktif terdaftar.Dalam contoh ini, respons mencakup dua hasil dan tidak ada yang tambahan, jadi tidak
NextTokendikembalikan.aws apprunner list-auto-scaling-configurations \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "MaxResults": 5 }Output:
{ "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 } ] }-
Untuk detail API, lihat ListAutoScalingConfigurations
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-connections.
- AWS CLI
-
Contoh 1: Untuk membuat daftar semua koneksi
list-connectionsContoh berikut mencantumkan semua koneksi App Runner di AWS akun.aws apprunner list-connectionsOutput:
{ "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" } ] }Contoh 2: Untuk membuat daftar koneksi berdasarkan nama
list-connectionsContoh berikut mencantumkan koneksi dengan namanya.aws apprunner list-connections \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ConnectionName": "my-github-org-connection" }Output:
{ "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" } ] }-
Untuk detail API, lihat ListConnections
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-operations.
- AWS CLI
-
Untuk membuat daftar operasi yang terjadi pada serviceen
list-operationsContoh berikut mencantumkan semua operasi yang terjadi pada layanan App Runner sejauh ini. Dalam contoh ini, layanan baru dan hanya satu operasi tipe yangCREATE_SERVICEtelah terjadi.aws apprunner list-operations \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "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 } ] }-
Untuk detail API, lihat ListOperations
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-services.
- AWS CLI
-
Untuk mendapatkan daftar layanan App Runner yang dipaginasi
list-servicesContoh berikut mencantumkan semua layanan App Runner di AWS akun. Hingga dua layanan tercantum dalam setiap respons. Contoh ini menunjukkan permintaan pertama. Tanggapan mencakup dua hasil dan token yang dapat digunakan dalam permintaan berikutnya. Ketika respons berikutnya tidak menyertakan token, semua layanan telah terdaftar.aws apprunner list-services \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "MaxResults": 2 }Output:
{ "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" } ] }-
Untuk detail API, lihat ListServices
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.
- AWS CLI
-
Untuk membuat daftar tag yang terkait dengan layanan App Runner
list-tags-for-resourceContoh berikut mencantumkan semua tag yang terkait dengan layanan App Runner.aws apprunner list-tags-for-resource \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "Tags": [ { "Key": "Department", "Value": "Retail" }, { "Key": "CustomerId", "Value": "56439872357912" } ] }-
Untuk detail API, lihat ListTagsForResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanpause-service.
- AWS CLI
-
Untuk menjeda layanan
pause-serviceContoh berikut menjeda layanan App Runner.aws apprunner pause-service \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "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" } } }-
Untuk detail API, lihat PauseService
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanresume-service.
- AWS CLI
-
Untuk melanjutkan layanan
resume-serviceContoh berikut melanjutkan layanan App Runner.aws apprunner resume-service \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "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" } } }-
Untuk detail API, lihat ResumeService
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanstart-deployment.
- AWS CLI
-
Untuk memulai penerapan manual
start-deploymentContoh berikut melakukan penerapan manual ke layanan App Runner.aws apprunner start-deployment \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Output:
{ "OperationId": "853a7d5b-fc9f-4730-831b-fd8037ab832a" }-
Untuk detail API, lihat StartDeployment
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantag-resource.
- AWS CLI
-
Untuk menambahkan tag ke layanan App Runner
tag-resourceContoh berikut menambahkan dua tag ke layanan App Runner.aws apprunner tag-resource \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "Tags": [ { "Key": "Department", "Value": "Retail" }, { "Key": "CustomerId", "Value": "56439872357912" } ] }Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat TagResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanuntag-resource.
- AWS CLI
-
Untuk menghapus tag dari layanan App Runner
untag-resourceContoh berikut menghapus dua tag dari layanan App Runner.aws apprunner untag-resource \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "TagKeys": [ "Department", "CustomerId" ] }Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat UntagResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-service.
- AWS CLI
-
Untuk memperbarui ukuran memori
update-serviceContoh berikut memperbarui ukuran memori instance (unit penskalaan) layanan App Runner ke 2048 MiB.Ketika panggilan berhasil, App Runner memulai proses pembaruan asinkron.
ServiceStruktur yang dikembalikan oleh panggilan mencerminkan nilai memori baru yang diterapkan oleh panggilan ini.aws apprunner update-service \ --cli-input-jsonfile://input.jsonIsi dari
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "InstanceConfiguration": { "Memory": "4 GB" } }Output:
{ "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" } } }-
Untuk detail API, lihat UpdateService
di Refer AWS CLI ensi Perintah.
-