AWS Service Policy

VM Import uses a role in your AWS account to perform certain operations (for example, downloading disk images from an Amazon S3 bucket). You must create a role with the name vmimport with the following policy and trusted entities.
  1. Install the AWS CLI by following the instructions at http://docs.aws.amazon.com/cli/latest/userguide/installing.html
  2. Enter the following command in the AWS CLI #sudo pip install awscli.
  3. Get the access key for the AWS CLI by following the instructions on the AWS website.
  4. Add the access key details to the AWS CLI using the following commands
    # aws
            configureAWS Access Key ID [None]:
            AWS Secret Access Key
            [None]: Default region name [None]:
            us-west-2Default output format
            [None]: json
  5. Create a file named role-policy.json with the following policy:
    {
       "Version":"2012-10-17",
       "Statement":[
          {
             "Effect":"Allow",
             "Action":[
                "s3:ListBucket",
                "s3:GetBucketLocation"
             ],
             "Resource":[
                "arn:aws:s3:::<disk-image-file-bucket>"
             ]
          },
          {
            "Effect":"Allow",
             "Action":[
                "s3:GetObject"
             ],
             "Resource":[
                "arn:aws:s3:::<disk-image-file-bucket>/*"
             ]
          },
          {
             "Effect":"Allow",
             "Action":[
                "ec2:ModifySnapshotAttribute",
                "ec2:CopySnapshot",
                "ec2:RegisterImage",
                "ec2:Describe*"
             ],
             "Resource":"*"
          }
       ]
    }
  6. Replace <disk-image-file-bucket> with the appropriate Amazon S3 bucket where the disk files are stored. Run the following command to attach the policy to the role created above:
  7. Replace <disk-image-file-bucket> with the appropriate Amazon S3 bucket where the disk files are stored. Run the following command to attach the policy to the role created above aws iam put-role-policy --role-name vmimport --policy-name vsz34-policy --policy-document file://role-policy.json