Add x509 hex package to deps:

def deps do
  [
    {:x509, "~> 0.8.0"}
  ]
end

Generate certificates:

$ mix x509.gen.selfsigned

Add certificates to you Cowboy setup:

Plug.Cowboy,
  scheme: :https,
  plug: YourAppPlug,
  options: [
    port: 8443,
    cipher_suite: :strong,
    certfile: "priv/cert/selfsigned.pem",
    keyfile: "priv/cert/selfsigned_key.pem",
    otp_app: :your_app
  ]
}

Links: x509, Plug