Getting Started • API Endpoints • AWS Deploy • References
This project is an API built using Java, Java Spring, Flyway Migrations, PostgresSQL as the database.The API emulates the functionality of an event web application similar to UberHub. Users can create and view registered events. The API has been deployed on AWS utilizing an EC2 instance, a RDS PostgreSQL database, and an S3 bucket.
- Cloning de repository
git clone https://github.com/vitorstaub/eventshub-api.git
- Install dependencies with Maven
- Install PostgreSQL
- Install AWS CLI
- Configure the AWS CLI
application.properties
spring.datasource.url=${AWS_DB_URL:jdbc:postgresql://localhost:5432/postgres}
spring.datasource.username=${AWS_DB_USER:vitorstaub}
spring.datasource.password=${AWS_DB_PASSWORD:password}
aws.region=us-east-1
aws.bucket.name=${BUCKET_NAME}
Accessible at
http://localhost:8080
The API provides the following endpoints:
POST /event - Register a new event.
GET /api/event - Retrieve a list of all events.
GET /api/event/{eventId} - Retrieve a specific event by ID.
-
Create S3 bucket
-
Add Bucket S3 public get policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::BUCKET_NAME/*"
}
]
}
- Create EC2 instance
- Create VPC (Virtual Private Cloud)
- Create a public subnet that uses the latter half of the IP addresses in the VPC.
CIDR IPv4:
10.0.1.0/24
-
Create a private subnet that uses the first half of the IP addresses in the VPC.
CIDR IPv4:
10.0.0.0/24
- Create a PostgreSQL Database
- Add the database to the security group of the ECS instance
When contributing to this project, please follow the existing code style, commit conventions, and submit your changes in a separate branch.