Deploying to AWS Permalink to " Deploying to AWS"

Powered by AWS Cloud Computing

aws sub-generator Permalink to "aws sub-generator"

This sub-generator allows you to automatically deploy your JHipster application to the Amazon AWS cloud using AWS Elastic Beanstalk to provision the infrastructure.

Tip: As an alternative to Elastic Beanstalk you can also deploy your JHipster application to AWS using CloudCaptain. CloudCaptain comes with first-class support for JHipster as well as support for both MySQL and PostgreSQL databases.

Limitations Permalink to "Limitations"

  • You can only use it with a SQL database (but note that Oracle and Microsoft SQL Server aren’t supported).
  • Websockets don’t work behind the load balancer by default.

Prerequisites Permalink to "Prerequisites"

Before running the sub-generator, create AWS SDK credentials so that JHipster can deploy to Elastic Beanstalk.

Log into your Amazon AWS account and create an IAM user with programmatic access.

Attach the following policies to grant the user the necessary permissions:

  • AdministratorAccess-AWSElasticBeanstalk
  • AmazonS3FullAccess
  • AmazonRDSFullAccess
  • IAMFullAccess

Create the user and download the csv file with the new credentials. Use them to create a credentials file called ~/.aws/credentials on Mac/Linux or C:\Users\USERNAME\.aws\credentials on Windows, as follows:

aws_access_key_id = your_access_key
aws_secret_access_key = your_secret_key

If you already have a default profile, create a new named profile and set the environment variable AWS_PROFILE to the new profile name (see here for details).

Test your access by executing aws sts get-caller-identity.

Deploying your application Permalink to "Deploying your application"

To deploy your application to Amazon AWS, type:

jhipster aws

You will be prompted for:

  • Application name: Name of the collection of Elastic Beanstalk components that make up the application (default is the project name)
  • Environment name: Name of the AWS resource environment that will run the application
  • Name of S3 bucket: Holds the static web components
  • Database name: name of the RDS database
  • Database username: RDS database username
  • Database password: [hidden]
  • On which EC2 instance type do you want to deploy? Select the capacity of the AWS EC2 virtual machine
  • On which RDS instance class do you want to deploy? Select the capacity of the RDS database instance
  • On which region do you want to deploy? Select the AWS region to host the instance

This should package your application in “production” mode, create a Beanstalk application (with a SQL database), upload your code on S3, and start the application.

Updating your deployed application Permalink to "Updating your deployed application"

You can update a deployed application by running the sub-generator again with jhipster aws.

Note that you will be prompted for your database credentials again but they will be ignored during the update.

Deleting your application Permalink to "Deleting your application"

  • Delete the Elastic Beanstalk.
  • Delete S3 buckets relevant to the application.
  • Delete the Amazon Relational Database Service (RDS) instance.
  • Delete the EC2 security groups relevant to the application. You can find this by looking at the description of the security group which should say Enable database access to Beanstalk application.

More information Permalink to "More information"