Instead of building a development environment on a notebook PC every time after using AWS, create an EC2 instance for each language such as JAVA, C #, Python, etc. and build a development environment. When you're done using it, you can take the AMI, save it as a snapshot, and delete the instance to maintain the environment at a low maintenance cost.
I made a Python environment in, but this time I will make a JAVA development environment.
First, download from the link below http://mergedoc.osdn.jp/index.html#/pleiades_distros4.7.html Download the Windows 64bit Full Edition as it also requires a JDK
After downloading, install it. It's not in the installer format, just right-click the .zip, click Extract All, and extract it to the appropriate location. Navigate to the eclipse folder and double-click eclipse.exe to launch it. You will be asked for the workspace directory, so create it in the default location.
Open Eclipse and click Help-> Install New Software. In the Work with box, type https://aws.amazon.com/eclipse and press Enter. Only ** AWS Toolkit for Eclipse Core ** is required, so install it for the time being. Also, I want to deploy to Lambda this time, so I also installed ** AWS Lambda Plugin **.
Eclipse will be restarted after the installation is complete. A new AWS icon has been added to the menu, allowing you to create an AWS Java project.
Click ** New AWS Lambda Java Project ** and a pop-up will appear.
You can create it by entering the project name sample-lambda-java. The input type will list the trigger services that call Lambda, where select Custom.
Open the project, and the program materials such as packages, classes, and JRE libraries are listed in the upper left as the configuration. Click [View AWS Explorer View] from the AWS icon menu to display a list of AWS related services as shown in the lower left. If you expand it, you can see what is created inside.
Also, on the right side is the program that opens S3Sample.java in the [com.amazonaws.smaples] package.
Now you can start coding. I'd like to make a Wrapper class and run it locally, In the execution configuration of Elipse, I created a new execution configuration with AWS SAM Local sample-lambda-java. I prepared all the SAM Template and Event files, but the error "Property SAM runtime does not contain a valid file!" Was displayed, and when I forced it to execute, the error was displayed.
The Serverless template file is created as follows.
AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: An AWS Serverless Specification template describing your function. Resources: samplelambdajava: Type: 'AWS::Serverless::Function' Properties: Handler: com.amazonaws.lambda.demo.LambdaFunctionHandler Runtime: java8 Description: '' MemorySize: 512 Timeout: 15 Role: 'arn:aws:iam::xxxxxxxxxxxx:role/lambda_access_execution'
You need a SAM Local environment.
After working on building the SAM Local environment with reference to, I was disappointed by starting Docker. If you start the virtual environment (Windows: Docker Toolbox) on EC2 (virtual environment), an error will occur. I gave up because I couldn't mess with the BIOS.
If you can't run it locally, you can upload it and run it on the Console. Click Upload function to AWS Lambda to upload. Create a test event in the management console and click "Test"
It was a success.