Summary: How to become the fastest dev in the cloud:
- Use a rapid development platform. In this blog, we will use JHipster for Java.
- Use a cloud-based IDE. We will use Cloud9 on AWS.
- Use AWS cloud resources to deploy your application. For demo purposes, we will just use EC2
Background: Why I wish I had this technology 10 years ago
Other challenges of software development projects:
- Obsolete even before going out to market
- Too much effort and time needed to implement even basic features
- MVP is too raw
- Security is not there
- Some basics are not there
- Either UI is beautiful but lacking many features, or features are complete but UI is ugly
- Performance is poor
- quickly runs out of hardware resources
This is the kind of development toolkit that we want:
- Quick to develop with the best practices already baked in
- Easy to customize
- Cloud-ready
- Allows the dev team to focus on the more complex functionality
JHipster as a rapid development platform has the following components that speed up development:
- Code generator to auto-generate boilerplate code. It can also auto-generate code for entities, repositories and services, given a domain model.
- Coding conventions. The project it generates follows a certain set of standards and common configurations, so that you don't have to spend time deciding on which libraries and tools to use, etc.
- It offers integrations with various cloud platforms for easy deployment
JHipster x AWS development process:
- Setup cloud IDE
- Generate boilerplate
- Domain diagram
- Generate domain code
- Write custom code
- Deploy to cloud
Setup cloud IDE (Cloud9)
- Create IAM user. The procedures for doing this yourself are out of scope of this post for now. Below are the permissions you can ask your AWS administrator to add.
- This IAM user should have permissions for the following AWS services:
- EC2
- S3
- RDS
- Cloud9
- Depending on your desired deployment method, you should also add permissions for the following services:
- Elastic BeanStalk
- ECS
- ECR
- Lightsail
- Enable both AWS console login and AWS CLI
- Create access key for use with AWS CLI
- Create Cloud9 environment. For this post, we'll create a Cloud9 environment in the us-west-1 region
- Go to Cloud9 service in the AWS console
- Click create environment
- Set a name. Description is optional.
- You can leave other settings as is. Recommendation: choose t3a.medium instance type so that tests will run faster.
- Click Create environment. Wait for the IDE to load.
- Install additional tools. The IDE has Java, Node, npm, docker, and Git. If you plan to use Docker to deploy and run your application, there are additional steps to take.
- The docker installed on the Cloud9 instance needs to be replaced with one that has the Cloud Integrations. To do this: (source)
curl -L -O https://github.com/docker/compose-cli/releases/download/v1.0.17/docker-linux-amd64
mv docker-linux-amd64 docker
chmod +x docker
sudo ln -s /usr/bin/docker /usr/local/bin/com.docker.cli
./docker --context default ps
sudo mv docker /usr/local/bin/docker
bash
docker version
- Docker compose also needs to be installed:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-composedocker-compose --version
JHipster Setup
- Install jhipster-generator:
npm install -g generator-jhipster - Run JHipster generator. This can be done either interactively or with parameters. First create a project folder, go into the folder, then run jhipster.
mkdir jhipsterdemo
cd jhipsterdemo
jhipster - Build and test. The project comes with maven as well as npm with a package.json that contains the most common scripts. Build by either running ./mvnw or npm run app:start
- View the running app in another tab.
You can use the Cloud9 URL: https://{id of cloud9 instance}.vfs.cloud9.{region}.amazonaws.com
Or you can use the public URL of the Cloud9 IDE's EC2 instance
Unauthorized: Full authentication is required to access this resource
Domain code development:
- Design the domain in JDL studio
- Export JDL file from studio and import to Cloud9
- In JDL Studio, you can find the download button at the upper right.
- In Cloud9, go to File -> Upload Local Files. Then select your JDL file.
- Generate code from the jdl file:
jhipster jdl jhipster-jdl.jdl - Extend generated code with custom code. Create Java classes and methods as needed.
- Re-build and test. Same commands as above. Recommended: clean the project first with ./mvnw clean
Deploy to AWS:
There are many options to deploy your project. For this exercise, we will deploy to EC2.
- Create a new EC2 instance through the AWS Console.
- Name your instance
- AMI: choose Amazon Linux (under Quick Start)
- Instance type: choose t3.small
- Key pair name: jhipsterdemo. Make sure to save the pem file to be used to ssh into the EC2 instance.
- Security group:
- Allow SSH traffic
- Allow HTTP and HTTPS traffic
- Click Create instance
- Update the security group to allow inbound traffic to port 8080. (For now, we will deploy the app with the dev profile. For production, use the prod profile.)
- View the EC2 instances. Then select the instance you created.
- Click the EC2 instance's Security group
- Click edit inbound rules
- Add a rue for:
- Type: Custom TCP
- Port range: 8080-8089
- Source: 0.0.0.0/0
- Click Save rules
- Start the EC2 instance
- Copy the EC2 instance's private IP address. You will use this for ssh
- Copy the EC2 instance's public IP address. You will use this for viewing the deployed application.
- Perform the rest of the steps in Cloud9 IDE
- Upload the pem file to Cloud9. Note: make sure you save it outside the project folder, so as not to accidentally commit it to code repository.
- Set the right permissions on the pem file: chmod 400 jhipsterdemo.pem
- Generate a jar file with (back inside the project folder): npm run java:war:dev
- Copy the jar file into EC2:
scp -i jhipsterdemo.pem ./target/{your_project_jar_filename}.jar ec2-user@{your_ec2_internal_ip_address}:~/ - ssh into the EC2 instance, then install a JDK
ssh -i jhipsterdemo.pem ec2-user@{your_ec2_internal_ip_address}
sudo yum install java-17-amazon-corretto-jmods.x86_64 - Run the application (still inside the EC2 ssh): java -jar {your_project_jar_filename}.jar
What we've accomplished:
- Complete development environment setup in the cloud
- Generated code for major functional & non-functional requirements
- Rapid conversion from domain diagram to code
- Deployment to cloud
What next?
- Go to jhipster.tech to learn more about what you can do with JHipster
- Let's connect for further mentoring: https://bit.ly/elielgoco





.png)









