Update VM_to_AMIs.md

Update directories to reflect new folder structure
This commit is contained in:
Chris Long
2020-06-25 17:11:04 -07:00
committed by GitHub
parent e815bf2930
commit 0793270c91

View File

@@ -18,28 +18,28 @@ The supplied Terraform configuration can then be used to create EC2 instances an
4. For the VM importation to work, you must create a role named `vmimport` with a trust relationship policy document that allows VM Import to assume the role, and you must attach an IAM policy to the role: 4. For the VM importation to work, you must create a role named `vmimport` with a trust relationship policy document that allows VM Import to assume the role, and you must attach an IAM policy to the role:
```aws iam create-role --role-name vmimport --assume-role-policy-document file:///path/to/DetectionLab/Terraform/vm_import/trust-policy.json``` ```aws iam create-role --role-name vmimport --assume-role-policy-document file:///path/to/DetectionLab/AWS/Terraform/vm_import/trust-policy.json```
5. Edit `/path/to/DetectionLab/Terraform/vm_import/role-policy.json` and insert the name of the bucket you created in step 3 on lines 12-13, replacing `YOUR_BUCKET_GOES_HERE` with the name of your bucket. 5. Edit `/path/to/DetectionLab/AWS/Terraform/vm_import/role-policy.json` and insert the name of the bucket you created in step 3 on lines 12-13, replacing `YOUR_BUCKET_GOES_HERE` with the name of your bucket.
6. Use the create-role command to create a role named vmimport and give VM Import/Export access to it: 6. Use the create-role command to create a role named vmimport and give VM Import/Export access to it:
```aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document file:///path/to/DetectionLab/Terraform/vm_import/role-policy.json``` ```aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document file:///path/to/DetectionLab/AWS/Terraform/vm_import/role-policy.json```
7. Export the DetectionLab VMs as single file OVA files if they are not already in that format 7. Export the DetectionLab VMs as single file OVA files if they are not already in that format
8. [Upload the OVAs to the S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/upload-objects.html) you created in step three 8. [Upload the OVAs to the S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/upload-objects.html) you created in step three
9. Edit the `dc.json`, `wef.json` and `win10.json` files and modify the S3Bucket and S3Key headers to match the location of the OVA files in your S3 bucket. 9. Edit the `dc.json`, `wef.json` and `win10.json` files and modify the S3Bucket and S3Key headers to match the location of the OVA files in your S3 bucket.
10. Import the VMs from S3 as AMIs by running the following commands: 10. Import the VMs from S3 as AMIs by running the following commands:
``` ```
aws ec2 import-image --description "dc" --license-type byol --disk-containers file:///path/to/DetectionLab/Terraform/vm_import/dc.json aws ec2 import-image --description "dc" --license-type byol --disk-containers file:///path/to/DetectionLab/AWS/Terraform/vm_import/dc.json
aws ec2 import-image --description "wef" --license-type byol --disk-containers file:///path/to/DetectionLab/Terraform/vm_import/wef.json aws ec2 import-image --description "wef" --license-type byol --disk-containers file:///path/to/DetectionLab/AWS/Terraform/vm_import/wef.json
aws ec2 import-image --description "win10" --license-type byol --disk-containers file:///path/to/DetectionLab/Terraform/vm_import/win10.json aws ec2 import-image --description "win10" --license-type byol --disk-containers file:///path/to/DetectionLab/AWS/Terraform/vm_import/win10.json
``` ```
11. Check on the status of the importation with the following command: 11. Check on the status of the importation with the following command:
```aws ec2 describe-import-image-tasks --import-task-ids <import-ami-xxxxxxxxxxxxxxxxx>``` ```aws ec2 describe-import-image-tasks --import-task-ids <import-ami-xxxxxxxxxxxxxxxxx>```
12. Copy the file at [/DetectionLab/Terraform/terraform.tfvars.example](./terraform.tfvars.example) to `/DetectionLab/Terraform/terraform.tfvars` 12. Copy the file at [/DetectionLab/AWS/Terraform/terraform.tfvars.example](./terraform.tfvars.example) to `/DetectionLab/AWS/Terraform/terraform.tfvars`
13. Fill out the variables in `/DetectionLab/Terraform/terraform.tfvars` 13. Fill out the variables in `/DetectionLab/AWS/Terraform/terraform.tfvars`
14. Run `terraform init` to setup the initial Terraform configuration 14. Run `terraform init` to setup the initial Terraform configuration
15. cd to `DetectionLab/Terraform` and run `terraform apply` 15. cd to `DetectionLab/AWS/Terraform` and run `terraform apply`