Slide 1

Slide 1 text

From Code to Cloud: Turbocharging your Java Apps for AWS December 10th 2024 San Francisco

Slide 2

Slide 2 text

Anca Ghenade - Developer Advocate - [email protected] @tinyg210 @tinyg210.bsky.social

Slide 3

Slide 3 text

How does one go around developing applications using AWS services?

Slide 4

Slide 4 text

A Little Story About Cloud Development (freshly confirmed at AWS re:Invent)

Slide 5

Slide 5 text

1. The Software Engineers are tasked with developing a new application on AWS Cloud

Slide 6

Slide 6 text

2. Developing on a local machine, they soon find out that there are lots of dependencies with resources in the cloud

Slide 7

Slide 7 text

3. They realize that the dev & test loop is extremely slow and tedious. Every local change needs to be packaged and uploaded to the cloud for testing.

Slide 8

Slide 8 text

4. Now someone has a red build on their feature branch, but can’t efficiently test and debug their code in the CI/CD pipeline.

Slide 9

Slide 9 text

5. The whole team is using Git flow for development - one CI build per feature branch. There is an explosion of different environments required for development (branches x developers).

Slide 10

Slide 10 text

6. The manager approaches the team and complains that AWS dev/test resources are not being cleaned up properly causing cost spikes.

Slide 11

Slide 11 text

So things are kind of… complicated. 󰤆

Slide 12

Slide 12 text

And I have proof:

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

5 minutes later…

Slide 15

Slide 15 text

What is LocalStack and how can it help you? A fully functional local cloud stack that was born out of these exact concerns.

Slide 16

Slide 16 text

● Enables a highly efficient dev & test loop for cloud apps ● Ships as a Docker image, easy to install and start up ● Support for 100 (-ish) services (and growing): ○ compute (Lambda, ECS, EKS) ○ various databases (DynamoDB, RDS) ○ messaging (SQS, Kinesis, MSK) ○ some sophisticated/exotic APIs (Athena, Glue) ● CI integrations & advanced collaboration features ● Branching out into other areas: Chaos Engineering, IAM Security Testing, Cloud Ephemeral Environments, 3rd Party Extensions, etc

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Let’s find a solution for each and every one of those issues and move fast to get to our goal.

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

https://github.com/tinyg210/sf-java-meetup-demo

Slide 21

Slide 21 text

Number 1: Development (Follow the instructions in the README file, using terraform-local + “dev” profile)

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Using Spring Profiles…

Slide 24

Slide 24 text

Production Development + Testing

Slide 25

Slide 25 text

Production Everything before production

Slide 26

Slide 26 text

“Your application won’t even know the difference”

Slide 27

Slide 27 text

Number 2: Testing IaC

Slide 28

Slide 28 text

Two ways of doing that: ● Manually testing while developing 👆 ● Along with your code tests using Testcontainers 👇

Slide 29

Slide 29 text

Number 3: Testing Code Please use this repo for this use-case: https://github.com/tinyg210/terraform-testcontainers-shipmen t-list-demo (It’s the same project, without generating random bucket names - for ease of use)

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Testing your application workflow

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Your local tests…

Slide 35

Slide 35 text

Number 4: CI/CD Integration (tests, image builds, deployments, etc) (File: .github/workflows/ci.yml)

Slide 36

Slide 36 text

● Automated Testing ● Continuous Deployment ● Integration Testing ● Code Quality Analysis ● Infrastructure as Code (IaC) Validation ● Containerization and Orchestration ● Feature Branch Testing ● Rollbacks and Blue/Green Deployments ● Performance Testing and Scalability ● Automated Documentation Generation

Slide 37

Slide 37 text

● Automated Testing ● Continuous Deployment ● Integration Testing ● Code Quality Analysis ● Infrastructure as Code (IaC) Validation ● Containerization and Orchestration ● Feature Branch Testing ● Rollbacks and Blue/Green Deployments ● Performance Testing and Scalability ● Automated Documentation Generation

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Number 5: PR Preview & final checks (.github/workflows/ci.yml) When the GitHub Actions pipeline runs successfully a snapshot (Cloud Pod) of the LocalStack instance is taken and used to create a remote instance, which will have the connection URL displayed after creation.

Slide 40

Slide 40 text

Number 6: Deployment to AWS Run the backend using the profile “prod” + use Terraform with the same main.tf file.

Slide 41

Slide 41 text

We’re giving the OPS back to the DEVS.

Slide 42

Slide 42 text

Thank You