Replicate VMs using Amazon CLI commands for Amazon SMS - Amazon Server Migration Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Product update

We recommend Amazon Application Migration Service (Amazon MGN) as the primary migration service for lift-and-shift migrations. If Amazon MGN is unavailable in a specific Amazon Region, you can use the Amazon SMS APIs through March 2023.

Replicate VMs using Amazon CLI commands for Amazon SMS

You can use the Amazon Command Line Interface (Amazon CLI) to inventory and migrate your on-premises servers to Amazon EC2.



  • You can replicate your on-premises servers to Amazon for up to 90 days per server. Usage time is calculated from the time a server replication begins until you terminate the replication job. After 90 days, your replication job is automatically terminated. You can request an extension from Amazon Web Services Support.

  • If you have enabled integration between Amazon SMS and Amazon Migration Hub, your SMS server catalog is also visible on Migration Hub. For more information, see Import applications from Migration Hub.

  • During the replication process, Amazon SMS creates an Amazon S3 bucket in the Region on your behalf, with server-side encryption enabled and a bucket policy to delete any items in the bucket after seven days. Amazon SMS replicates server volumes from your environment to this bucket and then creates EBS snapshots from the volumes. If you do not delete this bucket, Amazon SMS uses it for all replication jobs in this Region.

  • During the AMI creation process, Amazon SMS sets the DeleteOnTermination attribute for the root volume to false, overriding the default. You can delete the root volume manually after you terminate the instance, or you can set the attribute to true so that Amazon EC2 deletes the root volume on instance termination. For more information, see Preserving Amazon EBS volumes on instance termination in the Amazon EC2 User Guide.

