iTerm2 recently introduced a great feature: separate light and dark mode colors. This feature enhances the visual appeal of your terminal and keeps it in sync with your Mac’s mode.
This feature is not just about aesthetics; it’s about comfort. Imagine your terminal always matching your Mac’s light or dark mode, creating a seamless and visually pleasing experience. This enhances the visual appeal and reduces eye strain, making your terminal usage more comfortable.
The Problem
In the image below, you can notice that the iTerm2 does not change by default when we switch between light and dark modes.
AWS recently announced Java 17 support for Lambdas, In this blog post, we’ll explore how to create a Java 17 AWS Lambda Function without IDE, build tool or any dependency.
In this example, we have an add method that takes an Input java record with 2 fields: x and y, and returns an Output java record with the sum of x and y assigned to the result field.
This is the only requirement for a AWS Lambda Function:
An instance method that takes one single parameter and returns something an object or Void.
That’s it. Now we can proceed to compile and package our AWS Lambda Function:
Compile:
$ javac Function.java
Package:
$ zip function.zip *.class
Next, let’s navigate to the AWS Lambda Console.
Click on the Create function button.
Assign a lambda name and select Java 17 as the runtime.
Click on the Upload from button.
Click Upload button.
Choose the function.zip file that we generated.
Click Edit on the Code properties section.
Change the Handler to Function::add and click Save.
Go to the Test tab.
Change the JSON payload to:
{"x":123,"y":333}
Click the Test button, then expand the Details section to see the result.
That’s it! You have successfully created and tested your Java 17 AWS Lambda function. The output should be:
{"result":456}
This demonstrates the simplicity and power of using Java 17 with AWS Lambda. With just a few steps, you can leverage the latest Java version to build efficient and scalable serverless applications.
Feel free to explore further and unleash the full potential of Java 17 on AWS Lambda. Happy coding!
I generally use many different options on maven projects to set up things like memory lower and upper limits, fail at the end, the process in batch, use x number of threads, etc. In addition to this, sometimes I need to pass flags to the JVM like add modules, garbage collector flags, etc., and it is difficult to remember and also error-prone to have something like this:
$ JAVA_OPTS="-Xms512m -Xmx1024m -Djava.awt.headless=true"\
mvn -B-T 4 -fae-P ci verify
or even worst with the extended version of the flags:
GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.
In the previous article about Java 14 Records, we saw how to start creating Records to avoid writing much boilerplate code that the compiler would generate for us.
Now the next steps are to see how we can serialize records to JSON and deserialize JSON to records to be able to use them as a request/response representation for microservices.