Sunday, April 30, 2023

AWS services in Spring Boot

  • Considering our Fargate Container has the hole to access the and execute AWS Services. We can use following code to access the Different Services. 
  • Remember The role of Fargate container is different from Build and Deployment creator role so the role of tools like Code Build,EC2 Image Builder may be different than role of Fargate container. The role of Fargate container or any other container in which our JVM is running and executing code matters here.
Q How can we call a Step Function using Service?
  •  private AWSStepFunctions awsStepfunctions;  
     awsStepfunctions = AWSStepFunctionsClientBuilder.standard().build();  
     //Step Function Parameters  
     JSONObject sfnInput = new JSONObject();  
     sfnInput.put("NAME", dataSetup.getname());  
     sfnInput.put("F_DATE", parsedfdate);  
     sfnInput.put("T_DATE", parsedtdate);  
          if (!StringUtils.hasLength(arn)) {  
                    arn = this.awsStateMachineArn;  
               }  
     try {  
                    StartExecutionRequest executionRequest = new StartExecutionRequest().withStateMachineArn(arn)  
                              .withInput(sfnInput.toString());  
                    StartExecutionResult result = this.awsStepfunctions.startExecution(executionRequest);  
                    log.info("Response from Execution " + arn + "=====>" + result.toString());  
               } catch (Exception e) {  
                    log.info(e.toString());  
               }  
sdf

Spring Boot

What is circular/cyclic dependency in spring boot? When two services are interdependent on each other, that is to start one service, we requ...