Understanding 1 Click AWS Marketplace

Hi,

So I’ve been running smoothly Kong in a Heroku instance and now that I want to have in production, as we own an AWS account I’m starting to shift things there.

Followed the link provided and I’ve selected 0.12.1 (BTW, 0.12.2 is missing as an option), EU Irland, t2.medium and provided my SSH key to spin a new EC2 with casandra and kong on it but…

  1. Does it come with any configuration whatsoever? I can’t find any kong.conf file, I really assumed that would come with kong already setup with casandra as both are part of the same image

found /etc/kong/kong.config.default only from using kong start --v

  1. What are the steps to actually start kong when the servers starts?

not familiarized with linux starting scripts, where should I add kong start command?

  1. When trying to connect to cassandra, what are the user/password registered?

I tried to start cassandra with sudo /etc/init.d/cassandra start and was ok, but how do I access it? Saw that I should start with cqlsh -u cassandra -p cassandra (and that’s assuming cassandra/cassandra is the credentials) but I get:

Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

(after started cassandra with sudo /etc/init.d/cassandra start and got Starting Cassandra: OK, like the image below shows)

  1. Why not having this setup pre-configured so we can start using kong out-of-the-box, or… am I missing something obvious :frowning:

Thanks!

P.S. in the /install/aws-marketplace page, says nothing about the need to configure everything together, hence my questions :blush:

It comes with default configuration. You can always run with you own configuration file for Kong.

Server automatically runs Cassandra and Kong, please check the /etc/rc.local file on the server.

Just run cqlsh without any user and password, make sure Cassandra already running. You can use the following command

service cassandra start

Because as you launch the instance it will have Cassandra and Kong already running.

We have sent the request to release Kong 0.12.2 to AWS, usually they take some time.

@shashiranjan

Thank you for the input, and with such info I did, in a brand new deployed instance :

[ec2-user@ip-172-31-10-112 ~]$ service cassandra start
Starting Cassandra: /etc/init.d/cassandra: line 56: /var/log/cassandra/cassandra.log: Permission denied
OK
[ec2-user@ip-172-31-10-112 ~]$ sudo service cassandra start
Starting Cassandra: OK
[ec2-user@ip-172-31-10-112 ~]$ cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

then I tried to run the file you specified:

[ec2-user@ip-172-31-10-112 ~]$ cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
cat /dev/null > /var/log/kong/kong_boot.log
echo "-----Setting up Kong and Cassandra: $(date)------" >> /var/log/kong/kong_boot.log
echo "-----updating AMI tools------" >> /var/log/kong/kong_boot.log
yum update -y aws-amitools-ec2 >> /var/log/kong/kong_boot.log
echo "-----Starting Cassandra------" >> /var/log/kong/kong_boot.log
service cassandra start >> /var/log/kong_boot.log
export KONG_DATABASE=cassandra
export KONG_ADMIN_LISTEN=0.0.0.0:8001
export KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444
sleep 2m
echo "-----Starting migrations------" >> /var/log/kong/kong_boot.log
su -s /bin/sh -c "KONG_DATABASE=cassandra /usr/local/bin/kong migrations up" ec2-user >> /var/log/kong/kong_boot.log
echo "-----Starting Kong------" >> /var/log/kong/kong_boot.log
su -s /bin/sh -c "KONG_DATABASE=cassandra /usr/local/bin/kong start" ec2-user >> /var/log/kong/kong_boot.log
[ec2-user@ip-172-31-10-112 ~]$ /bin/bash /etc/rc.local
touch: cannot touch ‘/var/lock/subsys/local’: Permission denied
You need to be root to perform this command.
/etc/rc.local: line 13: /var/log/kong_boot.log: Permission denied
^[[A^[[H^[[A^[[A^C
[ec2-user@ip-172-31-10-112 ~]$ sudo /bin/bash /etc/rc.local
2018/03/12 13:08:26 [warn] You are using Cassandra but your 'db_update_propagation' setting is set to '0' (default). Due to the distributed nature of Cassandra, you should increase this value.
Error: [cassandra error] could not find coordinator: all hosts tried for query failed. 127.0.0.1: host seems unhealthy, considering it down (connection refused)

  Run with --v (verbose) or --vv (debug) for more details
2018/03/12 13:08:26 [warn] You are using Cassandra but your 'db_update_propagation' setting is set to '0' (default). Due to the distributed nature of Cassandra, you should increase this value.
Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:28: [cassandra error] could not retrieve current migrations: [cassandra error] all hosts tried for query failed. 127.0.0.1: host seems unhealthy, considering it down (connection refused)

then, I terminated that EC2 image and created a brand new one (now with the latest version) and simply run the file sudo /bin/bash /etc/rc.local

after a while the output was much simpler and I could reach kong by curling localhost:8001

I just need to learn how to solve issues that will come, for example if the system rebots for any reason, just don’t know if everything will be up again :confused:

will test and certify everything.

Thank you for the help!