Adam Cooper
Adam Cooper

Reputation: 8677

Connection fails when adding ElasticSearch as a Target for AWS Data Migration Service

I'm trying to set up ElasticSearch endpoint in DMS but no matter what I try when I test the connection I get this generic error:

Test Endpoint failed: Application-Status: 1020912, Application-Message: Endpoint initialization failed.

I've created a role trusted by dms.amazonaws.com:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "1",
      "Effect": "Allow",
      "Principal": {
        "Service": "dms.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

and given it every permission:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "*"
            ],
            "Resource": "*"
        }
    ]
}

I have also configured my Elasticsearch domain to be public and I can connect to it and access Kibana.

I followed along with this 'tutorial' but now I'm stuck as to where to look for logs/potential issues with Elastic.

enter image description here

Upvotes: 4

Views: 1226

Answers (2)

Adam Cooper
Adam Cooper

Reputation: 8677

It turns out that the cause here was a trailing slash in the Elastic url. I was setting the url as:

https://my-elastic-search-name-1lllsyiodfokjalksnd.eu-west-1.es.amazonaws.com/

which was failing when I switched to setting the url as:

https://my-elastic-search-name-1lllsyiodfokjalksnd.eu-west-1.es.amazonaws.com

Everything started to work 🤷 Hopefully a bug that'll get fixed soon.

Upvotes: 3

ostrumvulpes
ostrumvulpes

Reputation: 543

I ran into the same issue, and had to modify the Elasticsearch domain's access policy to allow the role attached to my DMS target endpoint to access it.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::{accountNumber}:role/{serviceRoleUsedForDmsTargetEndpoint}"
      },
      "Action": [
        "es:ESHttpDelete",
        "es:ESHttpGet",
        "es:ESHttpHead",
        "es:ESHttpPost",
        "es:ESHttpPut"
      ],
      "Resource": "{yourElasticsearchDomainArn}"
    }
  ]
}

This wasn't a solution I found via the tutorials/documentation, but through a support case instead.

Upvotes: 1

Related Questions