- Create an AWS account
- Install npm
- Install or update your aws cli
- Install or update your eb cli
- Install angular-cli
# Clone it from github
git clone --depth 1 [email protected]:joshsisley/agency-web-app.git
# Install the NPM packages
cd agency-web-app
npm install
# Run the app in dev mode
npm start
This sample application can be deployed to either Elastic Beanstalk or S3. S3 will host this application as a static site while Elastic Beanstalk gives you the capability of adding backend operations to the application.
createResources.sh requires your aws cli to be configured for JSON output.
# Install the AWS resources and deploy your application to either Elastic Beanstalk or S3
cd aws
./createResources.sh
Running the above command will create the necessary AWS resources and build & deploy your code to AWS. It will prompt you to choose your deployment target (S3 or Elastic Beanstalk). Choosing 'S3' makes your deployment completely serverless, while choosing Elastic Beanstalk will create an EC2 instance that will host this NodeJS app.
Caution: You might incur AWS charges after running the setup script
After initially running the createResources.sh
script, use the below commands to rebuild and redeploy
# Build the project and sync the output with the S3 bucket
npm run build; cd dist; aws s3 sync . s3://[BUCKET_NAME]/
# Test your deployed application
curl โI http://[BUCKET_NAME].s3-website-[REGION].amazonaws.com/
NOTE: You might want to reshuffle some of the "package.json" dependencies and move the ones that belong to devDependencies for a leaner deployment bundle. At this point of time, AWS Beanstalk requires all of the dependencies, including the devDependencies to be under the dependencies section. But if you're not using Beanstalk then you can optimize as you wish.
or
# Commit your changes in order to deploy it to your environment
git add .
git commit
eb deploy
# View your deployed application in a browser
eb open