You have an on-premise virtual machine and you create a replication job in AWS Server Migration Service (SMS) to migrate the VM to AWS.
Whenever an AMI is created from the SMS job, you need to launch an EC2 instance with the AMI and trigger a Jenkins job to perform the automation testing.
Which method would you use to create the EC2 instance automatically for the testing?
Click on the arrows to vote for the correct answer
A. B. C. D. E.Correct Answer - D.
The combinations of CloudWatch Event rule and Lambda function can automatically launch EC2 instances with newly generated AMIs from SMS.
Check the details in https://docs.aws.amazon.com/server-migration-service/latest/userguide/cwe-sms.html.
Option A is incorrect: The Server Migration Service replication job generates an AMI after the job is finished.
However, it does not automatically launch EC2 instances.
Users have to do that by themselves.
Option B is incorrect: Because the Server Migration Service cannot send messages to an SNS topic.
Users should configure a CloudWatch Event rule to monitor the SMS job.
Option C is incorrect: Because AMIs generated from SMS do not have the AWS:SMS tag.
The CloudWatch Event rule should be used to check the AWS SMS job state change events.
Option D is CORRECT: The CloudWatch Event rule can monitor the following SMS events:
{
"source": [
"aws.sms"
],
"detail-type": [
"Server Migration Job State Change"
]
}
Then the Lambda function is triggered to launch a new instance using the AMI.
The requirement is to create an EC2 instance automatically whenever an AMI is created from an AWS Server Migration Service (SMS) replication job, which will then trigger a Jenkins job for automation testing.
Option A suggests configuring the Server Migration Service replication job to automatically launch an EC2 instance with a launch template when the job finishes. This option can work, but it doesn't address the requirement of triggering the Jenkins job for automation testing.
Option B suggests configuring the Server Migration Service to send a message to an SNS notification with the AMI ID. This option also doesn't directly address the requirement of automatically launching an EC2 instance and triggering the Jenkins job.
Option C suggests setting up a Lambda function as the subscriber to launch an EC2 instance. This option can work, but it requires manual setup and configuration of the Lambda function, which can be time-consuming and error-prone.
Option D suggests configuring a CloudWatch Event to monitor newly generated AMIs with the tag AWS:SMS. This option addresses the requirement of automatically creating an EC2 instance and triggering the Jenkins job. A Lambda function can be used to create the EC2 instance and pass the instance ID to the Jenkins job. However, this option requires setting up the AWS:SMS tag on newly generated AMIs, which may not be feasible or desirable.
Option E suggests creating a CloudWatch Event rule to monitor the AWS SMS job state changes. This option also addresses the requirement of automatically creating an EC2 instance and triggering the Jenkins job. A Lambda function can be used to get the new AMI ID and launch an EC2 instance. This option doesn't require setting up any additional tags, but it does require monitoring the SMS job state changes.
Therefore, Option D and Option E both can address the requirement. Option D requires setting up the AWS:SMS tag on newly generated AMIs, and Option E requires monitoring the SMS job state changes. Both options can be implemented using a Lambda function to create an EC2 instance and trigger the Jenkins job.