# Can not create SSL for Elasticsearch and Kibana when deploying in AWS lighsail using docker

**URL:** <https://discuss.elastic.co/t/can-not-create-ssl-for-elasticsearch-and-kibana-when-deploying-in-aws-lighsail-using-docker/370629>\
**Category:** Kibana\
**Tags:** docker\
**Created:** [November 15, 2024, 10:28pm UTC](https://discuss.elastic.co/t/can-not-create-ssl-for-elasticsearch-and-kibana-when-deploying-in-aws-lighsail-using-docker/370629 "2024-11-15T22:28:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vamsi\_Popuri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vamsi_popuri/32/139272_2.png) [@Vamsi\_Popuri](https://discuss.elastic.co/u/Vamsi_Popuri)\
**Post date:** [November 15, 2024, 10:28pm UTC](https://discuss.elastic.co/t/can-not-create-ssl-for-elasticsearch-and-kibana-when-deploying-in-aws-lighsail-using-docker/370629/1 "2024-11-15T22:28:42Z")

</div>

Hi all,  
I am trying to deploy Elasticsearch and Kibana in Ubuntu lightsail instance using docker. This might be very minor issue, but i am trying different methods from past 2 days and i am struck and any help will be appreciated.  
My docker-compose.yml is as follows

```auto
version: '3.7'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.0
container_name: elasticsearch
environment:
 - discovery.type=single-node
 - xpack.security.enabled=true # Enable security - 
 - xpack.security.transport.ssl.enabled=true
 - xpack.security.transport.ssl.key=certs/elasticsearch-key.pem
 - xpack.security.transport.ssl.certificate=certs/elasticsearch-cert.pem
 - xpack.security.transport.ssl.certificate_authorities=certs/elasticsearch-cert.pem
 - ELASTIC_PASSWORD=My_password
ports:
 - "9200:9200"
volumes:
 - esdata:/usr/share/elasticsearch/data
 - ../certs:/usr/share/elasticsearch/config/certs
networks:
 - elastic

 kibana:
image: docker.elastic.co/kibana/kibana:8.16.0
container_name: kibana
environment:
 - ELASTICSEARCH_HOSTS=https://elasticsearch:9200
 - ELASTICSEARCH_USERNAME=elastic
 - ELASTICSEARCH_PASSWORD=My_password
 - SERVER_SSL_ENABLED=true
 - SERVER_SSL_CERTIFICATE=certs/kibana-cert.pem
 - SERVER_SSL_KEY=certs/kibana-key.pem
ports:
 - "5601:5601"
depends_on:
 - elasticsearch
volumes:
 - ../certs:/usr/share/elasticsearch/config/certs
networks:
 - elastic

volumes:
esdata:
driver: local

networks:
elastic:
driver: bridge

```

I created certs using

```auto
 openssl req -x509 -newkey rsa:4096 -keyout kibana-key.pem -out kibana-cert.pem -days 365 

```

then i gave the location of certs in my .yml

My Elasticsearch and Kibana exited with error code 1. the log is as follows

```auto
"log.level":"ERROR", "message":"fatal exception while booting Elasticsearch", "ecs.vers
ion": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elast
icsearch.bootstrap.Elasticsearch","elasticsearch.node.name":"a4a5b0fd8f9e","elasticsearch.cluster.name":"docker-cluster","error.t
ype":"org.elasticsearch.ElasticsearchSecurityException","error.message":"failed to load SSL configuration [xpack.security.transpo
rt.ssl] - cannot load PEM private key from [/usr/share/elasticsearch/config/certs/elasticsearch-key.pem] due to GeneralSecurityEx
ception (PKCS#8 Private Key is encrypted with unsupported PBES2 algorithm [1.2.840.113549.3.7])","error.stack_trace":"org.elastic
search.ElasticsearchSecurityException: failed to load SSL configuration [xpack.security.transport.ssl] - cannot load PEM private 
key from [/usr/share/elasticsearch/config/certs/elasticsearch-key.pem] due to GeneralSecurityException (PKCS#8 Private Key is enc
rypted with unsupported PBES2 algorithm [1.2.840.113549.3.7])\n\tat org.elasticsearch 

```