To replicate a server using the CLI

  1. Use the get-connectors command to obtain a list of connectors that are registered to you.

    aws sms get-connectors
  2. After a connector has been installed and registered, use the import-server-catalog command to create an inventory of your servers. This process can take up to a minute.

    aws sms import-server-catalog
  3. Use the get-servers command to display a list of servers available for import to Amazon EC2.

    aws sms get-servers

    The output should be similar to the following:

    { "serverList": [ { "serverId": "s-12345678", "serverType": "VIRTUAL_MACHINE", "vmServer": { "vmManagerName": "", "vmServerAddress": { "vmManagerId": "your-vcenter-instance-uuid", "vmId": "vm-123" }, "vmName": "your-linux-vm", "vmPath": "/Datacenters/DC1/vm/VM Folder Path/your-linux-vm", "vmManagerType": "vSphere" } }, { "replicationJobTerminated": false, "serverId": "s-23456789", "serverType": "VIRTUAL_MACHINE", "replicationJobId": "sms-job-12345678", "vmServer": { "vmManagerName": "", "vmServerAddress": { "vmManagerId": "your-vcenter-instance-uuid", "vmId": "vm-234" }, "vmName": "Your Windows VM", "vmPath": "/Datacenters/DC1/vm/VM Folder Path/Your Windows VM", "vmManagerType": "vSphere" } } ] }

    If you have not yet imported a server catalog, you see output similar to the following:

    { "lastModifiedOn": 1477006131.856, "serverCatalogStatus": "NOT IMPORTED", "serverList": [] }

    A catalog status of DELETED or EXPIRED also shows that no servers exist in the catalog.

  4. Select a server to replicate, note the server ID, and specify the ID in the create-replication-job command.

    aws sms create-replication-job --server-id s-12345678 \ --frequency 12 \ --seed-replication-time 2016-10-24T15:30:00-07:00 \ --role-name AWSServiceRoleForSMS

    After the replication job is set up, it starts replicating automatically at the time specified with the --seed-replication-time parameter, expressed in seconds of the Unix epoch or according to ISO 8601. For more information, see Specifying Parameter Values for the Amazon Command Line Interface. Thereafter, the replication repeats with an interval specified by the --frequency parameter, expressed in hours.

  5. You can view details of all running replication jobs using the get-replication-jobs command. If you do not specify any parameters, the command lists all your replication jobs.

    This command returns output similar to the following:

    { "replicationJobList": [ { "vmServer": { "vmManagerName": "", "vmServerAddress": { "vmManagerId": "your-vcenter-instance-uuid", "vmId": "vm-1234" }, "vmName": "VM name in vCenter", "vmPath": "/Datacenters/DC1/vm/VM Folder Path/VM name in vCenter" }, "replicationRunList": [ { "scheduledStartTime": 1487007010.0, "state": "Deleted", "type": "Automatic", "statusMessage": "Uploading", "replicationRunId": "sms-run-12345678" } ], "replicationJobId": "sms-job-98765432", "state": "Deleted", "frequency": 12, "seedReplicationTime": 1477007049.0, "roleName": "sms" }, { "vmServer": { "vmManagerName": "", "vmServerAddress": { "vmManagerId": "your-vcenter-instance-uuid", "vmId": "vm-2345" }, "vmName": "win2k12", "vmPath": "/Datacenters/DC1/vm/VM Folder Path/win2k12" }, "replicationRunList": [ { "scheduledStartTime": 1477008789.0, "state": "Active", "type": "Automatic", "statusMessage": "Converting", "replicationRunId": "sms-run-12345679" } ], "replicationJobId": "sms-job-23456789", "state": "Active", "frequency": 24, "seedReplicationTime": 1477008789.0, "roleName": "sms" } ] }
  6. You can also use the get-replication-runs command to retrieve information about all replication runs for a specific replication job. To do this, specify a replication job ID as follows:

    aws sms get-replication-runs --replication-job-id sms-job-12345678

    This command returns a list of all replication runs for the specified replication job, as well as details for that replication job, similar to the following:

    { "replicationRunList": [ { "scheduledStartTime": 1477310423.0, "state": "Active", "type": "Automatic", "statusMessage": "Converting", "replicationRunId": "sms-run-23456789" }, { "amiId": "ami-abcdefab", "state": "Completed", "completedTime": 1477227683.652, "scheduledStartTime": 1477224023.0, "replicationRunId": "sms-run-34567890", "type": "Automatic", "statusMessage": "Completed" }, { "amiId": "ami-efababcd", "state": "Completed", "completedTime": 1477144823.486, "scheduledStartTime": 1477137623.0, "replicationRunId": "sms-run-45678903", "type": "Automatic", "statusMessage": "Completed" } ] }
  7. To change any of the parameters of a replication job after you have created it, use the update-replication-job command, by providing the replication job ID and any parameters to change.

    aws sms update-replication-job --replication-job-id sms-job-12345678 --frequency 24 --next-replication-run-start-time 2016-10-24T15:30:00-07:00
  8. In addition to your scheduled replication runs, you may also start up to two on-demand replication runs per 24-hour period. To do this, use the start-on-demand-replication-run command, which starts a replication run immediately. If another replication run is currently active, an on-demand replication run cannot be started.

    aws sms start-on-demand-replication-run --replication-job-id sms-job-12345678

    If a scheduled replication run is expected to start while an on-demand replication run is ongoing, then the scheduled run is skipped and rescheduled for the next interval.

  9. After you are finished replicating a server, you may stop the replication job using the delete-replication-job command. This stops the replication job and cleans up any artifacts created by the service (for example, the job's S3 bucket). This does not delete any AMIs created by runs of the stopped job.

    aws sms delete-replication-job --replication-job-id sms-job-12345678
  10. When you no longer need to maintain your catalog of servers, use the delete-server-catalog command to clear the catalog of servers maintained by the service.

    aws sms delete-server-catalog
  11. When you are done using a connector, use the disassociate-connector command to deregister the connector from Amazon SMS. Call this command only after all replications using that connector are complete.

    aws sms disassociate-connector --connector-id c-12345678901234567