Sample application written in node.js for demo purposes related to deploying to AWS Elastic Beanstalk
- git clone
git@github.com:wsieroci/aws-elasticbeanstalk-sample.git cdinto it
docker-compose up --build- command will rebuild environment (if there are changes) prior to running it
docker imagesdocker tag fb2547b19d23 wsieroci/sample-postgres-node:latestdocker logindocker push wsieroci/sample-postgres-node:latest
- Choose name: wiktorsierocinski-demo
- Copy Access Key, Secret Key, Password and login url
- Pass them to user
- Maybe install the newest version:
pip install -U pip setuptools - Or maybe install python:
curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python - And then install pip:
sudo easy_install pip pip install awsebcli
eb init- provideaws-access-idandaws-secret-key- Choose application name:
wiktorsierocinski-aws-sample - Choose
North Virginiaas a region .elasticbeanstalkdirectory will be created in your program root directory
eb create --sample --vpc- Provide vpc id (default one):
vpc-1c032a78 - EC2 subnets:
subnet-1b79d143, subnet-da1687ac, subnet-da1687ac, subnet-71b2c74c - Default vpc security group:
sg-6c14be14
eb deploy wiktorsierocinski-aws-sample-dev- Be aware that this command is deploying only code which is versioned by Git
- Be aware to properly deploy whole application the only file need is
Dockerrun.aws.jsonfile
- Go to RDS panel and create new database in VPC environment
- Be aware to choose the lowest instance in regard to resources
- Establish permissions for your EB environment to be able to make requests to your RDS DB (security groups)
- Add environment variables to your EB environment such as:
POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_HOST,POSTGRES_PORT - Restart of application will be done automatically
eb sshsudo docker pssudo docker logs --tail=100 --follow container_name- Check if node established connection to PostgreSQL successfully