클라우드 관리자는 AWS(Amazon Web Services) 플러그인을 활용하여 인프라를 구축할 때 플러그인 기반 EC2 인스턴스를 프로비저닝할 수 있습니다. 할당 도우미를 사용하여 인스턴스에 대한 할당 논리를 제공할 수도 있습니다.
최신 AWS 속성을 사용하여 인프라 요구 사항을 지원하도록 EC2 인스턴스를 쉽게 구성할 수 있습니다. 예를 들어 상태 점검에 실패할 경우 인스턴스를 자동으로 복구하려면 프로비저닝 중에 템플릿에서 auto_recovery_enabled 속성을 사용할 수 있습니다.
VMware Aria Automation의 플러그인 및 할당에 대한 자세한 내용은 Automation Assembler의 플러그인 기반 설계 및 배포의 내용을 참조하십시오.
EC2 인스턴스 속성
플러그인 기반 EC2 인스턴스 리소스에는 다음 속성이 필요합니다.
| 속성 | 설명 |
|---|---|
name |
인스턴스의 이름입니다. |
region |
인스턴스가 배포될 지역입니다. |
account |
팀에서 템플릿을 배포하는 AWS 클라우드 계정입니다. 자세한 내용은 VMware Aria Automation에서 Amazon Web Services 클라우드 계정 생성 항목을 참조하십시오. |
image_id |
인스턴스에 사용할 AMI의 ID입니다. |
다음 섹션에는 EC2 인스턴스를 프로비저닝하기 위한 예제 템플릿이 포함되어 있습니다.
단순 EC2 인스턴스 프로비저닝
다음 템플릿은 모든 속성에 대해 정적으로 구성된 값을 사용하여 EC2 인스턴스를 프로비저닝하는 방법을 보여줍니다.
formatVersion: 1
inputs: {}
resources:
Idem_AWS_EC2_INSTANCE_1:
type: Idem.AWS.EC2.INSTANCE
properties:
name: my-instance-1
region: us-east-1
account: AWS
image_id: ami-0aa7d40eeae50c9a9
availability_zone: us-east-1a
instance_type: t2.small
subnet_id: subnet-07d2c529b6336bd0e
할당 도우미를 사용하여 EC2 인스턴스 프로비저닝
다음 템플릿은 여러 할당 도우미를 사용하여 EC2 인스턴스를 프로비저닝하는 방법을 보여줍니다.
도우미 1개로 여러 리소스에 할당 논리(예: 영역 배치)를 제공하는 일대다 구성으로 도우미를 사용할 수 있습니다. 그런 다음에는 클라우드 제공자가 정의하고 연결된 플러그인에서 지원하는 속성의 전체 목록에 따라 리소스를 추가로 사용자 지정합니다.
이 예에서는 계산 도우미, 버전 도우미, 이미지 도우미 및 네트워크 도우미를 사용합니다.
formatVersion: 1
inputs:
instance_name:
type: string
resources:
Allocations_Compute_1:
type: Allocations.Compute
properties:
constraints:
- tag: env:dev
Allocations_Flavor_1:
type: Allocations.Flavor
properties:
flavor: small
Allocations_Image_1:
type: Allocations.Image
properties:
image: ubuntu
Allocations_Network_1:
type: Allocations.Network
properties:
networkType: existing
constraints:
- tag: alternative-net
Idem_AWS_EC2_INSTANCE_1:
type: Idem.AWS.EC2.INSTANCE
properties:
name: ${input.instance_name}
region: ${resource.Allocations_Compute_1.selectedRegion.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
image_id: ${resource.Allocations_Image_1.selectedImageId}
availability_zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
instance_type: ${resource.Allocations_Flavor_1.selectedInstanceTypeName}
subnet_id: ${resource.Allocations_Network_1.selectedSubnet.id}
AWS 볼륨을 사용하여 EC2 인스턴스 프로비저닝
다음 템플릿은 볼륨이 연결된 EC2 인스턴스를 프로비저닝하는 방법을 보여줍니다. 이 예에서는 플러그인 기반 인스턴스 2개와 플러그인 기반 AWS 볼륨을 프로비저닝합니다. AWS 볼륨은 인스턴스 중 하나에 연결되고 클래식 KMS 키로 암호화됩니다.
AWS 볼륨과 KMS 키는 모두 속성 바인딩을 사용하여 동일한 할당 도우미를 참조합니다. 속성 바인딩을 사용하면 리소스가 올바른 계정 및 지역에 프로비저닝됩니다.
formatVersion: 1
inputs:
instance_name:
type: string
instance2_name:
type: string
volume_name:
type: string
resources:
Allocations_Compute_1:
type: Allocations.Compute
properties:
constraints:
- tag: env:dev
Allocations_Flavor_1:
type: Allocations.Flavor
properties:
flavor: small
Allocations_Image_1:
type: Allocations.Image
properties:
image: ubuntu
Allocations_Network_1:
type: Allocations.Network
properties:
networkType: existing
constraints:
- tag: alternative-net
Idem_AWS_EC2_INSTANCE_1:
type: Idem.AWS.EC2.INSTANCE
properties:
name: ${input.instance_name}
region: ${resource.Allocations_Compute_1.selectedRegion.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
image_id: ${resource.Allocations_Image_1.selectedImageId}
availability_zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
instance_type: ${resource.Allocations_Flavor_1.selectedInstanceTypeName}
subnet_id: ${resource.Allocations_Network_1.selectedSubnet.id}
Idem_AWS_EC2_INSTANCE_2:
type: Idem.AWS.EC2.INSTANCE
properties:
name: ${input.instance2_name}
region: ${resource.Allocations_Compute_1.selectedRegion.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
image_id: ${resource.Allocations_Image_1.selectedImageId}
availability_zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
instance_type: ${resource.Allocations_Flavor_1.selectedInstanceTypeName}
subnet_id: ${resource.Allocations_Network_1.selectedSubnet.id}
block_device_mappings:
- volume_id: ${resource.Idem_AWS_EC2_VOLUME_1.resource_id}
device_name: /dev/sdb
Idem_AWS_EC2_VOLUME_1:
type: Idem.AWS.EC2.VOLUME
properties:
name: ${input.volume_name}
region: ${resource.Allocations_Compute_1.selectedRegion.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
availability_zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
size: 10
volume_type: io2
iops: 100
encrypted: true
kms_key_id: ${resource.Cloud_Service_AWS_KMS_Key_1.key_id}
Cloud_Service_AWS_KMS_Key_1:
type: Cloud.Service.AWS.KMS.Key
properties:
region: ${resource.Allocations_Compute_1.selectedRegion.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}