Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
CLI로 CreateSnapshot
사용
다음 코드 예제는 CreateSnapshot
의 사용 방법을 보여 줍니다.
- CLI
-
- AWS CLI
-
스냅샷 생성
이 예시에서는 볼륨 ID가
vol-1234567890abcdef0
의 볼륨 스냅샷과 스냅샷을 식별할 수 있는 간단한 설명을 생성합니다.명령:
aws ec2 create-snapshot --volume-id
vol-1234567890abcdef0
--description"This is my root volume snapshot"
출력:
{ "Description": "This is my root volume snapshot", "Tags": [], "Encrypted": false, "VolumeId": "vol-1234567890abcdef0", "State": "pending", "VolumeSize": 8, "StartTime": "2018-02-28T21:06:01.000Z", "Progress": "", "OwnerId": "012345678910", "SnapshotId": "snap-066877671789bd71b" }
태그를 사용하여 스냅샷 생성
이 예시에서는 스냅샷을 생성하고 purpose=prod 및 costcenter=123이라는 두 개의 태그를 적용합니다.
명령:
aws ec2 create-snapshot --volume-id
vol-1234567890abcdef0
--description 'Prod backup
' --tag-specifications 'ResourceType=snapshot,Tags=[{Key=purpose,Value=prod},{Key=costcenter,Value=123}]
'출력:
{ "Description": "Prod backup", "Tags": [ { "Value": "prod", "Key": "purpose" }, { "Value": "123", "Key": "costcenter" } ], "Encrypted": false, "VolumeId": "vol-1234567890abcdef0", "State": "pending", "VolumeSize": 8, "StartTime": "2018-02-28T21:06:06.000Z", "Progress": "", "OwnerId": "012345678910", "SnapshotId": "snap-09ed24a70bc19bbe4" }
-
API 세부 정보는 AWS CLI 명령 참조의 CreateSnapshot
섹션을 참조하세요.
-
- PowerShell
-
- PowerShell용 도구
-
예제 1:이 예제에서는 지정된 볼륨의 스냅샷을 생성합니다.
New-EC2Snapshot -VolumeId vol-12345678 -Description "This is a test"
출력:
DataEncryptionKeyId : Description : This is a test Encrypted : False KmsKeyId : OwnerAlias : OwnerId : 123456789012 Progress : SnapshotId : snap-12345678 StartTime : 12/22/2015 1:28:42 AM State : pending StateMessage : Tags : {} VolumeId : vol-12345678 VolumeSize : 20
-
API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조의 CreateSnapshot을 참조하세요.
-
CreateSecurityGroup
CreateSpotDatafeedSubscription