Skip to content

Instantly share code, notes, and snippets.

@ericpkatz
Last active March 26, 2021 17:07
Show Gist options
  • Save ericpkatz/19614dd090e6408f3eef746ddc49e6d6 to your computer and use it in GitHub Desktop.
Save ericpkatz/19614dd090e6408f3eef746ddc49e6d6 to your computer and use it in GitHub Desktop.

create AWS Account

create Cloud9 Environment - Use Defaults

whoami - notice you are the ec2-user

whoami

go into sudo mode

sudo -i

install postgres-server and init and start

yum install postgresql-server
service postgresql initdb 
service postgresql start

log into psql as the postgres user in order to create user and database for ec2-user

sudo -u postgres psql
create user "ec2-user" createdb;
create database "ec2-user";
\q

edit /var/lib/pgsql9/data/pg_hba.conf

host    all             ec2-user        127.0.0.1/0             md5
# host    all             all        127.0.0.1/0             trust

service postgresql restart


# add a password for ec2-user

alert role "ec2-user" WITH PASSWORD 'some_password';

Use md5 auth

const Sequelize = require('sequelize');

const conn = new Sequelize({ dialect: 'postgres', user: 'ec2-user', password: 'pw', database: 'acme_db', host: 'localhost' });

const User = conn.define('user', {}); conn.sync({ force: true});

exit sudo mode (exit) and type psql

CREATE DATABASE foobar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment