def METHOD_NAME():
    """Verify instances created via OpsWorks are discoverable via ec2."""
    opsworks = boto3.client("opsworks", region_name="us-east-1")
    stack_id = opsworks.create_stack(
        Name="S1",
        Region="us-east-1",
        ServiceRoleArn="service_arn",
        DefaultInstanceProfileArn="profile_arn",
    )["StackId"]
    layer_id = opsworks.create_layer(
        StackId=stack_id, Type="custom", Name="S1L1", Shortname="S1L1"
    )["LayerId"]
    instance_id = opsworks.create_instance(
        AmiId=EXAMPLE_AMI_ID,
        StackId=stack_id,
        LayerIds=[layer_id],
        InstanceType="t2.micro",
        SshKeyName="testSSH",
    )["InstanceId"]
    ec2 = boto3.client("ec2", region_name="us-east-1")
    # Before starting the instance, it shouldn't be discoverable via ec2
    reservations = ec2.describe_instances()["Reservations"]
    assert not reservations
    # Before starting the instance, its status should be "stopped"
    opsworks_instance = opsworks.describe_instances(StackId=stack_id)["Instances"][0]
    assert opsworks_instance["Status"] == "stopped"
    # After starting the instance, it should be discoverable via ec2
    opsworks.start_instance(InstanceId=instance_id)
    reservations = ec2.describe_instances()["Reservations"]
    assert len(reservations[0]["Instances"]) == 1
    instance = reservations[0]["Instances"][0]
    opsworks_instance = opsworks.describe_instances(StackId=stack_id)["Instances"][0]
    assert instance["InstanceId"] == opsworks_instance["Ec2InstanceId"]
    assert instance["PrivateIpAddress"] == opsworks_instance["PrivateIp"]
    # After starting the instance, its status should be "online"
    assert opsworks_instance["Status"] == "online"