<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[x ] bug report
[ ] feature request

# Detailed description

Not able to use the edge service to write metric data to cloudwatch via the javascript aws-sdk.

However, It **DOES** work when using the deprecated cloudwatch port.

## Expected behavior

Metric data to be visible when calling `awslocal cloudwatch list-metrics`

## Actual behavior

404 from edge service. No metric data is persisted, localstack instance logs the following info:

```
INFO:localstack.services.edge: Unable to determine forwarding port for API "monitoring" - please make sure this API is enabled via the SERVICES configuration
```

# Steps to reproduce

Run JS code in "Client code" section.
See 404 Error

## Command used to start LocalStack

`TMPDIR=/tmp/localstack docker-compose up`

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)

```js
const AWS = require('aws-sdk')
const cw = new AWS.CloudWatch({
  endpoint: 'http://localhost:4566',
})

const data = {
  Namespace: 'ns',
  MetricData: [
    {
      MetricName: 'metric-name',
      Timestamp: new Date(),
      Value: 12345,
      Unit: 'Milliseconds',
      Dimensions: [
        { Name: 'Environment', Value: 'local' },
      ]
    }
  ]
}

cw.putMetricData(data, (err, data) => {
  if (err) {
      console.log('Error', err)
  } else {
      console.log('Success', JSON.stringify(data))
  }
})
```

TMP_FILES.append(lambda_file)
    TMP_FILES.append('%sc' % lambda_file)
    try:
        pre_sys_modules_keys = set(sys.modules.keys())
        try:
            handler_module = imp.load_source(lambda_id, lambda_file)
            module_vars = handler_module.__dict__
        finally:
            
            
            
            
            post_sys_modules_keys = set(sys.modules.keys())
            for key in post_sys_modules_keys:
                if key not in pre_sys_modules_keys:
                    sys.modules.pop(key)
    except Exception as e:
        LOG.error('Unable to exec: %s %s' % (script, traceback.format_exc()))
        raise e
    finally:
        if lambda_cwd or lambda_env:
            if lambda_cwd:
                os.chdir(previous_cwd)
                sys.path.pop(0)
            if lambda_env:
                os.environ = previous_env
            EXEC_MUTEX.release()
    return module_vars[handler_function]
def get_handler_file_from_name(handler_name, runtime=LAMBDA_DEFAULT_RUNTIME):