This topic describes how to use Cloud Application Platform to quickly host a Spring Boot framework on Function Compute FC and simplify the initial setup process for Spring applications.
Scenario overview
Alibaba Cloud products used
Billing
Deploying the project is free. Accessing the project incurs Function Compute fees. For more information, see Billing overview.
Procedure
Step 1: Claim a free trial
-
Go to Alibaba Cloud Free Trial. Click the Log On/Sign Up button in the upper-right corner of the page. Follow the on-screen instructions to log on with an existing Alibaba Cloud account, sign up for a new account, or complete real-name verification (personal or enterprise verification, as required by the product).
-
Under Product Category, choose , and then select Function Compute FC. Check if you meet the free trial requirements. If you meet the requirements, click Try Now, and then follow the instructions to activate Function Compute and claim the free trial package. If you do not meet the requirements, proceed to the next step.
Step 2: Deploy the project
-
(Optional) The first time you log on to the Cloud-native Application Platform (CAP) console, complete the quick authorization for CAP.
-
Choose to go to the SpringBoot template details page.
-
On the Template Details page, click Deploy Now to start the project deployment.
-
Enter the Project Name, Region, and Function Name, and then click Deploy Project.
In this example, Project Name is set to
start-springboot, Region is set to China (Hangzhou), and Function Name is set tospringboot-0a41. -
In the Preview Project Resources dialog box that appears, you can see the cloud resources that will be created. Click Confirm Deployment to start deploying the project.
The dialog box shows that the Function Compute FC service is activated and uses the pay-as-you-go billing method (free deployment, pay for what you use). After you confirm the deployment, the system automatically creates a project and a production environment. In the production environment, the system creates the services predefined in the template and deploys all services.
-
On the Project Details page, you can view the deployment status and logs.
After the deployment is successful, the service status changes to Deployed, and a green check mark appears next to the start_springboot service in the service list on the left. The details area on the right displays information such as the function name, public endpoint, and region. Select the Deployment History tab to view the deployment version, duration, and the deployment log output at the bottom.
Step 3: Access the project
-
On the project details page, select the Access URL tab, and then click the Custom Domain Name to access the project.
A successful access attempt displays the following information.
{ "msg": "Hello, World! at 2024-09-06 07:01:50", "request": { "path": "/", "query": "{}", "clientIp": "xxx" } }
Step 4: Clean up resources
-
In the navigation pane on the left, choose . In the project list, find the target project and click Delete in the Actions column.
-
In the Delete Project dialog box, select the services and cloud resources to delete, enter the project name for confirmation, and select the I understand that deleting this project and selected services will immediately and irreversibly interrupt their online services and permanently delete dependent cloud resources. checkbox. Then, click Confirm Deletion.
NoteIf you want to delete only the project but retain the created cloud resources, do not select the specified services.