文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 的 Lightsail 範例 AWS CLI
下列程式碼範例示範如何搭配 AWS Command Line Interface Lightsail 使用 來執行動作和實作常見案例。
Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在相關案例中查看內容中的動作。
每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。
主題
動作
下列程式碼範例示範如何使用 allocate-static-ip
。
- AWS CLI
-
建立靜態 IP
下列
allocate-static-ip
範例會建立指定的靜態 IP,此 IP 可以連接至執行個體。aws lightsail allocate-static-ip \ --static-ip-name
StaticIp-1
輸出:
{ "operations": [ { "id": "b5d06d13-2f19-4683-889f-dEXAMPLEed79", "resourceName": "StaticIp-1", "resourceType": "StaticIp", "createdAt": 1571071325.076, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "AllocateStaticIp", "status": "Succeeded", "statusChangedAt": 1571071325.274 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 AllocateStaticIp
。
-
下列程式碼範例示範如何使用 attach-disk
。
- AWS CLI
-
將區塊儲存磁碟連接至執行個體
下列
attach-disk
範例會將磁碟連接至WordPress_Multisite-1
具有 磁碟路徑的Disk-1
執行個體/dev/xvdf
aws lightsail attach-disk \ --disk-name
Disk-1
\ --disk-path/dev/xvdf
\ --instance-nameWordPress_Multisite-1
輸出:
{ "operations": [ { "id": "10a08267-19ce-43be-b913-6EXAMPLE7e80", "resourceName": "Disk-1", "resourceType": "Disk", "createdAt": 1571071465.472, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "WordPress_Multisite-1", "operationType": "AttachDisk", "status": "Started", "statusChangedAt": 1571071465.472 }, { "id": "2912c477-5295-4539-88c9-bEXAMPLEd1f0", "resourceName": "WordPress_Multisite-1", "resourceType": "Instance", "createdAt": 1571071465.474, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "Disk-1", "operationType": "AttachDisk", "status": "Started", "statusChangedAt": 1571071465.474 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 AttachDisk
。
-
下列程式碼範例示範如何使用 attach-instances-to-load-balancer
。
- AWS CLI
-
將執行個體連接至負載平衡器
下列
attach-instances-to-load-balancer
範例會將執行個體MEAN-1
、MEAN-2
和 連接至MEAN-3
負載平衡器LoadBalancer-1
。aws lightsail attach-instances-to-load-balancer \ --instance-names {"MEAN-1","MEAN-2","MEAN-3"} \ --load-balancer-name
LoadBalancer-1
輸出:
{ "operations": [ { "id": "8055d19d-abb2-40b9-b527-1EXAMPLE3c7b", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571071699.892, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "MEAN-2", "operationType": "AttachInstancesToLoadBalancer", "status": "Started", "statusChangedAt": 1571071699.892 }, { "id": "c35048eb-8538-456a-a118-0EXAMPLEfb73", "resourceName": "MEAN-2", "resourceType": "Instance", "createdAt": 1571071699.887, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "LoadBalancer-1", "operationType": "AttachInstancesToLoadBalancer", "status": "Started", "statusChangedAt": 1571071699.887 }, { "id": "910d09e0-adc5-4372-bc2e-0EXAMPLEd891", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571071699.882, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "MEAN-3", "operationType": "AttachInstancesToLoadBalancer", "status": "Started", "statusChangedAt": 1571071699.882 }, { "id": "178b18ac-43e8-478c-9bed-1EXAMPLE4755", "resourceName": "MEAN-3", "resourceType": "Instance", "createdAt": 1571071699.901, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "LoadBalancer-1", "operationType": "AttachInstancesToLoadBalancer", "status": "Started", "statusChangedAt": 1571071699.901 }, { "id": "fb62536d-2a98-4190-a6fc-4EXAMPLE7470", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571071699.885, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "MEAN-1", "operationType": "AttachInstancesToLoadBalancer", "status": "Started", "statusChangedAt": 1571071699.885 }, { "id": "787dac0d-f98d-46c3-8571-3EXAMPLE5a85", "resourceName": "MEAN-1", "resourceType": "Instance", "createdAt": 1571071699.901, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "LoadBalancer-1", "operationType": "AttachInstancesToLoadBalancer", "status": "Started", "statusChangedAt": 1571071699.901 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 AttachInstancesToLoadBalancer
。
-
下列程式碼範例示範如何使用 attach-load-balancer-tls-certificate
。
- AWS CLI
-
將 TLS 憑證連接至負載平衡器
下列
attach-load-balancer-tls-certificate
範例會將負載平衡器 TLS 憑證連接至Certificate2
負載平衡器LoadBalancer-1
。aws lightsail attach-load-balancer-tls-certificate \ --certificate-name
Certificate2
\ --load-balancer-nameLoadBalancer-1
輸出:
{ "operations": [ { "id": "cf1ad6e3-3cbb-4b8a-a7f2-3EXAMPLEa118", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571072255.416, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "Certificate2", "operationType": "AttachLoadBalancerTlsCertificate", "status": "Succeeded", "statusChangedAt": 1571072255.416 }, { "id": "dae1bcfb-d531-4c06-b4ea-bEXAMPLEc04e", "resourceName": "Certificate2", "resourceType": "LoadBalancerTlsCertificate", "createdAt": 1571072255.416, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "LoadBalancer-1", "operationType": "AttachLoadBalancerTlsCertificate", "status": "Succeeded", "statusChangedAt": 1571072255.416 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 AttachLoadBalancerTlsCertificate
。
-
下列程式碼範例示範如何使用 attach-static-ip
。
- AWS CLI
-
將靜態 IP 連接至執行個體
下列
attach-static-ip
範例會將靜態 IP 連接至StaticIp-1
執行個體MEAN-1
。aws lightsail attach-static-ip \ --static-ip-name
StaticIp-1
\ --instance-nameMEAN-1
輸出:
{ "operations": [ { "id": "45e6fa13-4808-4b8d-9292-bEXAMPLE20b2", "resourceName": "StaticIp-1", "resourceType": "StaticIp", "createdAt": 1571072569.375, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MEAN-1", "operationType": "AttachStaticIp", "status": "Succeeded", "statusChangedAt": 1571072569.375 }, { "id": "9ee09a17-863c-4e51-8a6d-3EXAMPLE5475", "resourceName": "MEAN-1", "resourceType": "Instance", "createdAt": 1571072569.376, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "StaticIp-1", "operationType": "AttachStaticIp", "status": "Succeeded", "statusChangedAt": 1571072569.376 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 AttachStaticIp
。
-
下列程式碼範例示範如何使用 close-instance-public-ports
。
- AWS CLI
-
關閉執行個體的防火牆連接埠
下列
close-instance-public-ports
範例會關閉執行個體22
上的 TCP 連接埠MEAN-2
。aws lightsail close-instance-public-ports \ --instance-name
MEAN-2
\ --port-infofromPort=22,protocol=TCP,toPort=22
輸出:
{ "operation": { "id": "4f328636-1c96-4649-ae6d-1EXAMPLEf446", "resourceName": "MEAN-2", "resourceType": "Instance", "createdAt": 1571072845.737, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "22/tcp", "operationType": "CloseInstancePublicPorts", "status": "Succeeded", "statusChangedAt": 1571072845.737 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CloseInstancePublicPorts
。
-
下列程式碼範例示範如何使用 copy-snapshot
。
- AWS CLI
-
範例 1:複製相同 AWS 區域內的快照
下列
copy-snapshot
範例會將執行個體快照複製MEAN-1-1571075291
為相同 AWS 區域MEAN-1-Copy
內的執行個體快照us-west-2
。aws lightsail copy-snapshot \ --source-snapshot-name
MEAN-1-1571075291
\ --target-snapshot-nameMEAN-1-Copy
\ --source-regionus-west-2
輸出:
{ "operations": [ { "id": "ced16fc1-f401-4556-8d82-1EXAMPLEb982", "resourceName": "MEAN-1-Copy", "resourceType": "InstanceSnapshot", "createdAt": 1571075581.498, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "us-west-2:MEAN-1-1571075291", "operationType": "CopySnapshot", "status": "Started", "statusChangedAt": 1571075581.498 } ] }
如需詳細資訊,請參閱 Amazon Lightsail 開發指南中的將快照從一個 AWS 區域複製到另一個
區域。 範例 2:將快照從一個區域複製到另一個 AWS 區域
下列
copy-snapshot
範例會將執行個體快照MEAN-1-1571075291
作為執行個體快照MEAN-1-1571075291-Copy
從 AWS 區域複製到us-west-2
us-east-1
。aws lightsail copy-snapshot \ --source-snapshot-name
MEAN-1-1571075291
\ --target-snapshot-nameMEAN-1-1571075291-Copy
\ --source-regionus-west-2
\ --regionus-east-1
輸出:
{ "operations": [ { "id": "91116b79-119c-4451-b44a-dEXAMPLEd97b", "resourceName": "MEAN-1-1571075291-Copy", "resourceType": "InstanceSnapshot", "createdAt": 1571075695.069, "location": { "availabilityZone": "all", "regionName": "us-east-1" }, "isTerminal": false, "operationDetails": "us-west-2:MEAN-1-1571075291", "operationType": "CopySnapshot", "status": "Started", "statusChangedAt": 1571075695.069 } ] }
如需詳細資訊,請參閱 Amazon Lightsail 開發指南中的將快照從一個 AWS 區域複製到另一個
區域。 範例 3:在相同 AWS 區域內複製自動快照
下列
copy-snapshot
範例會在 AWS 區域WordPress-1-10142019
中將執行個體2019-10-14
的自動快照複製WordPress-1
為手動快照us-west-2
。aws lightsail copy-snapshot \ --source-resource-name
WordPress-1
\ --restore-date2019-10-14
\ --target-snapshot-nameWordPress-1-10142019
\ --source-regionus-west-2
輸出:
{ "operations": [ { "id": "be3e6754-cd1d-48e6-ad9f-2EXAMPLE1805", "resourceName": "WordPress-1-10142019", "resourceType": "InstanceSnapshot", "createdAt": 1571082412.311, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "us-west-2:WordPress-1", "operationType": "CopySnapshot", "status": "Started", "statusChangedAt": 1571082412.311 } ] }
如需詳細資訊,請參閱 Lightsail 開發指南中的在 Amazon Lightsail 中保留執行個體或磁碟的自動快照
。 範例 4:將自動快照從一個區域複製到另一個 AWS 區域
下列
copy-snapshot
範例會將執行個體2019-10-14
的自動快照WordPress-1
作為手動快照WordPress-1-10142019
從 AWS 區域複製到us-west-2
us-east-1
。aws lightsail copy-snapshot \ --source-resource-name
WordPress-1
\ --restore-date2019-10-14
\ --target-snapshot-nameWordPress-1-10142019
\ --source-regionus-west-2
\ --regionus-east-1
輸出:
{ "operations": [ { "id": "dffa128b-0b07-476e-b390-bEXAMPLE3775", "resourceName": "WordPress-1-10142019", "resourceType": "InstanceSnapshot", "createdAt": 1571082493.422, "location": { "availabilityZone": "all", "regionName": "us-east-1" }, "isTerminal": false, "operationDetails": "us-west-2:WordPress-1", "operationType": "CopySnapshot", "status": "Started", "statusChangedAt": 1571082493.422 } ] }
如需詳細資訊,請參閱 Lightsail 開發指南中的在 Amazon Lightsail 中保留執行個體或磁碟的自動快照
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CopySnapshot
。
-
下列程式碼範例示範如何使用 create-disk-from-snapshot
。
- AWS CLI
-
從磁碟快照建立磁碟
下列
create-disk-from-snapshot
範例Disk-2
會從指定的區塊儲存磁碟快照建立名為 的區塊儲存磁碟。磁碟是在指定的 AWS 區域和可用區域中建立,具有 32 GB 的儲存空間。aws lightsail create-disk-from-snapshot \ --disk-name
Disk-2
\ --disk-snapshot-nameDisk-1-1566839161
\ --availability-zoneus-west-2a
\ --size-in-gb32
輸出:
{ "operations": [ { "id": "d42b605d-5ef1-4b4a-8791-7a3e8b66b5e7", "resourceName": "Disk-2", "resourceType": "Disk", "createdAt": 1569624941.471, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateDiskFromSnapshot", "status": "Started", "statusChangedAt": 1569624941.791 } ] }
如需詳細資訊,請參閱 Amazon Amazon Lightsail 開發人員指南中的從快照建立區塊儲存磁碟
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateDiskFromSnapshot
。
-
下列程式碼範例示範如何使用 create-disk-snapshot
。
- AWS CLI
-
範例 1:建立磁碟的快照
下列
create-disk-snapshot
範例會建立名為指定區塊儲存磁碟DiskSnapshot-1
的快照。aws lightsail create-disk-snapshot \ --disk-name
Disk-1
\ --disk-snapshot-nameDiskSnapshot-1
輸出:
{ "operations": [ { "id": "fa74c6d2-03a3-4f42-a7c7-792f124d534b", "resourceName": "DiskSnapshot-1", "resourceType": "DiskSnapshot", "createdAt": 1569625129.739, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "Disk-1", "operationType": "CreateDiskSnapshot", "status": "Started", "statusChangedAt": 1569625129.739 }, { "id": "920a25df-185c-4528-87cd-7b85f5488c06", "resourceName": "Disk-1", "resourceType": "Disk", "createdAt": 1569625129.739, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "DiskSnapshot-1", "operationType": "CreateDiskSnapshot", "status": "Started", "statusChangedAt": 1569625129.739 } ] }
範例 2:建立執行個體系統磁碟的快照
下列
create-disk-snapshot
範例會建立指定執行個體系統磁碟的快照。aws lightsail create-disk-snapshot \ --instance-name
WordPress-1
\ --disk-snapshot-nameSystemDiskSnapshot-1
輸出:
{ "operations": [ { "id": "f508cf1c-6597-42a6-a4c3-4aebd75af0d9", "resourceName": "SystemDiskSnapshot-1", "resourceType": "DiskSnapshot", "createdAt": 1569625294.685, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "WordPress-1", "operationType": "CreateDiskSnapshot", "status": "Started", "statusChangedAt": 1569625294.685 }, { "id": "0bb9f712-da3b-4d99-b508-3bf871d989e5", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1569625294.685, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "SystemDiskSnapshot-1", "operationType": "CreateDiskSnapshot", "status": "Started", "statusChangedAt": 1569625294.685 } ] }
如需詳細資訊,請參閱 Amazon Lightsail 中的快照
,以及 Lightsail 開發人員指南中的在 Amazon Lightsail 中建立執行個體根磁碟區的快照 。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateDiskSnapshot
。
-
下列程式碼範例示範如何使用 create-disk
。
- AWS CLI
-
若要建立區塊儲存磁碟
下列
create-disk
範例Disk-1
會在指定的 AWS 區域和可用區域中建立具有 32 GB 儲存空間的區塊儲存磁碟。aws lightsail create-disk \ --disk-name
Disk-1
\ --availability-zoneus-west-2a
\ --size-in-gb32
輸出:
{ "operations": [ { "id": "1c85e2ec-86ba-4697-b936-77f4d3dc013a", "resourceName": "Disk-1", "resourceType": "Disk", "createdAt": 1569449220.36, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateDisk", "status": "Started", "statusChangedAt": 1569449220.588 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateDisk
。
-
下列程式碼範例示範如何使用 create-domain-entry
。
- AWS CLI
-
建立網域項目 (DNS 記錄)
下列
create-domain-entry
範例會為指向執行個體 IP 地址的指定網域頂點建立 DNS 記錄 (A)。注意:Lightsail 的網域相關 API 操作僅適用於
us-east-1
區域。如果您的 CLI 設定檔設定為使用不同的區域,您必須包含--region us-east-1
參數或命令失敗。aws lightsail create-domain-entry \ --region
us-east-1
\ --domain-nameexample.com
\ --domain-entryname=example.com,type=A,target=192.0.2.0
輸出:
{ "operation": { "id": "5be4494d-56f4-41fc-8730-693dcd0ef9e2", "resourceName": "example.com", "resourceType": "Domain", "createdAt": 1569865296.519, "location": { "availabilityZone": "all", "regionName": "global" }, "isTerminal": true, "operationType": "CreateDomainEntry", "status": "Succeeded", "statusChangedAt": 1569865296.519 } }
如需詳細資訊,請參閱 Amazon Lightsail 中的 DNS
和在 Amazon Lightsail 開發人員指南中的建立 DNS 區域以管理網域的 DNS 記錄 。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateDomainEntry
。
-
下列程式碼範例示範如何使用 create-domain
。
- AWS CLI
-
若要建立網域 (DNS 區域)
下列
create-domain
範例會為指定的網域建立 DNS 區域。注意:Lightsail 的網域相關 API 操作僅適用於
us-east-1
區域。如果您的 CLI 設定檔設定為使用不同的區域,您必須包含--region us-east-1
參數或命令失敗。aws lightsail create-domain \ --region
us-east-1
\ --domain-nameexample.com
輸出:
{ "operation": { "id": "64e522c8-9ae1-4c05-9b65-3f237324dc34", "resourceName": "example.com", "resourceType": "Domain", "createdAt": 1569864291.92, "location": { "availabilityZone": "all", "regionName": "global" }, "isTerminal": true, "operationType": "CreateDomain", "status": "Succeeded", "statusChangedAt": 1569864292.109 } }
如需詳細資訊,請參閱 Amazon Lightsail 中的 DNS
和在 Amazon Lightsail 開發人員指南中的建立 DNS 區域以管理網域的 DNS 記錄 。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateDomain
。
-
下列程式碼範例示範如何使用 create-instance-snapshot
。
- AWS CLI
-
建立執行個體的快照
下列
create-instance-snapshot
範例會從指定的執行個體建立快照。aws lightsail create-instance-snapshot \ --instance-name
WordPress-1
\ --instance-snapshot-nameWordPress-Snapshot-1
輸出:
{ "operations": [ { "id": "4c3db559-9dd0-41e7-89c0-2cb88c19786f", "resourceName": "WordPress-Snapshot-1", "resourceType": "InstanceSnapshot", "createdAt": 1569866438.48, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "WordPress-1", "operationType": "CreateInstanceSnapshot", "status": "Started", "statusChangedAt": 1569866438.48 }, { "id": "c04fdc45-2981-488c-88b5-d6d2fd759a6a", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1569866438.48, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "WordPress-Snapshot-1", "operationType": "CreateInstanceSnapshot", "status": "Started", "statusChangedAt": 1569866438.48 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateInstanceSnapshot
。
-
下列程式碼範例示範如何使用 create-instances-from-snapshot
。
- AWS CLI
-
從快照建立執行個體
下列
create-instances-from-snapshot
範例會使用 $12 USD 套件,在指定的 AWS 區域和可用區域中,從指定的執行個體快照建立執行個體。注意:您指定的套件在規格中必須等於或大於用於建立快照的原始來源執行個體的套件。
aws lightsail create-instances-from-snapshot \ --instance-snapshot-name
WordPress-1-1569866208
\ --instance-namesWordPress-2
\ --availability-zoneus-west-2a
\ --bundle-idsmall_3_0
輸出:
{ "operations": [ { "id": "003f8271-b711-464d-b9b8-7f3806cb496e", "resourceName": "WordPress-2", "resourceType": "Instance", "createdAt": 1569865914.908, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateInstancesFromSnapshot", "status": "Started", "statusChangedAt": 1569865914.908 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateInstancesFromSnapshot
。
-
下列程式碼範例示範如何使用 create-instances
。
- AWS CLI
-
範例 1:建立單一執行個體
下列
create-instances
範例會使用 WordPress 藍圖和 $5.00 USD 套件,在指定的 AWS 區域和可用區域中建立執行個體。aws lightsail create-instances \ --instance-names
Instance-1
\ --availability-zoneus-west-2a
\ --blueprint-idwordpress
\ --bundle-idnano_3_0
輸出:
{ "operations": [ { "id": "9a77158f-7be3-4d6d-8054-cf5ae2b720cc", "resourceName": "Instance-1", "resourceType": "Instance", "createdAt": 1569447986.061, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateInstance", "status": "Started", "statusChangedAt": 1569447986.061 } ] }
範例 2:一次建立多個執行個體
下列
create-instances
範例會使用 WordPress 藍圖和 $5.00 USD 套件,在指定的 AWS 區域和可用區域中建立三個執行個體。aws lightsail create-instances \ --instance-names {"Instance1","Instance2","Instance3"} \ --availability-zone
us-west-2a
\ --blueprint-idwordpress
\ --bundle-idnano_3_0
輸出:
{ "operations": [ { "id": "5492f015-9d2e-48c6-8eea-b516840e6903", "resourceName": "Instance1", "resourceType": "Instance", "createdAt": 1569448780.054, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateInstance", "status": "Started", "statusChangedAt": 1569448780.054 }, { "id": "c58b5f46-2676-44c8-b95c-3ad375898515", "resourceName": "Instance2", "resourceType": "Instance", "createdAt": 1569448780.054, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateInstance", "status": "Started", "statusChangedAt": 1569448780.054 }, { "id": "a5ad8006-9bee-4499-9eb7-75e42e6f5882", "resourceName": "Instance3", "resourceType": "Instance", "createdAt": 1569448780.054, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateInstance", "status": "Started", "statusChangedAt": 1569448780.054 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateInstances
。
-
下列程式碼範例示範如何使用 create-key-pair
。
- AWS CLI
-
建立一組金鑰對
下列
create-key-pair
範例會建立金鑰對,您可以使用它來驗證和連線至執行個體。aws lightsail create-key-pair \ --key-pair-name
MyPersonalKeyPair
輸出提供私有金鑰 base64 值,可用於對使用建立金鑰對的執行個體進行身分驗證。注意:複製私有金鑰 base64 值並貼到安全位置,因為稍後無法擷取。
{ "keyPair": { "name": "MyPersonalKeyPair", "arn": "arn:aws:lightsail:us-west-2:111122223333:KeyPair/55025c71-198f-403b-b42f-a69433e724fb", "supportCode": "621291663362/MyPersonalKeyPair", "createdAt": 1569866556.567, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "KeyPair" }, "publicKeyBase64": "ssh-rsa ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCV0xUEwx96amPERH7K1bVT1tTFl9OmNk6o7m5YVHk9xlOdMbDRbFvhtXvw4jzJXXz5pBMxWOaGMz5K8QyTVOznoqp13Z8SBooH29hgmBNXiII1XPzEwqbj8mfo1+YVM5s5VuxWwm+BHUgedGUXno6uF7agqxZNO1kPLJBIVTW26SSYBJ0tE+y804UyVsjrbUqCaMXDhmfXpWulMPwuXhwcKh7e8hwoTfkiX0E6Ql+KqF/MiA3w6DCjEqvvdIO7SiEZJFsuGNfYDDN3w60Rel5MUhmn3OJdn4y/A7NWb3IxL4pPfVE4rgFRKU8n1jp9kwRnlVMVBOWuGXk6n+H6M2f1 ", "privateKeyBase64": "-----BEGIN RSA PRIVATE KEY-----EXAMPLETCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMC\nVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6\nb24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsEXAMPLEd\nBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcN\nMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYD\nVQQHEwdTZWF0dGxlMQ8wDQEXAMPLEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25z\nb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFt\nYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMEXAMPLE4GmWIWJ\n21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9T\nrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpE\nIbb3OhjZnzcvQAaREXAMPLEMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4\nnUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0Fkb\nFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OEXAMPLELvjx79LjSTb\nNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=\n-----END RSA PRIVATE KEY-----", "operation": { "id": "67f984db-9994-45fe-ad38-59bafcaf82ef", "resourceName": "MyPersonalKeyPair", "resourceType": "KeyPair", "createdAt": 1569866556.567, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "CreateKeyPair", "status": "Succeeded", "statusChangedAt": 1569866556.704 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateKeyPair
。
-
下列程式碼範例示範如何使用 create-load-balancer-tls-certificate
。
- AWS CLI
-
為負載平衡器建立 TLS 憑證
下列
create-load-balancer-tls-certificate
範例會建立連接至指定負載平衡器的 TLS 憑證。建立的憑證會套用至指定的網域。注意:負載平衡器只能建立兩個憑證。aws lightsail create-load-balancer-tls-certificate \ --certificate-alternative-names
abc.example.com
\ --certificate-domain-nameexample.com
\ --certificate-nameMySecondCertificate
\ --load-balancer-nameMyFirstLoadBalancer
輸出:
{ "operations": [ { "id": "be663aed-cb46-41e2-9b23-e2f747245bd4", "resourceName": "MySecondCertificate", "resourceType": "LoadBalancerTlsCertificate", "createdAt": 1569867364.971, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MyFirstLoadBalancer", "operationType": "CreateLoadBalancerTlsCertificate", "status": "Succeeded", "statusChangedAt": 1569867365.219 }, { "id": "f3dfa930-969e-41cc-ac7d-337178716f6d", "resourceName": "MyFirstLoadBalancer", "resourceType": "LoadBalancer", "createdAt": 1569867364.971, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MySecondCertificate", "operationType": "CreateLoadBalancerTlsCertificate", "status": "Succeeded", "statusChangedAt": 1569867365.219 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateLoadBalancerTlsCertificate
。
-
下列程式碼範例示範如何使用 create-load-balancer
。
- AWS CLI
-
建立負載平衡器
下列
create-load-balancer
範例會使用 TLS 憑證建立負載平衡器。TLS 憑證會套用至指定的網域,並將流量路由至連接埠 80 上的執行個體。aws lightsail create-load-balancer \ --certificate-alternative-names
www.example.com
test.example.com
\ --certificate-domain-nameexample.com
\ --certificate-nameCertificate-1
\ --instance-port80
\ --load-balancer-nameLoadBalancer-1
輸出:
{ "operations": [ { "id": "cc7b920a-83d8-4762-a74e-9174fe1540be", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1569867169.406, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateLoadBalancer", "status": "Started", "statusChangedAt": 1569867169.406 }, { "id": "658ed43b-f729-42f3-a8e4-3f8024d3c98d", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancerTlsCertificate", "createdAt": 1569867170.193, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "LoadBalancer-1", "operationType": "CreateLoadBalancerTlsCertificate", "status": "Succeeded", "statusChangedAt": 1569867170.54 }, { "id": "4757a342-5181-4870-b1e0-227eebc35ab5", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1569867170.193, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "Certificate-1", "operationType": "CreateLoadBalancerTlsCertificate", "status": "Succeeded", "statusChangedAt": 1569867170.54 } ] }
如需詳細資訊,請參閱 Lightsail 開發人員指南中的 Lightsail 負載平衡器
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateLoadBalancer
。
-
下列程式碼範例示範如何使用 create-relational-database-from-snapshot
。
- AWS CLI
-
從快照建立受管資料庫
下列
create-relational-database-from-snapshot
範例使用 $15 USD 標準資料庫套件,從指定 AWS 區域和可用區域中的指定快照建立受管資料庫。注意:您指定的套件在規格中必須等於或大於用於建立快照的原始來源資料庫套件。aws lightsail create-relational-database-from-snapshot \ --relational-database-snapshot-name
Database-Oregon-1-1566839359
\ --relational-database-nameDatabase-1
\ --availability-zoneus-west-2a
\ --relational-database-bundle-idmicro_1_0
\ --no-publicly-accessible輸出:
{ "operations": [ { "id": "ad6d9193-9d5c-4ea1-97ae-8fe6de600b4c", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1569867916.938, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateRelationalDatabaseFromSnapshot", "status": "Started", "statusChangedAt": 1569867918.643 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateRelationalDatabaseFromSnapshot
。
-
下列程式碼範例示範如何使用 create-relational-database-snapshot
。
- AWS CLI
-
建立受管資料庫的快照
下列
create-relational-database-snapshot
範例會建立指定受管資料庫的快照。aws lightsail create-relational-database-snapshot \ --relational-database-name
Database1
\ --relational-database-snapshot-nameRelationalDatabaseSnapshot1
輸出:
{ "operations": [ { "id": "853667fb-ea91-4c02-8d20-8fc5fd43b9eb", "resourceName": "RelationalDatabaseSnapshot1", "resourceType": "RelationalDatabaseSnapshot", "createdAt": 1569868074.645, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "Database1", "operationType": "CreateRelationalDatabaseSnapshot", "status": "Started", "statusChangedAt": 1569868074.645 }, { "id": "fbafa521-3cac-4be8-9773-1c143780b239", "resourceName": "Database1", "resourceType": "RelationalDatabase", "createdAt": 1569868074.645, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "RelationalDatabaseSnapshot1", "operationType": "CreateRelationalDatabaseSnapshot", "status": "Started", "statusChangedAt": 1569868074.645 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateRelationalDatabaseSnapshot
。
-
下列程式碼範例示範如何使用 create-relational-database
。
- AWS CLI
-
建立受管資料庫
下列
create-relational-database
範例使用 MySQL 5.6 資料庫引擎 (mysql_5_6) 和 $15 USD 標準資料庫套件 (micro_1_0),在指定的 AWS 區域和可用區域中建立受管資料庫。受管資料庫會預先填入主要使用者名稱,且無法公開存取。aws lightsail create-relational-database \ --relational-database-name
Database-1
\ --availability-zoneus-west-2a
\ --relational-database-blueprint-idmysql_5_6
\ --relational-database-bundle-idmicro_1_0
\ --master-database-namedbmaster
\ --master-user
name user \ --no-publicly-accessible輸出:
{ "operations": [ { "id": "b52bedee-73ed-4798-8d2a-9c12df89adcd", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1569450017.244, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "CreateRelationalDatabase", "status": "Started", "statusChangedAt": 1569450018.637 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 CreateRelationalDatabase
。
-
下列程式碼範例示範如何使用 delete-auto-snapshot
。
- AWS CLI
-
若要刪除自動快照
下列
delete-auto-snapshot
範例會刪除執行個體2019-10-10
的自動快照WordPress-1
。aws lightsail delete-auto-snapshot \ --resource-name
WordPress-1
\ --date2019-10-10
輸出:
{ "operations": [ { "id": "31c36e09-3d52-46d5-b6d8-7EXAMPLE534a", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1571088141.501, "location": { "availabilityZone": "us-west-2", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "DeleteAutoSnapshot-2019-10-10", "operationType": "DeleteAutoSnapshot", "status": "Succeeded" } ] }
如需詳細資訊,請參閱 Lightsail 開發指南中的刪除 Amazon Lightsail 中執行個體或磁碟的自動快照
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteAutoSnapshot
。
-
下列程式碼範例示範如何使用 delete-disk-snapshot
。
- AWS CLI
-
刪除區塊儲存磁碟的快照
下列
delete-disk-snapshot
範例會刪除區塊儲存磁碟的指定快照aws lightsail delete-disk-snapshot \ --disk-snapshot-name
DiskSnapshot-1
輸出:
{ "operations": [ { "id": "d1e5766d-b81e-4595-ad5d-02afbccfcd5d", "resourceName": "DiskSnapshot-1", "resourceType": "DiskSnapshot", "createdAt": 1569873552.79, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteDiskSnapshot", "status": "Succeeded", "statusChangedAt": 1569873552.79 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteDiskSnapshot
。
-
下列程式碼範例示範如何使用 delete-disk
。
- AWS CLI
-
若要刪除區塊儲存磁碟
下列
delete-disk
範例會刪除指定的區塊儲存磁碟。aws lightsail delete-disk \ --disk-name
Disk-1
輸出:
{ "operations": [ { "id": "6378c70f-4d75-4f7a-ab66-730fca0bb2fc", "resourceName": "Disk-1", "resourceType": "Disk", "createdAt": 1569872887.864, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteDisk", "status": "Succeeded", "statusChangedAt": 1569872887.864 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteDisk
。
-
下列程式碼範例示範如何使用 delete-domain-entry
。
- AWS CLI
-
若要刪除網域項目 (DNS 記錄)
下列
delete-domain-entry
範例會從現有網域刪除指定的網域項目。注意:Lightsail 的網域相關 API 操作僅適用於
us-east-1
區域。如果您的 CLI 設定檔設定為使用不同的區域,您必須包含--region us-east-1
參數或命令失敗。aws lightsail delete-domain-entry \ --region
us-east-1
\ --domain-nameexample.com
\ --domain-entryname=123.example.com,target=192.0.2.0,type=A
輸出:
{ "operation": { "id": "06eacd01-d785-420e-8daa-823150c7dca1", "resourceName": "example.com ", "resourceType": "Domain", "createdAt": 1569874157.005, "location": { "availabilityZone": "all", "regionName": "global" }, "isTerminal": true, "operationType": "DeleteDomainEntry", "status": "Succeeded", "statusChangedAt": 1569874157.005 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteDomainEntry
。
-
下列程式碼範例示範如何使用 delete-domain
。
- AWS CLI
-
刪除網域 (DNS 區域)
下列
delete-domain
範例會刪除指定的網域和網域中的所有項目 (DNS 記錄)。注意:Lightsail 的網域相關 API 操作僅適用於
us-east-1
區域。如果您的 CLI 設定檔設定為使用不同的區域,您必須包含--region us-east-1
參數或命令失敗。aws lightsail delete-domain \ --region
us-east-1
\ --domain-nameexample.com
輸出:
{ "operation": { "id": "fcef5265-5af1-4a46-a3d7-90b5e18b9b32", "resourceName": "example.com", "resourceType": "Domain", "createdAt": 1569873788.13, "location": { "availabilityZone": "all", "regionName": "global" }, "isTerminal": true, "operationType": "DeleteDomain", "status": "Succeeded", "statusChangedAt": 1569873788.13 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteDomain
。
-
下列程式碼範例示範如何使用 delete-instance-snapshot
。
- AWS CLI
-
標題
下列
delete-instance-snapshot
範例會刪除執行個體的指定快照。aws lightsail delete-instance-snapshot \ --instance-snapshot-name
WordPress-1-Snapshot-1
輸出:
{ "operations": [ { "id": "14dad182-976a-46c6-bfd4-9480482bf0ea", "resourceName": "WordPress-1-Snapshot-1", "resourceType": "InstanceSnapshot", "createdAt": 1569874524.562, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteInstanceSnapshot", "status": "Succeeded", "statusChangedAt": 1569874524.562 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteInstanceSnapshot
。
-
下列程式碼範例示範如何使用 delete-instance
。
- AWS CLI
-
若要刪除執行個體
下列
delete-instance
範例會刪除指定的執行個體。aws lightsail delete-instance \ --instance-name
WordPress-1
輸出:
{ "operations": [ { "id": "d77345a3-8f80-4d2e-b47d-aaa622718df2", "resourceName": "Disk-1", "resourceType": "Disk", "createdAt": 1569874357.469, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "WordPress-1", "operationType": "DetachDisk", "status": "Started", "statusChangedAt": 1569874357.469 }, { "id": "708fa606-2bfd-4e48-a2c1-0b856585b5b1", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1569874357.465, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "Disk-1", "operationType": "DetachDisk", "status": "Started", "statusChangedAt": 1569874357.465 }, { "id": "3187e823-8acb-405d-b098-fad5ceb17bec", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1569874357.829, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteInstance", "status": "Succeeded", "statusChangedAt": 1569874357.829 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteInstance
。
-
下列程式碼範例示範如何使用 delete-key-pair
。
- AWS CLI
-
刪除金鑰對
下列
delete-key-pair
範例會刪除指定的金鑰對。aws lightsail delete-key-pair \ --key-pair-name
MyPersonalKeyPair
輸出:
{ "operation": { "id": "81621463-df38-4810-b866-6e801a15abbf", "resourceName": "MyPersonalKeyPair", "resourceType": "KeyPair", "createdAt": 1569874626.466, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteKeyPair", "status": "Succeeded", "statusChangedAt": 1569874626.685 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteKeyPair
。
-
下列程式碼範例示範如何使用 delete-known-host-keys
。
- AWS CLI
-
從執行個體中刪除已知主機金鑰
下列
delete-known-host-keys
範例會從指定的執行個體刪除已知的主機金鑰。aws lightsail delete-known-host-keys \ --instance-name
Instance-1
輸出:
{ "operations": [ { "id": "c61afe9c-45a4-41e6-a97e-d212364da3f5", "resourceName": "Instance-1", "resourceType": "Instance", "createdAt": 1569874760.201, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteKnownHostKeys", "status": "Succeeded", "statusChangedAt": 1569874760.201 } ] }
如需詳細資訊,請參閱 Lightsail 開發指南中的對 Amazon Lightsail 瀏覽器型 SSH 或 RDP 用戶端的連線問題進行故障診斷
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteKnownHostKeys
。
-
下列程式碼範例示範如何使用 delete-load-balancer-tls-certificate
。
- AWS CLI
-
刪除負載平衡器的 TLS 憑證
下列
delete-load-balancer-tls-certificate
範例會從指定的負載平衡器刪除指定 TLS 憑證。aws lightsail delete-load-balancer-tls-certificate \ --load-balancer-name
MyFirstLoadBalancer
\ --certificate-nameMyFirstCertificate
輸出:
{ "operations": [ { "id": "50bec274-e45e-4caa-8a69-b763ef636583", "resourceName": "MyFirstCertificate", "resourceType": "LoadBalancerTlsCertificate", "createdAt": 1569874989.48, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "DeleteLoadBalancerTlsCertificate", "status": "Started", "statusChangedAt": 1569874989.48 }, { "id": "78c58cdc-a59a-4b27-8213-500638634a8f", "resourceName": "MyFirstLoadBalancer", "resourceType": "LoadBalancer", "createdAt": 1569874989.48, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "DeleteLoadBalancerTlsCertificate", "status": "Started", "statusChangedAt": 1569874989.48 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteLoadBalancerTlsCertificate
。
-
下列程式碼範例示範如何使用 delete-load-balancer
。
- AWS CLI
-
若要刪除負載平衡器
下列
delete-load-balancer
範例會刪除指定的負載平衡器和任何相關聯的 TLS 憑證。aws lightsail delete-load-balancer \ --load-balancer-name
MyFirstLoadBalancer
輸出:
{ "operations": [ { "id": "a8c968c7-72a3-4680-a714-af8f03eea535", "resourceName": "MyFirstLoadBalancer", "resourceType": "LoadBalancer", "createdAt": 1569875092.125, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteLoadBalancer", "status": "Succeeded", "statusChangedAt": 1569875092.125 }, { "id": "f91a29fc-8ce3-4e69-a227-ea70ca890bf5", "resourceName": "MySecondCertificate", "resourceType": "LoadBalancerTlsCertificate", "createdAt": 1569875091.938, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "DeleteLoadBalancerTlsCertificate", "status": "Started", "statusChangedAt": 1569875091.938 }, { "id": "cf64c060-154b-4eb4-ba57-84e2e41563d6", "resourceName": "MyFirstLoadBalancer", "resourceType": "LoadBalancer", "createdAt": 1569875091.94, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "DeleteLoadBalancerTlsCertificate", "status": "Started", "statusChangedAt": 1569875091.94 } ] }
如需詳細資訊,請參閱 指南中的標題。
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteLoadBalancer
。
-
下列程式碼範例示範如何使用 delete-relational-database-snapshot
。
- AWS CLI
-
刪除受管資料庫的快照
下列
delete-relational-database-snapshot
範例會刪除受管資料庫的指定快照。aws lightsail delete-relational-database-snapshot \ --relational-database-snapshot-name
Database-Oregon-1-1566839359
輸出:
{ "operations": [ { "id": "b99acae8-735b-4823-922f-30af580e3729", "resourceName": "Database-Oregon-1-1566839359", "resourceType": "RelationalDatabaseSnapshot", "createdAt": 1569875293.58, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "DeleteRelationalDatabaseSnapshot", "status": "Succeeded", "statusChangedAt": 1569875293.58 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteRelationalDatabaseSnapshot
。
-
下列程式碼範例示範如何使用 delete-relational-database
。
- AWS CLI
-
若要刪除受管資料庫
下列
delete-relational-database
範例會刪除指定的受管資料庫。aws lightsail delete-relational-database \ --relational-database-name
Database-1
輸出:
{ "operations": [ { "id": "3b0c41c1-053d-46f0-92a3-14f76141dc86", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1569875210.999, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "DeleteRelationalDatabase", "status": "Started", "statusChangedAt": 1569875210.999 }, { "id": "01ddeae8-a87a-4a4b-a1f3-092c71bf9180", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1569875211.029, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "Database-1-FinalSnapshot-1569875210793", "operationType": "CreateRelationalDatabaseSnapshot", "status": "Started", "statusChangedAt": 1569875211.029 }, { "id": "74d73681-30e8-4532-974e-1f23cd3f9f73", "resourceName": "Database-1-FinalSnapshot-1569875210793", "resourceType": "RelationalDatabaseSnapshot", "createdAt": 1569875211.029, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "Database-1", "operationType": "CreateRelationalDatabaseSnapshot", "status": "Started", "statusChangedAt": 1569875211.029 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteRelationalDatabase
。
-
下列程式碼範例示範如何使用 detach-static-ip
。
- AWS CLI
-
從執行個體分離靜態 IP
下列
detach-static-ip
範例會將靜態 IPStaticIp-1
與任何連接的執行個體分離。aws lightsail detach-static-ip \ --static-ip-name
StaticIp-1
輸出:
{ "operations": [ { "id": "2a43d8a3-9f2d-4fe7-bdd0-eEXAMPLE3cf3", "resourceName": "StaticIp-1", "resourceType": "StaticIp", "createdAt": 1571088261.999, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MEAN-1", "operationType": "DetachStaticIp", "status": "Succeeded", "statusChangedAt": 1571088261.999 }, { "id": "41a7d40c-74e8-4d2e-a837-cEXAMPLEf747", "resourceName": "MEAN-1", "resourceType": "Instance", "createdAt": 1571088262.022, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "StaticIp-1", "operationType": "DetachStaticIp", "status": "Succeeded", "statusChangedAt": 1571088262.022 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DetachStaticIp
。
-
下列程式碼範例示範如何使用 get-active-names
。
- AWS CLI
-
若要取得作用中資源名稱
下列
get-active-names
範例會傳回已設定 AWS 區域中的作用中資源名稱。aws lightsail get-active-names
輸出:
{ "activeNames": [ "WordPress-1", "StaticIp-1", "MEAN-1", "Plesk_Hosting_Stack_on_Ubuntu-1" ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetActiveNames
。
-
下列程式碼範例示範如何使用 get-auto-snapshots
。
- AWS CLI
-
取得執行個體可用的自動快照
下列
get-auto-snapshots
範例會傳回執行個體 可用的自動快照WordPress-1
。aws lightsail get-auto-snapshots \ --resource-name
WordPress-1
輸出:
{ "resourceName": "WordPress-1", "resourceType": "Instance", "autoSnapshots": [ { "date": "2019-10-14", "createdAt": 1571033872.0, "status": "Success", "fromAttachedDisks": [] }, { "date": "2019-10-13", "createdAt": 1570947473.0, "status": "Success", "fromAttachedDisks": [] }, { "date": "2019-10-12", "createdAt": 1570861072.0, "status": "Success", "fromAttachedDisks": [] }, { "date": "2019-10-11", "createdAt": 1570774672.0, "status": "Success", "fromAttachedDisks": [] } ] }
如需詳細資訊,請參閱 Lightsail 開發指南中的在 Amazon Lightsail 中保留執行個體或磁碟的自動快照
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetAutoSnapshots
。
-
下列程式碼範例示範如何使用 get-blueprints
。
- AWS CLI
-
取得新執行個體的藍圖
下列
get-blueprints
範例顯示可用於在 Amazon Lightsail 中建立新執行個體的所有可用藍圖的詳細資訊。aws lightsail get-blueprints
輸出:
{ "blueprints": [ { "blueprintId": "wordpress", "name": "WordPress", "group": "wordpress", "type": "app", "description": "Bitnami, the leaders in application packaging, and Automattic, the experts behind WordPress, have teamed up to offer this official WordPress image. This image is a pre-configured, ready-to-run image for running WordPress on Amazon Lightsail. WordPress is the world's most popular content management platform. Whether it's for an enterprise or small business website, or a personal or corporate blog, content authors can easily create content using its new Gutenberg editor, and developers can extend the base platform with additional features. Popular plugins like Jetpack, Akismet, All in One SEO Pack, WP Mail, Google Analytics for WordPress, and Amazon Polly are all pre-installed in this image. Let's Encrypt SSL certificates are supported through an auto-configuration script.", "isActive": true, "minPower": 0, "version": "6.5.3-0", "versionCode": "1", "productUrl": "https://aws.amazon.com/marketplace/pp/B00NN8Y43U", "licenseUrl": "https://aws.amazon.com/marketplace/pp/B00NN8Y43U#pdp-usage", "platform": "LINUX_UNIX" }, { "blueprintId": "lamp_8_bitnami", "name": "LAMP (PHP 8)", "group": "lamp_8", "type": "app", "description": "LAMP with PHP 8.X packaged by Bitnami enables you to quickly start building your websites and applications by providing a coding framework. As a developer, it provides standalone project directories to store your applications. This blueprint is configured for production environments. It includes SSL auto-configuration with Let's Encrypt certificates, and the latest releases of PHP, Apache, and MariaDB on Linux. This application also includes phpMyAdmin, PHP main modules and Composer.", "isActive": true, "minPower": 0, "version": "8.2.18-4", "versionCode": "1", "productUrl": "https://aws.amazon.com/marketplace/pp/prodview-6g3gzfcih6dvu", "licenseUrl": "https://aws.amazon.com/marketplace/pp/prodview-6g3gzfcih6dvu#pdp-usage", "platform": "LINUX_UNIX" }, { "blueprintId": "nodejs", "name": "Node.js", "group": "node", "type": "app", "description": "Node.js packaged by Bitnami is a pre-configured, ready to run image for Node.js on Amazon EC2. It includes the latest version of Node.js, Apache, Python and Redis. The image supports multiple Node.js applications, each with its own virtual host and project directory. It is configured for production use and is secure by default, as all ports except HTTP, HTTPS and SSH ports are closed. Let's Encrypt SSL certificates are supported through an auto-configuration script. Developers benefit from instant access to a secure, update and consistent Node.js environment without having to manually install and configure multiple components and libraries.", "isActive": true, "minPower": 0, "version": "18.20.2-0", "versionCode": "1", "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZUAKO", "licenseUrl": "https://aws.amazon.com/marketplace/pp/B00NNZUAKO#pdp-usage", "platform": "LINUX_UNIX" }, ... } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetBlueprints
。
-
下列程式碼範例示範如何使用 get-bundles
。
- AWS CLI
-
取得新執行個體的套件
下列
get-bundles
範例顯示可用於在 Amazon Lightsail 中建立新執行個體的所有可用套件的詳細資訊。aws lightsail get-bundles
輸出:
{ "bundles": [ { "price": 5.0, "cpuCount": 2, "diskSizeInGb": 20, "bundleId": "nano_3_0", "instanceType": "nano", "isActive": true, "name": "Nano", "power": 298, "ramSizeInGb": 0.5, "transferPerMonthInGb": 1024, "supportedPlatforms": [ "LINUX_UNIX" ] }, { "price": 7.0, "cpuCount": 2, "diskSizeInGb": 40, "bundleId": "micro_3_0", "instanceType": "micro", "isActive": true, "name": "Micro", "power": 500, "ramSizeInGb": 1.0, "transferPerMonthInGb": 2048, "supportedPlatforms": [ "LINUX_UNIX" ] }, { "price": 12.0, "cpuCount": 2, "diskSizeInGb": 60, "bundleId": "small_3_0", "instanceType": "small", "isActive": true, "name": "Small", "power": 1000, "ramSizeInGb": 2.0, "transferPerMonthInGb": 3072, "supportedPlatforms": [ "LINUX_UNIX" ] }, ... } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetBundles
。
-
下列程式碼範例示範如何使用 get-cloud-formation-stack-records
。
- AWS CLI
-
若要取得 CloudFormation 堆疊記錄及其相關聯的堆疊
下列
get-cloud-formation-stack-records
範例顯示Word CloudFormation 堆疊記錄及其相關堆疊的詳細資訊,這些堆疊用於從匯出的 Amazon Lightsail 快照建立 Amazon EC2 資源。aws lightsail get-cloud-formation-stack-records
輸出:
{ "cloudFormationStackRecords": [ { "name": "CloudFormationStackRecord-588a4243-e2d1-490d-8200-3a7513ecebdf", "arn": "arn:aws:lightsail:us-west-2:111122223333:CloudFormationStackRecord/28d646ab-27bc-48d9-a422-1EXAMPLE6d37", "createdAt": 1565301666.586, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "CloudFormationStackRecord", "state": "Succeeded", "sourceInfo": [ { "resourceType": "ExportSnapshotRecord", "name": "ExportSnapshotRecord-e02f23d7-0453-4aa9-9c95-91aa01a141dd", "arn": "arn:aws:lightsail:us-west-2:111122223333:ExportSnapshotRecord/f12b8792-f3ea-4d6f-b547-2EXAMPLE8796" } ], "destinationInfo": { "id": "arn:aws:cloudformation:us-west-2:111122223333:stack/Lightsail-Stack-588a4243-e2d1-490d-8200-3EXAMPLEebdf/063203b0-ba28-11e9-838b-0EXAMPLE8b00", "service": "Aws::CloudFormation::Stack" } } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetCloudFormationStackRecords
。
-
下列程式碼範例示範如何使用 get-disk-snapshot
。
- AWS CLI
-
取得磁碟快照的相關資訊
下列
get-disk-snapshot
範例顯示磁碟快照 的詳細資訊Disk-1-1566839161
。aws lightsail get-disk-snapshot \ --disk-snapshot-name
Disk-1-1566839161
輸出:
{ "diskSnapshot": { "name": "Disk-1-1566839161", "arn": "arn:aws:lightsail:us-west-2:111122223333:DiskSnapshot/e2d0fa53-8ee0-41a0-8e56-0EXAMPLE1051", "supportCode": "6EXAMPLE3362/snap-0EXAMPLE06100d09", "createdAt": 1566839163.749, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "DiskSnapshot", "tags": [], "sizeInGb": 8, "state": "completed", "progress": "100%", "fromDiskName": "Disk-1", "fromDiskArn": "arn:aws:lightsail:us-west-2:111122223333:Disk/c21cfb0a-07f2-44ae-9a23-bEXAMPLE8096", "isFromAutoSnapshot": false } }
如需詳細資訊,請參閱 指南中的標題。
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetDiskSnapshot
。
-
下列程式碼範例示範如何使用 get-disk-snapshots
。
- AWS CLI
-
取得所有磁碟快照的相關資訊
下列
get-disk-snapshots
範例顯示已設定 AWS 區域中所有磁碟快照的詳細資訊。aws lightsail get-disk-snapshots
輸出:
{ "diskSnapshots": [ { "name": "Disk-2-1571090588", "arn": "arn:aws:lightsail:us-west-2:111122223333:DiskSnapshot/32e889a9-38d4-4687-9f21-eEXAMPLE7839", "supportCode": "6EXAMPLE3362/snap-0EXAMPLE1ca192a4", "createdAt": 1571090591.226, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "DiskSnapshot", "tags": [], "sizeInGb": 8, "state": "completed", "progress": "100%", "fromDiskName": "Disk-2", "fromDiskArn": "arn:aws:lightsail:us-west-2:111122223333:Disk/6a343ff8-6341-422d-86e2-bEXAMPLE16c2", "isFromAutoSnapshot": false }, { "name": "Disk-1-1566839161", "arn": "arn:aws:lightsail:us-west-2:111122223333:DiskSnapshot/e2d0fa53-8ee0-41a0-8e56-0EXAMPLE1051", "supportCode": "6EXAMPLE3362/snap-0EXAMPLEe06100d09", "createdAt": 1566839163.749, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "DiskSnapshot", "tags": [], "sizeInGb": 8, "state": "completed", "progress": "100%", "fromDiskName": "Disk-1", "fromDiskArn": "arn:aws:lightsail:us-west-2:111122223333:Disk/c21cfb0a-07f2-44ae-9a23-bEXAMPLE8096", "isFromAutoSnapshot": false } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetDiskSnapshots
。
-
下列程式碼範例示範如何使用 get-disk
。
- AWS CLI
-
取得區塊儲存磁碟的相關資訊
下列
get-disk
範例顯示磁碟 的詳細資訊Disk-1
。aws lightsail get-disk \ --disk-name
Disk-1
輸出:
{ "disk": { "name": "Disk-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:Disk/c21cfb0a-07f2-44ae-9a23-bEXAMPLE8096", "supportCode": "6EXAMPLE3362/vol-0EXAMPLEf2f88b32f", "createdAt": 1566585439.587, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Disk", "tags": [], "sizeInGb": 8, "isSystemDisk": false, "iops": 100, "path": "/dev/xvdf", "state": "in-use", "attachedTo": "WordPress_Multisite-1", "isAttached": true, "attachmentState": "attached" } }
如需詳細資訊,請參閱 指南中的標題。
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetDisk
。
-
下列程式碼範例示範如何使用 get-disks
。
- AWS CLI
-
取得所有區塊儲存磁碟的相關資訊
下列
get-disks
範例顯示已設定 AWS 區域中所有磁碟的詳細資訊。aws lightsail get-disks
輸出:
{ "disks": [ { "name": "Disk-2", "arn": "arn:aws:lightsail:us-west-2:111122223333:Disk/6a343ff8-6341-422d-86e2-bEXAMPLE16c2", "supportCode": "6EXAMPLE3362/vol-0EXAMPLE929602087", "createdAt": 1571090461.634, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Disk", "tags": [], "sizeInGb": 8, "isSystemDisk": false, "iops": 100, "state": "available", "isAttached": false, "attachmentState": "detached" }, { "name": "Disk-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:Disk/c21cfb0a-07f2-44ae-9a23-bEXAMPLE8096", "supportCode": "6EXAMPLE3362/vol-0EXAMPLEf2f88b32f", "createdAt": 1566585439.587, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Disk", "tags": [], "sizeInGb": 8, "isSystemDisk": false, "iops": 100, "path": "/dev/xvdf", "state": "in-use", "attachedTo": "WordPress_Multisite-1", "isAttached": true, "attachmentState": "attached" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetDisks
。
-
下列程式碼範例示範如何使用 get-domain
。
- AWS CLI
-
取得網域的相關資訊
下列
get-domain
範例顯示網域 的詳細資訊example.com
。注意:Lightsail 的網域相關 API 操作僅適用於
us-east-1
AWS 區域。如果您的 CLI 設定檔設定為使用不同的區域,您必須包含 `` --region us-east-1`` 參數,否則命令會失敗。aws lightsail get-domain \ --domain-name
example.com
\ --regionus-east-1
輸出:
{ "domain": { "name": "example.com", "arn": "arn:aws:lightsail:global:111122223333:Domain/28cda903-3f15-44b2-9baf-3EXAMPLEb304", "supportCode": "6EXAMPLE3362//hostedzone/ZEXAMPLEONGSC1", "createdAt": 1570728588.6, "location": { "availabilityZone": "all", "regionName": "global" }, "resourceType": "Domain", "tags": [], "domainEntries": [ { "id": "-1682899164", "name": "example.com", "target": "192.0.2.0", "isAlias": false, "type": "A" }, { "id": "1703104243", "name": "example.com", "target": "ns-137.awsdns-17.com", "isAlias": false, "type": "NS" }, { "id": "-1038331153", "name": "example.com", "target": "ns-1710.awsdns-21.co.uk", "isAlias": false, "type": "NS" }, { "id": "-2107289565", "name": "example.com", "target": "ns-692.awsdns-22.net", "isAlias": false, "type": "NS" }, { "id": "1582095705", "name": "example.com", "target": "ns-1436.awsdns-51.org", "isAlias": false, "type": "NS" }, { "id": "-1769796132", "name": "example.com", "target": "ns-1710.awsdns-21.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400", "isAlias": false, "type": "SOA" } ] } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetDomain
。
-
下列程式碼範例示範如何使用 get-domains
。
- AWS CLI
-
取得所有網域的相關資訊
下列
get-domains
範例顯示已設定 AWS 區域中所有網域的詳細資訊。注意:Lightsail 的網域相關 API 操作僅適用於
us-east-1
AWS 區域。如果您的 CLI 設定檔設定為使用不同的區域,您必須包含--region us-east-1
參數或命令失敗。aws lightsail get-domains \ --region
us-east-1
輸出:
{ "domains": [ { "name": "example.com", "arn": "arn:aws:lightsail:global:111122223333:Domain/28cda903-3f15-44b2-9baf-3EXAMPLEb304", "supportCode": "6EXAMPLE3362//hostedzone/ZEXAMPLEONGSC1", "createdAt": 1570728588.6, "location": { "availabilityZone": "all", "regionName": "global" }, "resourceType": "Domain", "tags": [], "domainEntries": [ { "id": "-1682899164", "name": "example.com", "target": "192.0.2.0", "isAlias": false, "type": "A" }, { "id": "1703104243", "name": "example.com", "target": "ns-137.awsdns-17.com", "isAlias": false, "type": "NS" }, { "id": "-1038331153", "name": "example.com", "target": "ns-4567.awsdns-21.co.uk", "isAlias": false, "type": "NS" }, { "id": "-2107289565", "name": "example.com", "target": "ns-333.awsdns-22.net", "isAlias": false, "type": "NS" }, { "id": "1582095705", "name": "example.com", "target": "ns-1111.awsdns-51.org", "isAlias": false, "type": "NS" }, { "id": "-1769796132", "name": "example.com", "target": "ns-1234.awsdns-21.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400", "isAlias": false, "type": "SOA" }, { "id": "1029454894", "name": "_dead6a124ede046a0319eb44a4eb3cbc.example.com", "target": "_be133b0a0899fb7b6bf79d9741d1a383.hkvuiqjoua.acm-validations.aws", "isAlias": false, "type": "CNAME" } ] }, { "name": "example.net", "arn": "arn:aws:lightsail:global:111122223333:Domain/9c9f0d70-c92e-4753-86c2-6EXAMPLE029d", "supportCode": "6EXAMPLE3362//hostedzone/ZEXAMPLE5TPKMV", "createdAt": 1556661071.384, "location": { "availabilityZone": "all", "regionName": "global" }, "resourceType": "Domain", "tags": [], "domainEntries": [ { "id": "-766320943", "name": "example.net", "target": "192.0.2.2", "isAlias": false, "type": "A" }, { "id": "-453913825", "name": "example.net", "target": "ns-123.awsdns-10.net", "isAlias": false, "type": "NS" }, { "id": "1553601564", "name": "example.net", "target": "ns-4444.awsdns-47.co.uk", "isAlias": false, "type": "NS" }, { "id": "1653797661", "name": "example.net", "target": "ns-7890.awsdns-61.org", "isAlias": false, "type": "NS" }, { "id": "706414698", "name": "example.net", "target": "ns-123.awsdns-44.com", "isAlias": false, "type": "NS" }, { "id": "337271745", "name": "example.net", "target": "ns-4444.awsdns-47.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400", "isAlias": false, "type": "SOA" }, { "id": "-1785431096", "name": "www.example.net", "target": "192.0.2.2", "isAlias": false, "type": "A" } ] }, { "name": "example.org", "arn": "arn:aws:lightsail:global:111122223333:Domain/f0f13ba3-3df0-4fdc-8ebb-1EXAMPLEf26e", "supportCode": "6EXAMPLE3362//hostedzone/ZEXAMPLEAFO38", "createdAt": 1556661199.106, "location": { "availabilityZone": "all", "regionName": "global" }, "resourceType": "Domain", "tags": [], "domainEntries": [ { "id": "2065301345", "name": "example.org", "target": "192.0.2.4", "isAlias": false, "type": "A" }, { "id": "-447198516", "name": "example.org", "target": "ns-123.awsdns-45.com", "isAlias": false, "type": "NS" }, { "id": "136463022", "name": "example.org", "target": "ns-9999.awsdns-15.co.uk", "isAlias": false, "type": "NS" }, { "id": "1395941679", "name": "example.org", "target": "ns-555.awsdns-01.net", "isAlias": false, "type": "NS" }, { "id": "872052569", "name": "example.org", "target": "ns-6543.awsdns-38.org", "isAlias": false, "type": "NS" }, { "id": "1001949377", "name": "example.org", "target": "ns-1234.awsdns-15.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400", "isAlias": false, "type": "SOA" }, { "id": "1046191192", "name": "www.example.org", "target": "192.0.2.4", "isAlias": false, "type": "A" } ] } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetDomains
。
-
下列程式碼範例示範如何使用 get-export-snapshot-record
。
- AWS CLI
-
取得匯出至 Amazon EC2 的快照記錄
下列
get-export-snapshot-record
範例顯示匯出至 Amazon Word 的 Amazon Lightsail 執行個體或磁碟快照的詳細資訊。 EC2aws lightsail get-export-snapshot-records
輸出:
{ "exportSnapshotRecords": [ { "name": "ExportSnapshotRecord-d2da10ce-0b3c-4ae1-ab3a-2EXAMPLEa586", "arn": "arn:aws:lightsail:us-west-2:111122223333:ExportSnapshotRecord/076c7060-b0cc-4162-98f0-2EXAMPLEe28e", "createdAt": 1543534665.678, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "ExportSnapshotRecord", "state": "Succeeded", "sourceInfo": { "resourceType": "InstanceSnapshot", "createdAt": 1540339310.706, "name": "WordPress-512MB-Oregon-1-1540339219", "arn": "arn:aws:lightsail:us-west-2:111122223333:InstanceSnapshot/5446f534-ed60-4c17-b4a5-bEXAMPLEf8b7", "fromResourceName": "WordPress-512MB-Oregon-1", "fromResourceArn": "arn:aws:lightsail:us-west-2:111122223333:Instance/4b8f1f24-e4d1-4cf3-88ff-cEXAMPLEa397", "instanceSnapshotInfo": { "fromBundleId": "nano_2_0", "fromBlueprintId": "wordpress_4_9_8", "fromDiskInfo": [ { "path": "/dev/sda1", "sizeInGb": 20, "isSystemDisk": true } ] } }, "destinationInfo": { "id": "ami-0EXAMPLEc0d65058e", "service": "Aws::EC2::Image" } }, { "name": "ExportSnapshotRecord-1c94e884-40ff-4fe1-9302-0EXAMPLE14c2", "arn": "arn:aws:lightsail:us-west-2:111122223333:ExportSnapshotRecord/fb392ce8-6567-4013-9bfd-3EXAMPLE5b4c", "createdAt": 1543432110.2, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "ExportSnapshotRecord", "state": "Succeeded", "sourceInfo": { "resourceType": "InstanceSnapshot", "createdAt": 1540833603.545, "name": "LAMP_PHP_5-512MB-Oregon-1-1540833565", "arn": "arn:aws:lightsail:us-west-2:111122223333:InstanceSnapshot/82334399-b5f2-49ec-8382-0EXAMPLEe45f", "fromResourceName": "LAMP_PHP_5-512MB-Oregon-1", "fromResourceArn": "arn:aws:lightsail:us-west-2:111122223333:Instance/863b9f35-ab1e-4418-bdd2-1EXAMPLEbab2", "instanceSnapshotInfo": { "fromBundleId": "nano_2_0", "fromBlueprintId": "lamp_5_6_37_2", "fromDiskInfo": [ { "path": "/dev/sda1", "sizeInGb": 20, "isSystemDisk": true } ] } }, "destinationInfo": { "id": "ami-0EXAMPLE7c5ec84e2", "service": "Aws::EC2::Image" } } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetExportSnapshotRecord
。
-
下列程式碼範例示範如何使用 get-instance-access-details
。
- AWS CLI
-
取得執行個體的主機金鑰資訊
下列
get-instance-access-details
範例顯示執行個體 的主機金鑰資訊WordPress_Multisite-1
。aws lightsail get-instance-access-details \ --instance-name
WordPress_Multisite-1
輸出:
{ "accessDetails": { "certKey": "ssh-rsa-cert-v01@openssh.com AEXAMPLEaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgNf076Dt3ppmPd0fPxZVMmS491aEAYYH9cHqAJ3fNML8AAAADAQABAAABAQD4APep5Ta2gHLk7m/vEXAMPLE2eBWJyQvn7ol/i0+s966h5sx8qUD79lPB7q5UESd5VZGFtytrykfQJnjiwqe7EV5agzvjblLj26Fb37EKda9HVfCOu8pWbvky7Tyn9w299a6CsG5o8HrkOymDE2c59lYxXGkilKo5I9aZLBAdXn3t3oKtq9zsjYGjyEmarPYoVDT1ft8HaUGu4aCv1peI0+ZEXAMPLEAWaucW9Huh0WYN5yrmL252c4v13JTVmytaEZvLvt5itVoWXQY0ZDyrLUcZSKxyq5n00Mgvj2fiZdt+xMfQM9xVz0rXZmqx8uJidJpRgLCMTviofwQJU/K1EXAMPLEAAAAAAAABAAAALS00MzMzMDU4MzA4ODg1MTY2NjM4Onp6UWlndHk4UElRSG9STitOTG5QSEE9PQAAAAsAAAAHYml0bmFtaQAAAABdpPL7AAEXAMPLEgcAAAAAAAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtEXAMPLEmb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAACFwAAAAdzc2gtcnNhAAAAAwEAAQEXAMPLECqCbiK9b450HtRD1ZpiksT6oxc8U7nLNkVFC1j7JqZvP9ee3ux+LiB+ozNbUA0cdNL9Y67x7qPv/R7XhTc21+2A+8+GuVpK/Kz9dqDMKNAEXAMPLE+YYN+tiXm7Y8OgziK+7iDB7xUuQ4vghmn4+qgz9mKwYgWvVe2+0XLuV7cnWPB7iUlHQg+E3LUKrV4ZFw9pj7X2dFdNKfMxwWgI1ISWKimEXAMPLEeHjrf1Rqc/QH6TpWCvPfcx8uvwVqdwTfkE/SfA5BCzbGGI1UmIUadh8nHcb5FamQ1hK7kECy47K/x9FMn/KwmM7pCwJbSLDMO7n9bnbvck6m8ZoB2N2YLMG5dW7BerEXAMPLEobqfdtyYJHHel1EyyEJs1fWNU3D5JIGlgzcPAV+ZlbQyUCZXf0oslSa+HE85fO/FRq9SVSBSHrmbeb0frlPhgMzgSmqLeyhlbr6wwWIDbREXAMPLEJZ49H7RdQxdKyYrZPWvRgcr0qI2EL0tAajnpQQ8UZqeO9/Aqter0xN5PhFL0J49OWTacwCGRAjLhibAx7K1t/1ZXWo6c+ijq8clll327EXAMPLE/e89GC89KcmKCxfGQniDAUgF8UqofIbq3ZOUgiAAYCVXclI4L68NhVXyoWuQXPBRQSEXAMPLEWm74tDL9tFN3c7tSe/Oz0cTR+4sAAAIPAAAAB3NzaC1yc2EAAAIAQnG/L0DqiSnLrWhEox4aHqMgd0m0oLLAYx6OQH9F0TM9EXAMPLE961rzSCMon7ZgsWNnL0OwZQgDG+rtJ4N0B7HOVwns4ynUFbzNQ3qFGGeE3lKwX1L41vV1iSy7sDk8aI0LmrKJi1LE1Qc1l8uboRlwoXOYEXAMPLEaUCeX+10+WEXAMPLEg6Y4U4ZvE2B3xyRdpvysb5TGFNtk5qPslacnVkoLOGsZZXMpLGJnG4OBpQLLtpj9sNMxAgZPCAUjhkqkQWYJxJzvFN7sUMOArUwKPFJE2kaEXAMPLEOUrVGBbCTioRztlPsxY7hoXm73N929eZpNhxP3U+nxO9O4NUZ2pTWbVSUaV1gm6pug9xbwNO1Im21t34JeLlKTqxcJ6zzS8W0c0KKpAm5c4hWkseMbyutS2jav/4hiS+BhrYgptzfwe5qRXEXAMPLEHZQr3YfGzYoBJ/lLK3NHhxOihhsfAYwMei0BFZT1F/7CT3IH4iitEkIgodi06/Mw6UDqMPozyQCK1lEA6LFhYCOZG9drWcoRa74lM4kY9TP028Za8gDMh1WpkXLq9Gixon5OHP8aM/sEXAMPLEr2+fnkw+1BtoO5L6+VKoPlXaGqZ/fBYEXAMPLEAMQHjnLM1JYNvtEEPhp+TNzXHzuixWf/Ht04m0AVpXrzIDXaS1O2tXY=", "ipAddress": "192.0.2.0", "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nEXAMPLEBAAKCAQEA+AD3qeU2toBy5O5v7wnRLVo/tngVickL5+6Jf4tPrPeuoebM\nfKlA+/ZTwe6uVBEneVWRhbcra8pH0CZ44sKnuxFeWoM7425S49uhW9+xCnWvR1Xw\njrvKVm75Mu08p/cNvfWugrBuaPB65DspgxNnOfZWMVxpIpSqOSPWmSwQHV597d6C\nrEXAMPLEo8hJmqz2KFQ09X7fB2lBruGgr9aXiNPmWmovYKqwFmrnFvR7odFmDecq\n5EXAMPLE9dyU1ZsrWhGby77eYrVaFl0GNGQ8qy1HGUiscquZ9NDIL49n4mXbfsTH\n0EXAMPLE12ZqsfLiYnSaUYCwjE74qH8ECVPytQIDAQABAoIBAHeZV9Z58JHAjifz\nCEXAMPLEEqC3doOVDgXSlkKI92qNo4z2VcUEho878paCuVVXVHcCGgSnGeyIh2tN\nMEXAMPLESohR427BhH3YLA+3Z5SIvnejbTgYPfLC37B8khTaYqkqMvdZiFVZK5qn\nIEXAMPLEM93oF9eSZCjcLKB/jGHsfb0eCDMP8BshHE2beuqzVMoK1DxOnvoP3+Fp\nAEXAMPLESq6pDpCo9YVUX8g1u3Ro9cPl2LXHDy+oVEY5KhbZQJ7VU1I72WOvppWW\nOEXAMPLEkgYlq7p6qYtYcSgTEjz14gDiMfQ7SyHB3alkIoNONQ9ZPaWHyJvymeud\noQTNuz0CgYEA/LFWNTEZrzdzdR1kJmyNRmAermU0B6utyNENChAlHGSHkB+1lVSh\nbEXAMPLEQo9ooUeW5UxO3YwacZLoDT1mwxw1Ptc1+PNycZoLe1fE9UdARrdmGTob\n8l7CPLSXp3xuR8VqSp2fnIc7hfiQs/NrPX9gm/EOrB0we0RKyDSzWScCgYEA+z/r\niob+nJZq0YbnOSuP6oMULP4vnWniWj8MIhUJU53LwSAM8DeJdONKDdkuiOd52aAL\nVgn7nLo88rVWKhJwVc4tu/rNgZLcR3bP4+kL6zand0KQnMLyOzNA2Ys26aa5udH1\nqWl0WTt9WEm/h10ndC1knOMectrvsG17b38y5sMCgYEA54NiRGGz8oCPW6GN/FZA\nKEXAMPLE5tw34GEH3Uxlc9n3CejDaQmczOATwX4nIwRZDEqWyYZcS0btg1jhGiBD\nYEXAMPLEkc8Z71L/agZEAaVCEog9FqfSqwB+XTfoKh8qur74X1yCu9p6gof1q6k9\neEXAMPLEchJcNNOg4ETIfMkCgYBdVORRhE4mqvWpOdzA7v66FdEz2YSkjAXKkmsW\naEXAMPLE8Z/8yBSmuBv1Qv03XA12my462uB92uzzGAuW+1yBc2Kn1sXqYTy0y1z0\ngEXAMPLEBogjw4MqHKL1bPKMHyQU8/q24PaYgzHPzy13wlH6pTYf1XqlHdE2D6Vv\nyEXAMPLEgQC3i/kVVhky/2XRwRVlC7JO2Bg3QGTx38hpmDa5IuofKANjA+Wa3/zy\nbEXAMPLE6ytQgD9GN/YtBq+uhO+2ZkvXPL+CWRi0ZRXpPwYDBBFU9Cw0AuWWGlL8\nwEXAMPLExMlcysRgcWB9RNgf3AuOpFd2i6XT/riNsvvkpmJ+VooU8g==\n-----END RSA PRIVATE KEY-----\n", "protocol": "ssh", "instanceName": "WordPress_Multisite-1", "username": "bitnami", "hostKeys": [ { "algorithm": "ssh-rsa", "publicKey": "AEXAMPLEaC1yc2EAAAADAQABAAABAQCoeR9ieZTjQ3pXCHczuAYZFjlF7t+uBkXuqeGMRex78pCvmS+DiEXAMPLEuJ1Q8dcKhrQL4HpXbD9dosVCTaJnJwb4MQqsuSVFdHFzy3guP+BKclWqtxJEXAMPLEsBGqZZlrIv6a9bTA0TCplZ8AD+hSRTaSXXqg6FT+Qf16IktH0XlMs7xIEXAMPLEmNtjCpzZiGXDHzytoMvUgwa8uHPp44Og36EUu4VqQxoUHPJKoXvcQizyk3K8ym0hP0TpDZhD8cqwRfd6EHp4Q1br/Ot6y9HwvykEXAMPLEAfbKjbR42+u6+OSlkr4d339q2U1sTDytJhhs8HUel1wTfGRfp", "witnessedAt": 1570744377.699, "fingerprintSHA1": "SHA1:GEXAMPLEMoYgUg0ucadqU9Bt3Lk", "fingerprintSHA256": "SHA256:IEXAMPLEcB5vgxnAUoJawbdZ+MwELhIp6FUxuwq/LIU" }, { "algorithm": "ssh-ed25519", "publicKey": "AEXAMPLEaC1lZDI1NTE5AAAAIC1gwGPDfGaONxEXAMPLEJX3UNap781QxHQmn8nzlrUv", "witnessedAt": 1570744377.697, "fingerprintSHA1": "SHA1:VEXAMPLE5ReqSmTgv03sSUw9toU", "fingerprintSHA256": "SHA256:0EXAMPLEdE6tI95k3TJpG+qhJbAoknB0yz9nAEaDt3A" }, { "algorithm": "ecdsa-sha2-nistp256", "publicKey": "AEXAMPLEZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABEXAMPLE9B4mZy8YSsZW7cixCDq5yHSAAxjJkDo54C+EnKlDCsYtUkxxEXAMPLE6VOWL2z63RTKa2AUPgd8irjxWI=", "witnessedAt": 1570744377.707, "fingerprintSHA1": "SHA1:UEXAMPLEOYCfXsCf2G6tDg+7YG0", "fingerprintSHA256": "SHA256:wEXAMPLEQ9a/iEXAMPLEhRufm6U9vFU4cpkMPHnBsNA" } ] } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstanceAccessDetails
。
-
下列程式碼範例示範如何使用 get-instance-metric-data
。
- AWS CLI
-
取得執行個體的指標資料
下列
get-instance-metric-data
範例會傳回1571342400
和 之間CPUUtilization
每7200
秒 (2 小時) 的平均百分比1571428800
,例如MEAN-1
。建議您使用 unix 時間轉換器來識別開始和結束時間。
aws lightsail get-instance-metric-data \ --instance-name
MEAN-1
\ --metric-nameCPUUtilization
\ --period7200
\ --start-time1571342400
\ --end-time1571428800
\ --unitPercent
\ --statisticsAverage
輸出:
{ "metricName": "CPUUtilization", "metricData": [ { "average": 0.26113718770120725, "timestamp": 1571342400.0, "unit": "Percent" }, { "average": 0.26861268928111953, "timestamp": 1571392800.0, "unit": "Percent" }, { "average": 0.28187475104748777, "timestamp": 1571378400.0, "unit": "Percent" }, { "average": 0.2651936960458352, "timestamp": 1571421600.0, "unit": "Percent" }, { "average": 0.2561856213712188, "timestamp": 1571371200.0, "unit": "Percent" }, { "average": 0.3021383254607764, "timestamp": 1571356800.0, "unit": "Percent" }, { "average": 0.2618381649223539, "timestamp": 1571407200.0, "unit": "Percent" }, { "average": 0.26331929394825787, "timestamp": 1571400000.0, "unit": "Percent" }, { "average": 0.2576348407007818, "timestamp": 1571385600.0, "unit": "Percent" }, { "average": 0.2513008454658378, "timestamp": 1571364000.0, "unit": "Percent" }, { "average": 0.26329974562758346, "timestamp": 1571414400.0, "unit": "Percent" }, { "average": 0.2667092536656445, "timestamp": 1571349600.0, "unit": "Percent" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstanceMetricData
。
-
下列程式碼範例示範如何使用 get-instance-port-states
。
- AWS CLI
-
取得執行個體的防火牆資訊
下列
get-instance-port-states
範例會傳回為執行個體 設定的防火牆連接埠MEAN-1
。aws lightsail get-instance-port-states \ --instance-name
MEAN-1
輸出:
{ "portStates": [ { "fromPort": 80, "toPort": 80, "protocol": "tcp", "state": "open" }, { "fromPort": 22, "toPort": 22, "protocol": "tcp", "state": "open" }, { "fromPort": 443, "toPort": 443, "protocol": "tcp", "state": "open" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstancePortStates
。
-
下列程式碼範例示範如何使用 get-instance-snapshot
。
- AWS CLI
-
取得指定執行個體快照的相關資訊
下列
get-instance-snapshot
範例顯示指定執行個體快照的詳細資訊。aws lightsail get-instance-snapshot \ --instance-snapshot-name
MEAN-1-1571419854
輸出:
{ "instanceSnapshot": { "name": "MEAN-1-1571419854", "arn": "arn:aws:lightsail:us-west-2:111122223333:InstanceSnapshot/ac54700c-48a8-40fd-b065-2EXAMPLEac8f", "supportCode": "6EXAMPLE3362/ami-0EXAMPLE67a73020d", "createdAt": 1571419891.927, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "InstanceSnapshot", "tags": [], "state": "available", "fromAttachedDisks": [], "fromInstanceName": "MEAN-1", "fromInstanceArn": "arn:aws:lightsail:us-west-2:111122223333:Instance/bd470fc5-a68b-44c5-8dbc-8EXAMPLEbada", "fromBlueprintId": "mean", "fromBundleId": "medium_3_0", "isFromAutoSnapshot": false, "sizeInGb": 80 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstanceSnapshot
。
-
下列程式碼範例示範如何使用 get-instance-snapshots
。
- AWS CLI
-
取得所有執行個體快照的相關資訊
下列
get-instance-snapshots
範例顯示已設定 AWS 區域中所有執行個體快照的詳細資訊。aws lightsail get-instance-snapshots
輸出:
{ "instanceSnapshots": [ { "name": "MEAN-1-1571421498", "arn": "arn:aws:lightsail:us-west-2:111122223333:InstanceSnapshot/a20e6ebe-b0ee-4ae4-a750-3EXAMPLEcb0c", "supportCode": "6EXAMPLE3362/ami-0EXAMPLEe33cabfa1", "createdAt": 1571421527.755, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "InstanceSnapshot", "tags": [ { "key": "no_delete" } ], "state": "available", "fromAttachedDisks": [], "fromInstanceName": "MEAN-1", "fromInstanceArn": "arn:aws:lightsail:us-west-2:111122223333:Instance/1761aa0a-6038-4f25-8b94-2EXAMPLE19fd", "fromBlueprintId": "wordpress", "fromBundleId": "micro_3_0", "isFromAutoSnapshot": false, "sizeInGb": 40 }, { "name": "MEAN-1-1571419854", "arn": "arn:aws:lightsail:us-west-2:111122223333:InstanceSnapshot/ac54700c-48a8-40fd-b065-2EXAMPLEac8f", "supportCode": "6EXAMPLE3362/ami-0EXAMPLE67a73020d", "createdAt": 1571419891.927, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "InstanceSnapshot", "tags": [], "state": "available", "fromAttachedDisks": [], "fromInstanceName": "MEAN-1", "fromInstanceArn": "arn:aws:lightsail:us-west-2:111122223333:Instance/bd470fc5-a68b-44c5-8dbc-8EXAMPLEbada", "fromBlueprintId": "mean", "fromBundleId": "medium_3_0", "isFromAutoSnapshot": false, "sizeInGb": 80 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstanceSnapshots
。
-
下列程式碼範例示範如何使用 get-instance-state
。
- AWS CLI
-
取得執行個體狀態的相關資訊
下列
get-instance-state
範例會傳回指定執行個體的狀態。aws lightsail get-instance-state \ --instance-name
MEAN-1
輸出:
{ "state": { "code": 16, "name": "running" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstanceState
。
-
下列程式碼範例示範如何使用 get-instance
。
- AWS CLI
-
取得執行個體的相關資訊
下列
get-instance
範例顯示執行個體 的詳細資訊MEAN-1
。aws lightsail get-instance \ --instance-name
MEAN-1
輸出:
{ "instance": { "name": "MEAN-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:Instance/bd470fc5-a68b-44c5-8dbc-EXAMPLE4bada", "supportCode": "6EXAMPLE3362/i-05EXAMPLE407c97d3", "createdAt": 1570635023.124, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Instance", "tags": [], "blueprintId": "mean", "blueprintName": "MEAN", "bundleId": "medium_3_0", "isStaticIp": false, "privateIpAddress": "192.0.2.0", "publicIpAddress": "192.0.2.0", "hardware": { "cpuCount": 2, "disks": [ { "createdAt": 1570635023.124, "sizeInGb": 80, "isSystemDisk": true, "iops": 240, "path": "/dev/xvda", "attachedTo": "MEAN-1", "attachmentState": "attached" } ], "ramSizeInGb": 4.0 }, "networking": { "monthlyTransfer": { "gbPerMonthAllocated": 4096 }, "ports": [ { "fromPort": 80, "toPort": 80, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" }, { "fromPort": 22, "toPort": 22, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" }, { "fromPort": 443, "toPort": 443, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" } ] }, "state": { "code": 16, "name": "running" }, "username": "bitnami", "sshKeyName": "MyKey" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstance
。
-
下列程式碼範例示範如何使用 get-instances
。
- AWS CLI
-
取得所有執行個體的相關資訊
下列
get-instances
範例顯示已設定 AWS 區域中所有執行個體的詳細資訊。aws lightsail get-instances
輸出:
{ "instances": [ { "name": "Windows_Server_2022-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:Instance/0f44fbb9-8f55-4e47-a25e-EXAMPLE04763", "supportCode": "62EXAMPLE362/i-0bEXAMPLE71a686b9", "createdAt": 1571332358.665, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Instance", "tags": [], "blueprintId": "windows_server_2022", "blueprintName": "Windows Server 2022", "bundleId": "large_win_3_0", "isStaticIp": false, "privateIpAddress": "192.0.2.0", "publicIpAddress": "192.0.2.0", "hardware": { "cpuCount": 1, "disks": [ { "createdAt": 1571332358.665, "sizeInGb": 160, "isSystemDisk": true, "iops": 180, "path": "/dev/sda1", "attachedTo": "Windows_Server_2022-1", "attachmentState": "attached" }, { "name": "my-disk-for-windows-server", "arn": "arn:aws:lightsail:us-west-2:111122223333:Disk/4123a81c-484c-49ea-afea-5EXAMPLEda87", "supportCode": "6EXAMPLE3362/vol-0EXAMPLEb2b99ca3d", "createdAt": 1571355063.494, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Disk", "tags": [], "sizeInGb": 128, "isSystemDisk": false, "iops": 384, "path": "/dev/xvdf", "state": "in-use", "attachedTo": "Windows_Server_2022-1", "isAttached": true, "attachmentState": "attached" } ], "ramSizeInGb": 8.0 }, "networking": { "monthlyTransfer": { "gbPerMonthAllocated": 3072 }, "ports": [ { "fromPort": 80, "toPort": 80, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" }, { "fromPort": 22, "toPort": 22, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" }, { "fromPort": 3389, "toPort": 3389, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" } ] }, "state": { "code": 16, "name": "running" }, "username": "Administrator", "sshKeyName": "LightsailDefaultKeyPair" }, { "name": "MEAN-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:Instance/bd470fc5-a68b-44c5-8dbc-8EXAMPLEbada", "supportCode": "6EXAMPLE3362/i-0EXAMPLEa407c97d3", "createdAt": 1570635023.124, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Instance", "tags": [], "blueprintId": "mean", "blueprintName": "MEAN", "bundleId": "medium_3_0", "isStaticIp": false, "privateIpAddress": "192.0.2.0", "publicIpAddress": "192.0.2.0", "hardware": { "cpuCount": 2, "disks": [ { "name": "Disk-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:Disk/c21cfb0a-07f2-44ae-9a23-bEXAMPLE8096", "supportCode": "6EXAMPLE3362/vol-0EXAMPLEf2f88b32f", "createdAt": 1566585439.587, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "Disk", "tags": [ { "key": "test" } ], "sizeInGb": 8, "isSystemDisk": false, "iops": 240, "path": "/dev/xvdf", "state": "in-use", "attachedTo": "MEAN-1", "isAttached": true, "attachmentState": "attached" }, { "createdAt": 1570635023.124, "sizeInGb": 80, "isSystemDisk": true, "iops": 240, "path": "/dev/sda1", "attachedTo": "MEAN-1", "attachmentState": "attached" } ], "ramSizeInGb": 4.0 }, "networking": { "monthlyTransfer": { "gbPerMonthAllocated": 4096 }, "ports": [ { "fromPort": 80, "toPort": 80, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" }, { "fromPort": 22, "toPort": 22, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" }, { "fromPort": 443, "toPort": 443, "protocol": "tcp", "accessFrom": "Anywhere (0.0.0.0/0)", "accessType": "public", "commonName": "", "accessDirection": "inbound" } ] }, "state": { "code": 16, "name": "running" }, "username": "bitnami", "sshKeyName": "MyTestKey" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetInstances
。
-
下列程式碼範例示範如何使用 get-key-pair
。
- AWS CLI
-
取得金鑰對的相關資訊
下列
get-key-pair
範例顯示指定金鑰對的詳細資訊。aws lightsail get-key-pair \ --key-pair-name
MyKey1
輸出:
{ "keyPair": { "name": "MyKey1", "arn": "arn:aws:lightsail:us-west-2:111122223333:KeyPair/19a4efdf-3054-43d6-91fd-eEXAMPLE21bf", "supportCode": "6EXAMPLE3362/MyKey1", "createdAt": 1571255026.975, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "KeyPair", "tags": [], "fingerprint": "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:gg:hh:ii:jj" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetKeyPair
。
-
下列程式碼範例示範如何使用 get-key-pairs
。
- AWS CLI
-
取得所有金鑰對的相關資訊
下列
get-key-pairs
範例顯示已設定 AWS 區域中所有金鑰對的詳細資訊。aws lightsail get-key-pairs
輸出:
{ "keyPairs": [ { "name": "MyKey1", "arn": "arn:aws:lightsail:us-west-2:111122223333:KeyPair/19a4efdf-3054-43d6-91fd-eEXAMPLE21bf", "supportCode": "6EXAMPLE3362/MyKey1", "createdAt": 1571255026.975, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "KeyPair", "tags": [], "fingerprint": "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:gg:hh:ii:jj" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetKeyPairs
。
-
下列程式碼範例示範如何使用 get-load-balancer-tls-certificates
。
- AWS CLI
-
取得負載平衡器 TLS 憑證的相關資訊
下列
get-load-balancer-tls-certificates
範例顯示指定負載平衡器的 TLS 憑證詳細資訊。aws lightsail get-load-balancer-tls-certificates \ --load-balancer-name
LoadBalancer-1
輸出:
{ "tlsCertificates": [ { "name": "example-com", "arn": "arn:aws:lightsail:us-west-2:111122223333:LoadBalancerTlsCertificate/d7bf4643-6a02-4cd4-b3c4-fEXAMPLE9b4d", "supportCode": "6EXAMPLE3362/arn:aws:acm:us-west-2:333322221111:certificate/9af8e32c-a54e-4a67-8c63-cEXAMPLEb314", "createdAt": 1571678025.3, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "LoadBalancerTlsCertificate", "loadBalancerName": "LoadBalancer-1", "isAttached": false, "status": "ISSUED", "domainName": "example.com", "domainValidationRecords": [ { "name": "_dEXAMPLE4ede046a0319eb44a4eb3cbc.example.com.", "type": "CNAME", "value": "_bEXAMPLE0899fb7b6bf79d9741d1a383.hkvuiqjoua.acm-validations.aws.", "validationStatus": "SUCCESS", "domainName": "example.com" } ], "issuedAt": 1571678070.0, "issuer": "Amazon", "keyAlgorithm": "RSA-2048", "notAfter": 1605960000.0, "notBefore": 1571616000.0, "serial": "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff", "signatureAlgorithm": "SHA256WITHRSA", "subject": "CN=example.com", "subjectAlternativeNames": [ "example.com" ] } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetLoadBalancerTlsCertificates
。
-
下列程式碼範例示範如何使用 get-load-balancer
。
- AWS CLI
-
若要取得負載平衡器的相關資訊
下列
get-load-balancer
範例顯示指定負載平衡器的詳細資訊。aws lightsail get-load-balancer \ --load-balancer-name
LoadBalancer-1
輸出:
{ "loadBalancer": { "name": "LoadBalancer-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:LoadBalancer/40486b2b-1ad0-4152-83e4-cEXAMPLE6f4b", "supportCode": "6EXAMPLE3362/arn:aws:elasticloadbalancing:us-west-2:333322221111:loadbalancer/app/bEXAMPLE128cb59d86f946a9395dd304/1EXAMPLE8dd9d77e", "createdAt": 1571677906.723, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "LoadBalancer", "tags": [], "dnsName": "bEXAMPLE128cb59d86f946a9395dd304-1486911371.us-west-2.elb.amazonaws.com", "state": "active", "protocol": "HTTP", "publicPorts": [ 80 ], "healthCheckPath": "/", "instancePort": 80, "instanceHealthSummary": [ { "instanceName": "MEAN-3", "instanceHealth": "healthy" }, { "instanceName": "MEAN-1", "instanceHealth": "healthy" }, { "instanceName": "MEAN-2", "instanceHealth": "healthy" } ], "tlsCertificateSummaries": [ { "name": "example-com", "isAttached": false } ], "configurationOptions": { "SessionStickinessEnabled": "false", "SessionStickiness_LB_CookieDurationSeconds": "86400" } } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetLoadBalancer
。
-
下列程式碼範例示範如何使用 get-load-balancers
。
- AWS CLI
-
取得所有負載平衡器的相關資訊
下列
get-load-balancers
範例顯示已設定 AWS 區域中所有負載平衡器的詳細資訊。aws lightsail get-load-balancers
輸出:
{ "loadBalancers": [ { "name": "LoadBalancer-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:LoadBalancer/40486b2b-1ad0-4152-83e4-cEXAMPLE6f4b", "supportCode": "6EXAMPLE3362/arn:aws:elasticloadbalancing:us-west-2:333322221111:loadbalancer/app/bEXAMPLE128cb59d86f946a9395dd304/1EXAMPLE8dd9d77e", "createdAt": 1571677906.723, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "LoadBalancer", "tags": [], "dnsName": "bEXAMPLE128cb59d86f946a9395dd304-1486911371.us-west-2.elb.amazonaws.com", "state": "active", "protocol": "HTTP", "publicPorts": [ 80 ], "healthCheckPath": "/", "instancePort": 80, "instanceHealthSummary": [ { "instanceName": "MEAN-3", "instanceHealth": "healthy" }, { "instanceName": "MEAN-1", "instanceHealth": "healthy" }, { "instanceName": "MEAN-2", "instanceHealth": "healthy" } ], "tlsCertificateSummaries": [ { "name": "example-com", "isAttached": false } ], "configurationOptions": { "SessionStickinessEnabled": "false", "SessionStickiness_LB_CookieDurationSeconds": "86400" } } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetLoadBalancers
。
-
下列程式碼範例示範如何使用 get-operation
。
- AWS CLI
-
取得單一操作的相關資訊
下列
get-operation
範例顯示指定操作的詳細資訊。aws lightsail get-operation \ --operation-id
e5700e8a-daf2-4b49-bc01-3EXAMPLE910a
輸出:
{ "operation": { "id": "e5700e8a-daf2-4b49-bc01-3EXAMPLE910a", "resourceName": "Instance-1", "resourceType": "Instance", "createdAt": 1571679872.404, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "CreateInstance", "status": "Succeeded", "statusChangedAt": 1571679890.304 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetOperation
。
-
下列程式碼範例示範如何使用 get-operations-for-resource
。
- AWS CLI
-
取得資源的所有操作
下列
get-operations-for-resource
範例顯示指定資源之所有操作的詳細資訊。aws lightsail get-operations-for-resource \ --resource-name
LoadBalancer-1
輸出:
{ "operations": [ { "id": "e2973046-43f8-4252-a4b4-9EXAMPLE69ce", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571678786.071, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MEAN-1", "operationType": "DetachInstancesFromLoadBalancer", "status": "Succeeded", "statusChangedAt": 1571679087.57 }, { "id": "2d742a18-0e7f-48c8-9705-3EXAMPLEf98a", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571678782.784, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MEAN-1", "operationType": "AttachInstancesToLoadBalancer", "status": "Succeeded", "statusChangedAt": 1571678798.465 }, { "id": "6c700fcc-4246-40ab-952b-1EXAMPLEdac2", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571678775.297, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "MEAN-3", "operationType": "AttachInstancesToLoadBalancer", "status": "Succeeded", "statusChangedAt": 1571678842.806 }, ... } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetOperationsForResource
。
-
下列程式碼範例示範如何使用 get-operations
。
- AWS CLI
-
取得所有操作的相關資訊
下列
get-operations
範例顯示已設定 AWS 區域中所有操作的詳細資訊。aws lightsail get-operations
輸出:
{ "operations": [ { "id": "e5700e8a-daf2-4b49-bc01-3EXAMPLE910a", "resourceName": "Instance-1", "resourceType": "Instance", "createdAt": 1571679872.404, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "CreateInstance", "status": "Succeeded", "statusChangedAt": 1571679890.304 }, { "id": "701a3339-930e-4914-a9f9-7EXAMPLE68d7", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1571678786.072, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "LoadBalancer-1", "operationType": "DetachInstancesFromLoadBalancer", "status": "Succeeded", "statusChangedAt": 1571679086.399 }, { "id": "e2973046-43f8-4252-a4b4-9EXAMPLE69ce", "resourceName": "LoadBalancer-1", "resourceType": "LoadBalancer", "createdAt": 1571678786.071, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "WordPress-1", "operationType": "DetachInstancesFromLoadBalancer", "status": "Succeeded", "statusChangedAt": 1571679087.57 }, ... } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetOperations
。
-
下列程式碼範例示範如何使用 get-regions
。
- AWS CLI
-
取得 Amazon Lightsail 的所有 AWS 區域
下列
get-regions
範例顯示 Amazon Lightsail 所有 AWS 區域的詳細資訊。aws lightsail get-regions
輸出:
{ "regions": [ { "continentCode": "NA", "description": "This region is recommended to serve users in the eastern United States", "displayName": "Virginia", "name": "us-east-1", "availabilityZones": [], "relationalDatabaseAvailabilityZones": [] }, { "continentCode": "NA", "description": "This region is recommended to serve users in the eastern United States", "displayName": "Ohio", "name": "us-east-2", "availabilityZones": [], "relationalDatabaseAvailabilityZones": [] }, { "continentCode": "NA", "description": "This region is recommended to serve users in the northwestern United States, Alaska, and western Canada", "displayName": "Oregon", "name": "us-west-2", "availabilityZones": [], "relationalDatabaseAvailabilityZones": [] }, ... } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRegions
。
-
下列程式碼範例示範如何使用 get-relational-database-blueprints
。
- AWS CLI
-
取得新關聯式資料庫的藍圖
下列
get-relational-database-blueprints
範例顯示所有可用關聯式資料庫藍圖的詳細資訊,可用於在 Amazon Lightsail 中建立新的關聯式資料庫。aws lightsail get-relational-database-blueprints
輸出:
{ "blueprints": [ { "blueprintId": "mysql_5_6", "engine": "mysql", "engineVersion": "5.6.44", "engineDescription": "MySQL Community Edition", "engineVersionDescription": "MySQL 5.6.44", "isEngineDefault": false }, { "blueprintId": "mysql_5_7", "engine": "mysql", "engineVersion": "5.7.26", "engineDescription": "MySQL Community Edition", "engineVersionDescription": "MySQL 5.7.26", "isEngineDefault": true }, { "blueprintId": "mysql_8_0", "engine": "mysql", "engineVersion": "8.0.16", "engineDescription": "MySQL Community Edition", "engineVersionDescription": "MySQL 8.0.16", "isEngineDefault": false }, { "blueprintId": "postgres_9_6", "engine": "postgres", "engineVersion": "9.6.15", "engineDescription": "PostgreSQL", "engineVersionDescription": "PostgreSQL 9.6.15-R1", "isEngineDefault": false }, { "blueprintId": "postgres_10", "engine": "postgres", "engineVersion": "10.10", "engineDescription": "PostgreSQL", "engineVersionDescription": "PostgreSQL 10.10-R1", "isEngineDefault": false }, { "blueprintId": "postgres_11", "engine": "postgres", "engineVersion": "11.5", "engineDescription": "PostgreSQL", "engineVersionDescription": "PostgreSQL 11.5-R1", "isEngineDefault": true } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseBlueprints
。
-
下列程式碼範例示範如何使用 get-relational-database-bundles
。
- AWS CLI
-
取得新關聯式資料庫的套件
下列
get-relational-database-bundles
範例顯示所有可用關聯式資料庫套件的詳細資訊,可用於在 Amazon Lightsail 中建立新的關聯式資料庫。請注意,回應不包含非作用中的套件,因為 命令中未指定--include-inactive
旗標。您不能使用非作用中套件建立新的關聯式資料庫。aws lightsail get-relational-database-bundles
輸出:
{ "bundles": [ { "bundleId": "micro_2_0", "name": "Micro", "price": 15.0, "ramSizeInGb": 1.0, "diskSizeInGb": 40, "transferPerMonthInGb": 100, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "micro_ha_2_0", "name": "Micro with High Availability", "price": 30.0, "ramSizeInGb": 1.0, "diskSizeInGb": 40, "transferPerMonthInGb": 100, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "small_2_0", "name": "Small", "price": 30.0, "ramSizeInGb": 2.0, "diskSizeInGb": 80, "transferPerMonthInGb": 100, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "small_ha_2_0", "name": "Small with High Availability", "price": 60.0, "ramSizeInGb": 2.0, "diskSizeInGb": 80, "transferPerMonthInGb": 100, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "medium_2_0", "name": "Medium", "price": 60.0, "ramSizeInGb": 4.0, "diskSizeInGb": 120, "transferPerMonthInGb": 100, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "medium_ha_2_0", "name": "Medium with High Availability", "price": 120.0, "ramSizeInGb": 4.0, "diskSizeInGb": 120, "transferPerMonthInGb": 100, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "large_2_0", "name": "Large", "price": 115.0, "ramSizeInGb": 8.0, "diskSizeInGb": 240, "transferPerMonthInGb": 200, "cpuCount": 2, "isEncrypted": true, "isActive": true }, { "bundleId": "large_ha_2_0", "name": "Large with High Availability", "price": 230.0, "ramSizeInGb": 8.0, "diskSizeInGb": 240, "transferPerMonthInGb": 200, "cpuCount": 2, "isEncrypted": true, "isActive": true } ] }
如需詳細資訊,請參閱 Amazon Lightsail 開發人員指南中的在 Amazon Lightsail 中建立資料庫
。 Amazon Lightsail -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseBundles
。
-
下列程式碼範例示範如何使用 get-relational-database-events
。
- AWS CLI
-
取得關聯式資料庫的事件
下列
get-relational-database-events
範例顯示指定關聯式資料庫過去 17 小時 (1020 分鐘) 內事件的詳細資訊。aws lightsail get-relational-database-events \ --relational-database-name
Database-1
\ --duration-in-minutes1020
輸出:
{ "relationalDatabaseEvents": [ { "resource": "Database-1", "createdAt": 1571654146.553, "message": "Backing up Relational Database", "eventCategories": [ "backup" ] }, { "resource": "Database-1", "createdAt": 1571654249.98, "message": "Finished Relational Database backup", "eventCategories": [ "backup" ] } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseEvents
。
-
下列程式碼範例示範如何使用 get-relational-database-log-events
。
- AWS CLI
-
取得關聯式資料庫的日誌事件
下列
get-relational-database-log-events
範例顯示1571597176
關聯式資料庫1570733176
與 之間指定日誌的詳細資訊Database1
。傳回的資訊設定為從 開始head
。建議您使用 unix 時間轉換器來識別開始和結束時間。
aws lightsail get-relational-database-log-events \ --relational-database-name
Database1
\ --log-stream-nameerror
\ --start-from-head \ --start-time1570733176
\ --end-time1571597176
輸出:
{ "resourceLogEvents": [ { "createdAt": 1570820267.0, "message": "2019-10-11 18:57:47 20969 [Warning] IP address '192.0.2.0' could not be resolved: Name or service not known" }, { "createdAt": 1570860974.0, "message": "2019-10-12 06:16:14 20969 [Warning] IP address '8192.0.2.0' could not be resolved: Temporary failure in name resolution" }, { "createdAt": 1570860977.0, "message": "2019-10-12 06:16:17 20969 [Warning] IP address '192.0.2.0' could not be resolved: Temporary failure in name resolution" }, { "createdAt": 1570860979.0, "message": "2019-10-12 06:16:19 20969 [Warning] IP address '192.0.2.0' could not be resolved: Temporary failure in name resolution" }, { "createdAt": 1570860981.0, "message": "2019-10-12 06:16:21 20969 [Warning] IP address '192.0.2.0' could not be resolved: Temporary failure in name resolution" }, { "createdAt": 1570860982.0, "message": "2019-10-12 06:16:22 20969 [Warning] IP address '192.0.2.0' could not be resolved: Temporary failure in name resolution" }, { "createdAt": 1570860984.0, "message": "2019-10-12 06:16:24 20969 [Warning] IP address '192.0.2.0' could not be resolved: Temporary failure in name resolution" }, { "createdAt": 1570860986.0, "message": "2019-10-12 06:16:26 20969 [Warning] IP address '192.0.2.0' could not be resolved: Temporary failure in name resolution" }, ... } ], "nextBackwardToken": "eEXAMPLEZXJUZXh0IjoiZnRWb3F3cUpRSlQ5NndMYThxelRUZlFhR3J6c2dKWEEvM2kvajZMZzVVVWpqRDN0YjFXTjNrak5pRk9iVFRZdjkwVGlpZGw5NFJGSFRQTEdJSjdpQnFCRk5CZFJlYTZaSXpScStuZjJEYXhqM2grUFVJOEpIYlU5YWJ2QitvQWN5cEFyVUo3VDk1QWY3bVF6MEwvcVovVldZdGc9Iiwibm9uY2UiOiJBNHpzdWMvUkZZKzRvUzhEIiwiY2lwaGVyIjoiQUVTL0dDTS9Ob1BhZGEXAMPLEQ==", "nextForwardToken": "eEXAMPLEZXJUZXh0IjoiT09Lb0Z6ZFRJbHhaNEQ5N2tPbkkwRmwwNUxPZjFTbFFwUklQbzlSaWgvMWVXbEk4aG56VHg4bW1Gb3grbDVodUVNZEdiZXN0TzVYcjlLK1FUdFB2RlJLS2FMcU05WkN3Rm1uVzBkOFpDR2g0b1BBVlg2NVFGNDNPazZzRXJieHRuU0xzdkRNTkFUMTZibU9HM2YyaGxiS0hUUDA9Iiwibm9uY2UiOiJFQmI4STQ3cU5aWXNXZ0g4IiwiY2lwaGVyIjoiQUVTL0dDTS9Ob1BhZGEXAMPLEQ==" }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseLogEvents
。
-
下列程式碼範例示範如何使用 get-relational-database-log-streams
。
- AWS CLI
-
取得關聯式資料庫的日誌串流
下列
get-relational-database-log-streams
範例會傳回指定關聯式資料庫的所有可用日誌串流。aws lightsail get-relational-database-log-streams \ --relational-database-name
Database1
輸出:
{ "logStreams": [ "audit", "error", "general", "slowquery" ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseLogStreams
。
-
下列程式碼範例示範如何使用 get-relational-database-master-user-password
。
- AWS CLI
-
取得關聯式資料庫的主要使用者密碼
下列
get-relational-database-master-user-password
範例會傳回指定關聯式資料庫之主要使用者密碼的相關資訊。aws lightsail get-relational-database-master-user-password \ --relational-database-name
Database-1
輸出:
{ "masterUserPassword": "VEXAMPLEec.9qvx,_t<)Wkf)kwboM,>2", "createdAt": 1571259453.959 }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseMasterUserPassword
。
-
下列程式碼範例示範如何使用 get-relational-database-metric-data
。
- AWS CLI
-
取得關聯式資料庫的指標資料
下列
get-relational-database-metric-data
範例傳回1570733176
1571597176
關聯式資料庫 與 之間 24 小時 (86400
秒)DatabaseConnections
期間的指標計數總和Database1
。建議您使用 unix 時間轉換器來識別開始和結束時間。
aws lightsail get-relational-database-metric-data \ --relational-database-name
Database1
\ --metric-nameDatabaseConnections
\ --period86400
\ --start-time1570733176
\ --end-time1571597176
\ --unitCount
\ --statisticsSum
輸出:
{ "metricName": "DatabaseConnections", "metricData": [ { "sum": 1.0, "timestamp": 1571510760.0, "unit": "Count" }, { "sum": 1.0, "timestamp": 1570733160.0, "unit": "Count" }, { "sum": 1.0, "timestamp": 1570992360.0, "unit": "Count" }, { "sum": 0.0, "timestamp": 1571251560.0, "unit": "Count" }, { "sum": 721.0, "timestamp": 1570819560.0, "unit": "Count" }, { "sum": 1.0, "timestamp": 1571078760.0, "unit": "Count" }, { "sum": 2.0, "timestamp": 1571337960.0, "unit": "Count" }, { "sum": 684.0, "timestamp": 1570905960.0, "unit": "Count" }, { "sum": 0.0, "timestamp": 1571165160.0, "unit": "Count" }, { "sum": 1.0, "timestamp": 1571424360.0, "unit": "Count" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseMetricData
。
-
下列程式碼範例示範如何使用 get-relational-database-parameters
。
- AWS CLI
-
取得關聯式資料庫的參數
下列
get-relational-database-parameters
範例會傳回指定關聯式資料庫所有可用參數的相關資訊。aws lightsail get-relational-database-parameters \ --relational-database-name
Database-1
輸出:
{ "parameters": [ { "allowedValues": "0,1", "applyMethod": "pending-reboot", "applyType": "dynamic", "dataType": "boolean", "description": "Automatically set all granted roles as active after the user has authenticated successfully.", "isModifiable": true, "parameterName": "activate_all_roles_on_login", "parameterValue": "0" }, { "allowedValues": "0,1", "applyMethod": "pending-reboot", "applyType": "static", "dataType": "boolean", "description": "Controls whether user-defined functions that have only an xxx symbol for the main function can be loaded", "isModifiable": false, "parameterName": "allow-suspicious-udfs" }, { "allowedValues": "0,1", "applyMethod": "pending-reboot", "applyType": "dynamic", "dataType": "boolean", "description": "Sets the autocommit mode", "isModifiable": true, "parameterName": "autocommit" }, { "allowedValues": "0,1", "applyMethod": "pending-reboot", "applyType": "static", "dataType": "boolean", "description": "Controls whether the server autogenerates SSL key and certificate files in the data directory, if they do not already exist.", "isModifiable": false, "parameterName": "auto_generate_certs" }, ... } ] }
如需詳細資訊,請參閱 Lightsail 開發指南中的更新 Amazon Lightsail 中的資料庫參數
。 -
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseParameters
。
-
下列程式碼範例示範如何使用 get-relational-database-snapshot
。
- AWS CLI
-
取得關聯式資料庫快照的相關資訊
下列
get-relational-database-snapshot
範例顯示指定關聯式資料庫快照的詳細資訊。aws lightsail get-relational-database-snapshot \ --relational-database-snapshot-name
Database-1-1571350042
輸出:
{ "relationalDatabaseSnapshot": { "name": "Database-1-1571350042", "arn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabaseSnapshot/0389bbad-4b85-4c3d-9EXAMPLEaee3643d2", "supportCode": "6EXAMPLE3362/ls-8EXAMPLE2ba7ad041451946fafc2ad19cfbd9eb2", "createdAt": 1571350046.238, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "RelationalDatabaseSnapshot", "tags": [], "engine": "mysql", "engineVersion": "8.0.16", "sizeInGb": 40, "state": "available", "fromRelationalDatabaseName": "Database-1", "fromRelationalDatabaseArn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabase/7ea932b1-b85a-4bd5-9b3e-bEXAMPLE8cc4", "fromRelationalDatabaseBundleId": "micro_1_0", "fromRelationalDatabaseBlueprintId": "mysql_8_0" } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseSnapshot
。
-
下列程式碼範例示範如何使用 get-relational-database-snapshots
。
- AWS CLI
-
取得所有關聯式資料庫快照的相關資訊
下列
get-relational-database-snapshots
範例顯示已設定 AWS 區域中所有關聯式資料庫快照的詳細資訊。aws lightsail get-relational-database-snapshots
輸出:
{ "relationalDatabaseSnapshots": [ { "name": "Database-1-1571350042", "arn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabaseSnapshot/0389bbad-4b85-4c3d-9861-6EXAMPLE43d2", "supportCode": "6EXAMPLE3362/ls-8EXAMPLE2ba7ad041451946fafc2ad19cfbd9eb2", "createdAt": 1571350046.238, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "RelationalDatabaseSnapshot", "tags": [], "engine": "mysql", "engineVersion": "8.0.16", "sizeInGb": 40, "state": "available", "fromRelationalDatabaseName": "Database-1", "fromRelationalDatabaseArn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabase/7ea932b1-b85a-4bd5-9b3e-bEXAMPLE8cc4", "fromRelationalDatabaseBundleId": "micro_1_0", "fromRelationalDatabaseBlueprintId": "mysql_8_0" }, { "name": "Database1-Console", "arn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabaseSnapshot/8b94136e-06ec-4b1a-a3fb-5EXAMPLEe1e9", "supportCode": "6EXAMPLE3362/ls-9EXAMPLE14b000d34c8d1c432734e137612d5b5c", "createdAt": 1571249981.025, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "RelationalDatabaseSnapshot", "tags": [ { "key": "test" } ], "engine": "mysql", "engineVersion": "5.6.44", "sizeInGb": 40, "state": "available", "fromRelationalDatabaseName": "Database1", "fromRelationalDatabaseArn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabase/a6161cb7-4535-4f16-9dcf-8EXAMPLE3d4e", "fromRelationalDatabaseBundleId": "micro_1_0", "fromRelationalDatabaseBlueprintId": "mysql_5_6" } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabaseSnapshots
。
-
下列程式碼範例示範如何使用 get-relational-database
。
- AWS CLI
-
取得關聯式資料庫的相關資訊
下列
get-relational-database
範例顯示指定關聯式資料庫的詳細資訊。aws lightsail get-relational-database \ --relational-database-name
Database-1
輸出:
{ "relationalDatabase": { "name": "Database-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabase/7ea932b1-b85a-4bd5-9b3e-bEXAMPLE8cc4", "supportCode": "6EXAMPLE3362/ls-9EXAMPLE8ad863723b62cc8901a8aa6e794ae0d2", "createdAt": 1571259453.795, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "RelationalDatabase", "tags": [], "relationalDatabaseBlueprintId": "mysql_8_0", "relationalDatabaseBundleId": "micro_1_0", "masterDatabaseName": "dbmaster", "hardware": { "cpuCount": 1, "diskSizeInGb": 40, "ramSizeInGb": 1.0 }, "state": "available", "backupRetentionEnabled": false, "pendingModifiedValues": {}, "engine": "mysql", "engineVersion": "8.0.16", "masterUsername": "dbmasteruser", "parameterApplyStatus": "in-sync", "preferredBackupWindow": "10:01-10:31", "preferredMaintenanceWindow": "sat:11:14-sat:11:44", "publiclyAccessible": true, "masterEndpoint": { "port": 3306, "address": "ls-9EXAMPLE8ad863723b62ccEXAMPLEa6e794ae0d2.czowadgeezqi.us-west-2.rds.amazonaws.com" }, "pendingMaintenanceActions": [] } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabase
。
-
下列程式碼範例示範如何使用 get-relational-databases
。
- AWS CLI
-
取得所有關聯式資料庫的相關資訊
下列
get-relational-databases
範例顯示已設定 AWS 區域中所有關聯式資料庫的詳細資訊。aws lightsail get-relational-databases
輸出:
{ "relationalDatabases": [ { "name": "MySQL", "arn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabase/8529020c-3ab9-4d51-92af-5EXAMPLE8979", "supportCode": "6EXAMPLE3362/ls-3EXAMPLEa995d8c3b06b4501356e5f2f28e1aeba", "createdAt": 1554306019.155, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "RelationalDatabase", "tags": [], "relationalDatabaseBlueprintId": "mysql_8_0", "relationalDatabaseBundleId": "micro_1_0", "masterDatabaseName": "dbmaster", "hardware": { "cpuCount": 1, "diskSizeInGb": 40, "ramSizeInGb": 1.0 }, "state": "available", "backupRetentionEnabled": true, "pendingModifiedValues": {}, "engine": "mysql", "engineVersion": "8.0.15", "latestRestorableTime": 1571686200.0, "masterUsername": "dbmasteruser", "parameterApplyStatus": "in-sync", "preferredBackupWindow": "07:51-08:21", "preferredMaintenanceWindow": "tue:12:18-tue:12:48", "publiclyAccessible": true, "masterEndpoint": { "port": 3306, "address": "ls-3EXAMPLEa995d8c3b06b4501356e5f2fEXAMPLEa.czowadgeezqi.us-west-2.rds.amazonaws.com" }, "pendingMaintenanceActions": [] }, { "name": "Postgres", "arn": "arn:aws:lightsail:us-west-2:111122223333:RelationalDatabase/e9780b6b-d0ab-4af2-85f1-1EXAMPLEac68", "supportCode": "6EXAMPLE3362/ls-3EXAMPLEb4fffb5cec056220c734713e14bd5fcd", "createdAt": 1554306000.814, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "resourceType": "RelationalDatabase", "tags": [], "relationalDatabaseBlueprintId": "postgres_11", "relationalDatabaseBundleId": "micro_1_0", "masterDatabaseName": "dbmaster", "hardware": { "cpuCount": 1, "diskSizeInGb": 40, "ramSizeInGb": 1.0 }, "state": "available", "backupRetentionEnabled": true, "pendingModifiedValues": {}, "engine": "postgres", "engineVersion": "11.1", "latestRestorableTime": 1571686339.0, "masterUsername": "dbmasteruser", "parameterApplyStatus": "in-sync", "preferredBackupWindow": "06:19-06:49", "preferredMaintenanceWindow": "sun:10:19-sun:10:49", "publiclyAccessible": false, "masterEndpoint": { "port": 5432, "address": "ls-3EXAMPLEb4fffb5cec056220c734713eEXAMPLEd.czowadgeezqi.us-west-2.rds.amazonaws.com" }, "pendingMaintenanceActions": [] } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetRelationalDatabases
。
-
下列程式碼範例示範如何使用 get-static-ip
。
- AWS CLI
-
取得靜態 IP 的相關資訊
下列
get-static-ip
範例顯示指定靜態 IP 的詳細資訊。aws lightsail get-static-ip \ --static-ip-name
StaticIp-1
輸出:
{ "staticIp": { "name": "StaticIp-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:StaticIp/2257cd76-1f0e-4ac0-82e2-2EXAMPLE23ad", "supportCode": "6EXAMPLE3362/192.0.2.0", "createdAt": 1571071325.076, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "StaticIp", "ipAddress": "192.0.2.0", "isAttached": false } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetStaticIp
。
-
下列程式碼範例示範如何使用 get-static-ips
。
- AWS CLI
-
取得所有靜態 IPs 的相關資訊
下列
get-static-ips
範例顯示已設定 AWS 區域中所有靜態 IPs 的詳細資訊。aws lightsail get-static-ips
輸出:
{ "staticIps": [ { "name": "StaticIp-1", "arn": "arn:aws:lightsail:us-west-2:111122223333:StaticIp/2257cd76-1f0e-4ac0-8EXAMPLE16f9423ad", "supportCode": "6EXAMPLE3362/192.0.2.0", "createdAt": 1571071325.076, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "StaticIp", "ipAddress": "192.0.2.0", "isAttached": false }, { "name": "StaticIP-2", "arn": "arn:aws:lightsail:us-west-2:111122223333:StaticIp/c61edb40-e5f0-4fd6-ae7c-8EXAMPLE19f8", "supportCode": "6EXAMPLE3362/192.0.2.2", "createdAt": 1568305385.681, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "resourceType": "StaticIp", "ipAddress": "192.0.2.2", "attachedTo": "WordPress-1", "isAttached": true } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 GetStaticIps
。
-
下列程式碼範例示範如何使用 is-vpc-peered
。
- AWS CLI
-
識別您的 Amazon Lightsail 虛擬私有雲端是否對等
下列
is-vpc-peered
範例會傳回指定 AWS 區域的 Amazon Lightsail 虛擬私有雲端 (VPC) 對等狀態。aws lightsail is-vpc-peered \ --region
us-west-2
輸出:
{ "isPeered": true }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 IsVpcPeered
。
-
下列程式碼範例示範如何使用 open-instance-public-ports
。
- AWS CLI
-
開啟執行個體的防火牆連接埠
下列
open-instance-public-ports
範例會在指定的執行個體上開啟 TCP 連接埠 22。aws lightsail open-instance-public-ports \ --instance-name
MEAN-2
\ --port-infofromPort=22,protocol=TCP,toPort=22
輸出:
{ "operation": { "id": "719744f0-a022-46f2-9f11-6EXAMPLE4642", "resourceName": "MEAN-2", "resourceType": "Instance", "createdAt": 1571072906.849, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "22/tcp", "operationType": "OpenInstancePublicPorts", "status": "Succeeded", "statusChangedAt": 1571072906.849 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 OpenInstancePublicPorts
。
-
下列程式碼範例示範如何使用 peer-vpc
。
- AWS CLI
-
對等 Amazon Lightsail 虛擬私有雲端
下列
peer-vpc
範例與指定 AWS 區域的 Amazon Lightsail 虛擬私有雲端 (VPC) 對等。aws lightsail peer-vpc \ --region
us-west-2
輸出:
{ "operation": { "id": "787e846a-54ac-497f-bce2-9EXAMPLE5d91", "resourceName": "vpc-0EXAMPLEa5261efb3", "resourceType": "PeeredVpc", "createdAt": 1571694233.104, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "vpc-e2b3eb9b", "operationType": "PeeredVpc", "status": "Succeeded", "statusChangedAt": 1571694233.104 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 PeerVpc
。
-
下列程式碼範例示範如何使用 reboot-instance
。
- AWS CLI
-
若要重新啟動執行個體
下列
reboot-instance
範例會重新啟動指定的執行個體。aws lightsail reboot-instance \ --instance-name
MEAN-1
輸出:
{ "operations": [ { "id": "2b679f1c-8b71-4bb4-8e97-8EXAMPLEed93", "resourceName": "MEAN-1", "resourceType": "Instance", "createdAt": 1571694445.49, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "", "operationType": "RebootInstance", "status": "Succeeded", "statusChangedAt": 1571694445.49 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 RebootInstance
。
-
下列程式碼範例示範如何使用 reboot-relational-database
。
- AWS CLI
-
重新啟動關聯式資料庫
下列
reboot-relational-database
範例會重新啟動指定的關聯式資料庫。aws lightsail reboot-relational-database \ --relational-database-name
Database-1
輸出:
{ "operations": [ { "id": "e4c980c0-3137-496c-9c91-1EXAMPLEdec2", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1571694532.91, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationDetails": "", "operationType": "RebootRelationalDatabase", "status": "Started", "statusChangedAt": 1571694532.91 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 RebootRelationalDatabase
。
-
下列程式碼範例示範如何使用 release-static-ip
。
- AWS CLI
-
刪除靜態 IP
下列
release-static-ip
範例會刪除指定的靜態 IP。aws lightsail release-static-ip \ --static-ip-name
StaticIp-1
輸出:
{ "operations": [ { "id": "e374c002-dc6d-4c7f-919f-2EXAMPLE13ce", "resourceName": "StaticIp-1", "resourceType": "StaticIp", "createdAt": 1571694962.003, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationType": "ReleaseStaticIp", "status": "Succeeded", "statusChangedAt": 1571694962.003 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ReleaseStaticIp
。
-
下列程式碼範例示範如何使用 start-instance
。
- AWS CLI
-
啟動執行個體
下列
start-instance
範例會啟動指定的執行個體。aws lightsail start-instance \ --instance-name
WordPress-1
輸出:
{ "operations": [ { "id": "f88d2a93-7cea-4165-afce-2d688cb18f23", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1571695583.463, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "StartInstance", "status": "Started", "statusChangedAt": 1571695583.463 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 StartInstance
。
-
下列程式碼範例示範如何使用 start-relational-database
。
- AWS CLI
-
啟動關聯式資料庫
下列
start-relational-database
範例會啟動指定的關聯式資料庫。aws lightsail start-relational-database \ --relational-database-name
Database-1
輸出:
{ "operations": [ { "id": "4d5294ec-a38a-4fda-9e37-aEXAMPLE0d24", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1571695998.822, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "StartRelationalDatabase", "status": "Started", "statusChangedAt": 1571695998.822 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 StartRelationalDatabase
。
-
下列程式碼範例示範如何使用 stop-instance
。
- AWS CLI
-
停止執行個體
下列
stop-instance
範例會停止指定的執行個體。aws lightsail stop-instance \ --instance-name
WordPress-1
輸出:
{ "operations": [ { "id": "265357e2-2943-4d51-888a-1EXAMPLE7585", "resourceName": "WordPress-1", "resourceType": "Instance", "createdAt": 1571695471.134, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "StopInstance", "status": "Started", "statusChangedAt": 1571695471.134 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 StopInstance
。
-
下列程式碼範例示範如何使用 stop-relational-database
。
- AWS CLI
-
停止關聯式資料庫
下列
stop-relational-database
範例會停止指定的關聯式資料庫。aws lightsail stop-relational-database \ --relational-database-name
Database-1
輸出:
{ "operations": [ { "id": "cc559c19-4adb-41e4-b75b-5EXAMPLE4e61", "resourceName": "Database-1", "resourceType": "RelationalDatabase", "createdAt": 1571695526.29, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "isTerminal": false, "operationType": "StopRelationalDatabase", "status": "Started", "statusChangedAt": 1571695526.29 } ] }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 StopRelationalDatabase
。
-
下列程式碼範例示範如何使用 unpeer-vpc
。
- AWS CLI
-
取消對等 Amazon Lightsail 虛擬私有雲端
下列
unpeer-vpc
範例會取消指定 AWS 區域的 Amazon Lightsail 虛擬私有雲端 (VPC)。aws lightsail unpeer-vpc \ --region
us-west-2
輸出:
{ "operation": { "id": "531aca64-7157-47ab-84c6-eEXAMPLEd898", "resourceName": "vpc-0EXAMPLEa5261efb3", "resourceType": "PeeredVpc", "createdAt": 1571694109.945, "location": { "availabilityZone": "all", "regionName": "us-west-2" }, "isTerminal": true, "operationDetails": "vpc-e2b3eb9b", "operationType": "UnpeeredVpc", "status": "Succeeded", "statusChangedAt": 1571694109.945 } }
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 UnpeerVpc
。
-