Repository: localstack/localstack

Issue:
bug: Missing support for local-kms provider on arm64
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

The KMS provider `local-kms` don't start on Apple M1 ( arm64 ).

### Expected Behavior

Localstack should use `darwin-arm64` build of `local-kms`.

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker run -e KMS_PROVIDER=local-kms localstack/localstack

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

    awslocal kms list-aliases


### Environment

```markdown
- OS: OSX 12.0.1 ( Apple M1 Pro )
- LocalStack: 0.13.2
```


### Anything else?

Pull request in preparation


Discussion:

Resolving patch:
diff --git a/localstack/constants.py b/localstack/constants.py
--- a/localstack/constants.py
+++ b/localstack/constants.py
@@ -121,7 +121,7 @@
 )
 STS_JAR_URL = "https://repo1.maven.org/maven2/com/amazonaws/aws-java-sdk-sts/1.11.14/aws-java-sdk-sts-1.11.14.jar"
 STEPFUNCTIONS_ZIP_URL = "https://s3.amazonaws.com/stepfunctionslocal/StepFunctionsLocal.zip"
-KMS_URL_PATTERN = "https://s3-eu-west-2.amazonaws.com/local-kms/localstack/v3/local-kms.<arch>.bin"
+KMS_URL_PATTERN = "https://s3-eu-west-2.amazonaws.com/local-kms/3/local-kms_<arch>.bin"
 
 DYNAMODB_JAR_URL = "https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip"
 
diff --git a/localstack/services/install.py b/localstack/services/install.py
--- a/localstack/services/install.py
+++ b/localstack/services/install.py
@@ -36,7 +36,6 @@
     download,
     file_exists_not_empty,
     get_arch,
-    get_os,
     is_windows,
     load_file,
     mkdir,
@@ -313,12 +312,11 @@ def install_kinesis_mock():
 
 
 def install_local_kms():
-    local_arch = get_os()
+    local_arch = f"{platform.system().lower()}-{get_arch()}"
     binary_path = INSTALL_PATH_KMS_BINARY_PATTERN.replace("<arch>", local_arch)
     if not os.path.exists(binary_path):
         log_install_msg("KMS")
         mkdir(INSTALL_DIR_KMS)
-        # TODO ARM download platform specific binary
         kms_url = KMS_URL_PATTERN.replace("<arch>", local_arch)
         download(kms_url, binary_path)
         chmod_r(binary_path, 0o777)
diff --git a/localstack/services/kms/kms_starter.py b/localstack/services/kms/kms_starter.py
--- a/localstack/services/kms/kms_starter.py
+++ b/localstack/services/kms/kms_starter.py
@@ -10,7 +10,7 @@
     start_proxy_for_service,
 )
 from localstack.services.install import INSTALL_PATH_KMS_BINARY_PATTERN
-from localstack.utils.common import get_free_tcp_port, get_os, wait_for_port_open
+from localstack.utils.common import get_arch, get_free_tcp_port, platform, wait_for_port_open
 
 LOG = logging.getLogger(__name__)
 
@@ -21,7 +21,9 @@
 def start_kms_local(port=None, backend_port=None, asynchronous=None, update_listener=None):
     port = port or config.PORT_KMS
     backend_port = get_free_tcp_port()
-    kms_binary = INSTALL_PATH_KMS_BINARY_PATTERN.replace("<arch>", get_os())
+    kms_binary = INSTALL_PATH_KMS_BINARY_PATTERN.replace(
+        "<arch>", f"{platform.system().lower()}-{get_arch()}"
+    )
     log_startup_message("KMS")
     start_proxy_for_service("kms", port, backend_port, update_listener)
     env_vars = {


Test patch: