Prepare the service account
Published: August 20, 2025
Last Update: August 20, 2025
To import and convert the file on the EC2 service, you will need specific policies and roles assigned to a specific user within AWS. Since AWS' recommendation (and also ours) is not to create access keys for the root user, we'll create a separate user on the IAM dashboard only for this process.
The following steps will help you configure all the necessary settings to connect to AWS via command line.
For the following steps, you need access to the IAM Dashboard within the AWS account. If you don't have access to it, please contact your company's AWS administrator to complete the following steps
Policy Creation
- Access to your AWS' console and search for IAM on the top search bar. Access to the one called only "IAM"
- On the left navigation menu, under Access management select
Policies
, then, click onCreate Policy
- On the
Specify permissions
page, click theJSON
button. - Using the JSON policy editor, input the following JSON.
Change the field [[YourBucketName]]
with the name of the bucket you created in the steps previous section
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject",
"s3:GetBucketAcl"
],
"Resource": [
"arn:aws:s3:::[[YourBucketName]]",
"arn:aws:s3:::[[YourBucketName]]/*"
]
},
{
"Effect": "Allow",
"Action": [
"ec2:ModifySnapshotAttribute",
"ec2:CopySnapshot",
"ec2:ImportSnapshot",
"ec2:RegisterImage",
"ec2:Describe*"
],
"Resource": "*"
}
]
}
- Click
Next
at the bottom of the page - Assign a policy name and click
Create Policy
. Make sure to write down the policy name since it will be needed
Role creation
- Under the same Access management section in the IAM Dashboard, select
Roles
- Click
Create role
in the upper right side of the page - In the "Select trusted entity" page, select
AWS service
- For the Use Case section select
EC2
, then clickNext
- In the "Permissions policies" page, type the name of the policy you created in the previous steps and then, click the checkbox next to its name to select it, then click
next
- Under "Role Details", type
vmimport
as the name of the role
For the role, it is required that the name is vmimport
since this is an internal role the EC2 service will look for when processing automatic conversion requests. Failure to name this role as indicated will result in unexpected errors from AWS
- Click
Create role
- Once created, search for the role in the roles list, if there are several roles, use the search bar on top of the list and look for
vmimport
- Click the name to edit the role
- Click
Trust relationships
in the middle of the page and then clickEdit trust policy
- Paste the following JSON on the code view making sure to replace all the JSON that was there before
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
},
{
"Effect": "Allow",
"Principal": {
"Service": "vmie.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:Externalid": "vmimport"
}
}
}
]
}
- Click
Update policy
Create user and assign the role
Now that we have the role and the policy to work through the terminal, we're going to create a service user that can be used through the CLI. The following steps will guide you through this process:
- In the same "Access management" section, click
Users
- Click
Create user
(top right) - Assign a username and click
Next
- In the "Set permission" page, select
Attach policies directly
- Use the search bar to search for the policy you created before, then click the checkbox next to its name to assign it to the user, then click
Next
- Click
Create user
Configuring awscli
to work with the new user
To configure your local CLI with the user you just created, follow these steps:
- In the "Access Management" section of the IAM Dashboard, click on
Users
- Search for the user you created and click on its name to open the user details
- Click
Security credentials
and then, click onCreate access key
under "Access Keys" - Select
Command Line interface(CLI)
in the "Use case" prompt and then click the checkbox at the bottom under "confirmation", then clickNext
- If you want, assign a description to the key, then click
Create access key
- Copy the Access key and Secret access key to a secure location and/or download the key as a
.csv
file, then clickDone
- Once this is completed, open a terminal window in your computer
- Type the command
aws configure
, then hit Enter - The CLI will ask you for the following information:
- AWS KEY: The Access key you just created
- AWS Secret Key: The secret access key provided by AWS on the last step
- Default region name: The AWS region where you created the policies and user
- Default output format: This can be left empty or type
json
Once you hit enter in the last question, the configuration will be saved and you will be able to execute commands in AWS using the user account created.