FreePBX 가상 머신(VM)에서 Amazon 머신 이미지(AMI) 생성
전제 조건
지침
1. here에서 최신 FreePBX Distro를 다운로드하여 VMware Workstation에 설치합니다.
2. SSH를 통해 인스턴스에 연결하고 다음 패키지를 설치합니다.
yum install -y cloud-init cloud-utils-growpart
3.
/etc/cloud/cloud.cfg
파일을 다음과 같이 수정합니다.system_info:
default_user:
name: asterisk
lock_passwd: true
gecos: Asterisk User
groups: [wheel, adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
distro: rhel
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
4./etc/ssh/sshd_config 파일을 다음과 같이 변경합니다.
PasswordAuthentication no
PermitRootLogin no
UseDNS no
5. VM을 종료하고 OVA 파일로 내보냅니다.

6. S3 버킷을 생성하고 AWS CLI 또는 S3 클라이언트를 사용하여 내보낸 OVA 파일을 업로드합니다. 저는 Cyberduck S3 클라이언트를 사용했으며 [여기( https://cyberduck.io/download/ )]에서 무료로 사용할 수 있습니다.
7. 다음 정책 문서를 생성해야 합니다. 구성에 따라 S3 버킷 및 OVA 파일 이름을 변경해야 합니다. 이 예에서 S3 버킷 이름과 OVA 파일 이름은 각각 ami-storage와 FreePBX.ova입니다.
7.A. trust-policy.json을 만듭니다. 이는 vmimport IAM 역할을 생성하는 데 사용됩니다.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "vmie.amazonaws.com" },
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals":{
"sts:Externalid": "vmimport"
}
}
}
]
}
# Create vmimport IAM role
aws iam create-role --role-name vmimport --assume-role-policy-document file://trust-policy.json
7.B. 역할 정책.json을 만듭니다. 필요한 IAM 정책을 vmimport 역할에 할당하는 데 사용됩니다.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::ami-storage"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::ami-storage/*"
]
},
{
"Effect": "Allow",
"Action":[
"ec2:ModifySnapshotAttribute",
"ec2:CopySnapshot",
"ec2:RegisterImage",
"ec2:Describe*"
],
"Resource": "*"
}
]
}
# Create and assign necessary IAM policies to the vmimport role
aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document file://role-policy.json
7.C. containers.json을 만듭니다. 이것은 업로드된 OVA에서 AMI를 생성하는 데 사용됩니다.
[
{
"Description": "FreePBX",
"Format": "ova",
"UserBucket": {
"S3Bucket": "ami-storage",
"S3Key": "FreePBX.ova"
}
}
]
# Generate an AMI from the uploaded OVA
aws ec2 import-image --description "FreePBX" --license-type BYOL --disk-containers file://containers.json
7.D. 이전 작업의 예상 완료 시간은 15~60분입니다. 위 명령어에 표시된 ImportTaskId를 교체하면 다음 명령어로 진행 상황을 확인할 수 있습니다.
aws ec2 describe-import-image-tasks --import-task-ids import-ami-0b900a870c359a58f
7.E. 작업은 완료될 때까지
"StatusMessage": "pending"
활성 상태를 유지합니다. "Progress"
속성은 해당 지점까지의 작업 비율을 나타냅니다. 상태가 "completed"
로 전환되고 이전 명령이 이미지를 AMI 형식으로 변환하는 데 대한 추가 정보를 제공하면 S3 버킷을 만든 동일한 리전에서 사용할 수 있는 새 AMI가 제공됩니다. FreePBX EC2 인스턴스를 프로비저닝하는 데 사용할 수 있습니다.게시물이 마음에 드셨다면 제 첫 번째 커피를 구매하실 수 있습니다. 미리 감사드립니다. :)

참조
1. Importing a VM as an Image Using VM Import/Export
2. How to create a Sentilo AWS EC2 instance from an OVA file
3. FreePBX Tango Scenes by Crisy Meschieri
Reference
이 문제에 관하여(FreePBX 가상 머신(VM)에서 Amazon 머신 이미지(AMI) 생성), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/aws-builders/create-an-amazon-machine-image-ami-from-a-freepbx-virtual-machine-vm-3ok3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)