CI/CD Java Application to Elastic Beanstalk with CodePipeline The following is a summary of the errors that can occur and their corresponding methods.
- OS: Windows10
- IDE: Eclipse 2020-03
- JDK: Amazon Correto 8
- Framework: Spring Boot
-Java SE (Java 8 version 2.10.8)
→ *This is not the latest version released on June 3, 2020. Please understand. -RDS: MySQL Community Edition (Version 8.0.17)
Error and countermeasures
1. Elastic Beanstalk
(1) 502 (Bad Gateway) error occurs when accessing
Let’s check the settings again. [CodePipeline x Elastic Beanstalk] CI/CD of Java application to Elastic Beanstalk with CodePipeline Part 2 Review “ Additional settings” in “3. Creating an Elastic Beanstalk environment” and check whether there are any omissions in the settings.
(1) Cannot access the database
Let’s check the permission settings once again. [CodePipeline x Elastic Beanstalk] CI/CD of Java application to Elastic Beanstalk with CodePipeline Part 2 Review (4) to (9) of “ Connection settings in RDS” of “4. Database settings” of and check if there is any leak.
(1) ``The action failed because either the artifact or the Amazon S3 bucket could not be found.
It can be resolved by changing the input artifact from Build Artifact to Source Artifact. Follow the procedure below to change it.
① Click “Edit” in the pipeline.
② In the “Deploy” field, click “Edit Stage”.
③ Click the edit mark (?).
④ Change “Input Artifact” to “Source Artifact” (1) and click “Finish” (2).
⑤ Click “Save”.
⑥ Click “Save”.
(2) “Deployment failed. The provided role does not have sufficient permissions: Failed to deploy application. Service: AWS Logs…”
This error occurs because you do not have access to CloudWatchLogs. This can be resolved by granting the “CloudWatchLogsFullAccess” policy to the role created for CodePipeline.
Below are the steps.
(1) On the management console, search for “IAM” and click it.
② “Role” (①)> Search for the target CodePipeline role (②) and click the role name (③).
③ Click “Attach policy”
④ Search for “CloudWatchLogsFullAccess” (1), check it (2), and click “Attach Policy” (3).
At the end
As I wrote in the main part, I got an error 3 times at the stage of 1--(5) change of gradlew of the main part, and 5-(1)-(10) deployment stage. I stumbled around, and I felt like I was breaking my heart. Even if an error occurs, don’t be shy, rather feel like how to solve it and enjoy it!