New user sign up using AWS Builder ID
New user sign up using AWS Builder ID is currently unavailable on re:Post. To sign up, please use the AWS Management Console instead.
AWS CLI를 사용하여 Lightsail 인스턴스에서 고정 IP 주소를 관리하려면 어떻게 해야 하나요?
AWS CLI를 사용하여 Amazon Lightsail 인스턴스에서 고정 IP 주소를 분리하고 새 Lightsail 인스턴스에 연결하려고 합니다.
간략한 설명
Lightsail AWS Command Line Interface(AWS CLI) 명령 목록은 AWS CLI Command Reference 및 Amazon Lightsail API Reference를 참조하세요.
중요:
- AWS CLI 명령을 실행할 때 오류가 발생하면, AWS CLI 오류 문제 해결을 참조하세요. 또한 최신 AWS CLI 버전을 사용하고 있는지 확인하세요.
- AWS CLI는 기본적으로 JSON을 출력합니다. 기본값을 사용하거나 명령에 --output json을 추가하여 출력을 받을 수 있습니다. 자세한 내용은 ](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output.html#cli-usage-output-filter)AWS CLI의 명령 출력 제어[를 참조하세요.
- AWS CLI 오류를 해결하는 방법에 대한 일반적인 내용은 AWS CLI 명령을 실행할 때 오류가 발생하는 이유는 무엇인가요?를 참조하세요.
AWS CLI 출력에는 타임스탬프가 Unix Epoch 시간으로 표시됩니다. 다음 방법 중 하나를 사용하여 타임스탬프를 UTC로 변환합니다.
macOS:
타임스탬프에서 소수점을 제거하고 소수점 오른쪽에 있는 모든 숫자를 제거한 후 다음 명령을 실행합니다.
# date -r 1602175741 -u Thu Oct 8 16:49:01 UTC 2020
Linux:
다음 명령을 실행합니다.
# date -d @1602175741.603 -u Thu Oct 8 16:49:01 UTC 2020
Windows:
EpochConverter 웹 사이트의 epoch 및 Unix 타임스탬프 변환 도구와 같은 변환 도구를 사용하여 타임스탬프를 변경합니다.
해결 방법
기존 Lightsail 인스턴스에서 고정 IP 주소 분리
detach-static-ip 명령을 실행하여 인스턴스에서 고정 IP 주소를 분리합니다.
# aws lightsail detach-static-ip --static-ip-name StaticIpForTestLightsailInstance1 --region eu-west-1 { "operations": [ { "id": "c86e552e-c21a-4cdf-aa68-05fb20574e8b", "resourceName": "StaticIpForTestLightsailInstance1", "resourceType": "StaticIp", "createdAt": 1602182597.168, "location": { "availabilityZone": "all", "regionName": "eu-west-1" }, "isTerminal": true, "operationDetails": "TestLightsailInstance1", "operationType": "DetachStaticIp", "status": "Succeeded", "statusChangedAt": 1602182597.168 }, { "id": "4b9dcaa7-be3a-4dfd-8ac0-32f0238c0833", "resourceName": "TestLightsailInstance1", "resourceType": "Instance", "createdAt": 1602182597.17, "location": { "availabilityZone": "eu-west-1a", "regionName": "eu-west-1" }, "isTerminal": true, "operationDetails": "StaticIpForTestLightsailInstance1", "operationType": "DetachStaticIp", "status": "Succeeded", "statusChangedAt": 1602182597.17 } ] }
참고: 앞의 예제에서 --static-ip-name 및 --region을 자신의 값으로 바꿉니다. 이 예제에서는 eu-west-1 AWS 리전의 인스턴스에서 고정 IP 주소를 분리합니다.
고정 IP 주소를 새 Lightsail 인스턴스에 연결
고정 IP 주소를 Lightsail 인스턴스에 연결하려면 다음 단계를 완료하세요.
- attach-static-ip 명령을 실행합니다.
참고: 이전 명령에서 --static-ip-name, --instance-name 및 --region을 자신의 값으로 바꿉니다. 이 명령은 백업을 사용하여 고정 IP 주소를 새 인스턴스에 연결합니다.# aws lightsail attach-static-ip --static-ip-name StaticIpForTestLightsailInstance1 --instance-name RestoredTestLightsailInstance1-New --region eu-west-1 { "operations": [ { "id": "192c4917-c332-49c8-88ab-60484a42c98f", "resourceName": "StaticIpForTestLightsailInstance1", "resourceType": "StaticIp", "createdAt": 1602182686.46, "location": { "availabilityZone": "all", "regionName": "eu-west-1" }, "isTerminal": true, "operationDetails": "RestoredTestLightsailInstance1-New", "operationType": "AttachStaticIp", "status": "Succeeded", "statusChangedAt": 1602182686.46 }, { "id": "fb93c012-e3a2-4908-8746-01a4ae018440", "resourceName": "RestoredTestLightsailInstance1-New", "resourceType": "Instance", "createdAt": 1602182686.463, "location": { "availabilityZone": "eu-west-1a", "regionName": "eu-west-1" }, "isTerminal": true, "operationDetails": "StaticIpForTestLightsailInstance1", "operationType": "AttachStaticIp", "status": "Succeeded", "statusChangedAt": 1602182686.463 } ]
- get-instances 명령을 실행하여 고정 IP 주소가 인스턴스에 할당되었는지 확인합니다.
# aws lightsail get-instances --region eu-west-1 --query 'instances[].{name:name,createdAt:createdAt,blueprintId:blueprintId,bundleid:bundleId,blueprintName:blueprintName,publicIpAddress:publicIpAddress,InstanceID:supportCode}' --output table ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | GetInstances | +----------------------------------+------------------+----------------+------------+-----------------+------------------------------------------+-------------------+ | InstanceID | blueprintId | blueprintName | bundleid | createdAt | name | publicIpAddress | +----------------------------------+------------------+----------------+------------+-----------------+------------------------------------------+-------------------+ | 11178xxxxxxx/i-09f6xxxx| wordpress | WordPress | large_2_0 | 1602182374.625 | RestoredTestLightsailInstance1-New | 52.210.xx.xx | +----------------------------------+------------------+----------------+------------+-----------------+------------------------------------------+-------------------+
관련 정보
AWS CLI 명령을 사용하여 Lightsail 인스턴스를 관리하려면 어떻게 해야 하나요?
AWS CLI 명령을 사용하여 스냅샷을 관리하고 Lightsail 인스턴스에 대한 백업을 생성하려면 어떻게 해야 하나요?

관련 콘텐츠
- 질문됨 10달 전lg...
- 질문됨 일 년 전lg...
- 질문됨 한 달 전lg...
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 일 년 전