Sample application written in node.js for demo purposes related to deploying to AWS Elastic Beanstalk
- git clone
[email protected]:wsieroci/aws-elasticbeanstalk-sample.git
cd
into it
docker-compose up --build
- command will rebuild environment (if there are changes) prior to running it
docker images
docker tag fb2547b19d23 wsieroci/sample-postgres-node:latest
docker login
docker 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-id
andaws-secret-key
- Choose application name:
wiktorsierocinski-aws-sample
- Choose
North Virginia
as a region .elasticbeanstalk
directory 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.json
file
- 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 ssh
sudo docker ps
sudo docker logs --tail=100 --follow container_name
- Check if node established connection to PostgreSQL successfully