CLI로 RunScheduledInstances 사용 - Amazon Elastic Compute Cloud

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

CLI로 RunScheduledInstances 사용

다음 코드 예제는 RunScheduledInstances의 사용 방법을 보여 줍니다.

CLI
AWS CLI

정기 인스턴스 시작

이 예시에서는 VPC에서 지정된 정기 인스턴스를 시작합니다.

명령:

aws ec2 run-scheduled-instances --scheduled-instance-id sci-1234-1234-1234-1234-123456789012 --instance-count 1 --launch-specification file://launch-specification.json

Launch-specification.json:

{ "ImageId": "ami-12345678", "KeyName": "my-key-pair", "InstanceType": "c4.large", "NetworkInterfaces": [ { "DeviceIndex": 0, "SubnetId": "subnet-12345678", "AssociatePublicIpAddress": true, "Groups": ["sg-12345678"] } ], "IamInstanceProfile": { "Name": "my-iam-role" } }

출력:

{ "InstanceIdSet": [ "i-1234567890abcdef0" ] }

이 예시에서는 EC2-Classic에서 지정된 정기 인스턴스를 시작합니다.

명령:

aws ec2 run-scheduled-instances --scheduled-instance-id sci-1234-1234-1234-1234-123456789012 --instance-count 1 --launch-specification file://launch-specification.json

Launch-specification.json:

{ "ImageId": "ami-12345678", "KeyName": "my-key-pair", "SecurityGroupIds": ["sg-12345678"], "InstanceType": "c4.large", "Placement": { "AvailabilityZone": "us-west-2b" } "IamInstanceProfile": { "Name": "my-iam-role" } }

출력:

{ "InstanceIdSet": [ "i-1234567890abcdef0" ] }
PowerShell
PowerShell용 도구

예제 1:이 예제에서는 지정된 예약된 인스턴스를 시작합니다.

New-EC2ScheduledInstance -ScheduledInstanceId sci-1234-1234-1234-1234-123456789012 -InstanceCount 1 ` -IamInstanceProfile_Name my-iam-role ` -LaunchSpecification_ImageId ami-12345678 ` -LaunchSpecification_InstanceType c4.large ` -LaunchSpecification_SubnetId subnet-12345678` -LaunchSpecification_SecurityGroupId sg-12345678
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조RunScheduledInstances를 참조하세요.

AWS SDK 개발자 가이드 및 코드 예제의 전체 목록은 섹션을 참조하세요를 사용하여 Amazon EC2 리소스 생성 AWS SDK. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.