Tips around the sample to release Java Lambda on CodePipeline

TL;DR

I wrote this article. Minimum configuration sample that automatically releases Lambda by Java with Codepipeline

This is a private memo of the surrounding information of Code Pipeline written in this article.

Code Pipeline overall flow

1. Source stage

Get the code for regular monitoring and updates of the github repository.

2. Build stage

Build with CodeBuild. The build will be executed as described in buildspec.yml.

  1. gradlew creates a jar file.
  2. ʻaws cloudformation package` is executed and the following processing is executed.
  3. Place the generated jar file in S3 :: auto-release-sample.
  4. A template file (packaged-minimum-lambda-java-model.yaml) is generated and placed in the S3 bucket created for Codepipeline.

3. Staging stage

Lambda functions are constructed from template files and jar files.

  1. Extract the difference from the previous execution result. (Action mode: Create or replace change set)
  2. Actually build the Lambda function from the difference. (Action mode: Execution of change set)

Miscellaneous peripheral knowledge

S3

An S3 bucket is created when you create a CodePipeline. The naming pattern is codepipeline-<region name>-<random value> Example: codepipeline-ap-northeast-1- ????????????? /

As for the contents, all the files downloaded from github and the template file generated by the build execution are compressed with zip and saved. A folder is created internally with the I / O artifact name at each step.

Related roles

The role for CloudFormation to work in the Staging stage. A role prepared by the developer in advance. s3: GetObject`` lambda: * `` cloudformation: CreateChangeSet etc.

--code-build-<build project name> -service-role

A role that enables CodeBuild to work. You can create s3: PutObject to S3 :: auto-release-sample. You can do s3: PutObject`` s3: GetObject to codepipeline-ap-northeast-1-121111111111 /.

reference: http://docs.aws.amazon.com/ja_jp/codebuild/latest/userguide/setting-up.html?icmpid=docs_acb_console#setting-up-service-role

A role for AWS CodePipeline to work. Looking at the contents of the policy, there are settings other than the processing you want to do this time, such as code commit, code deploy ʻelasticbeanstalk, ʻautoscaling, so it seems that all the typical settings are included.

--<Stack name> -AutoReleasedLambdaRole-<Random value>

The role when Lambda runs. Automatically generated when a Lambda is created in CloudFormation. ʻAutoReleasedLambdaRole is probably a fixed string. The contents are those with ʻAWS LambdaBasicExecutionRole. (Details unverified)

If you need various role settings to run Lambda, you may need to prepare separately. (Unverified) (Prepare in advance or set in CloudFormation template)

Recommended Posts

Tips around the sample to release Java Lambda on CodePipeline
Minimum configuration sample to automatically release Lambda by Java with Code pipeline
[Java] Memo on how to write the source
What Java engineers need to prepare for the Java 11 release
[Java] Introduction to lambda expressions
Run the sample "Introduction to TensorFlow Development" on Jetson nano
How to switch Java in the OpenJDK era on Mac
Input to the Java console
Sample code to call the Yahoo! Local Search API in Java
I tried to display the calendar on the Eclipse console using Java.
[Introduction to Java] About lambda expressions
[java8] To understand the Stream API
[Java] How to update Java on Windows
Is Java on AWS Lambda slow?
Hello World on AWS Lambda + Java
Consideration on the 2017 Java Persistence Framework (1)
Welcome to the Java Library Swamp! !!
Introducing Java tips GreenMail to Junit5
The road from JavaScript to Java
The origin of Java lambda expressions
How to use Java lambda expressions
[Java] How to retrieve the parameters passed from html on the server side
Ruby on Rails DB Tips for creating methods to reduce the load
How to check Java installed on Mac
My thoughts on the equals method (Java)
[Java] How to use the File class
Java reference to understand in the figure
Introduction to java for the first time # 2
[Java] How to use the hasNext function
Now let's recap the Java lambda expression
I tried to summarize Java lambda expressions
Java SE8 Silver ~ The Road to Pass ~
[Java] How to use the HashMap class
Kick ShellScript on the server from Java
Install OpenJDK (Java) on the latest Ubuntu
About the new Java release model @ Seki Java (2018/07/20)
[Java] How to use the toString () method
Studying how to use the constructor (java)
[Processing × Java] How to use the loop
How to switch Java versions on Mac
[Java] How to set the Date time to 00:00:00
[Java] How to get the current directory
How to change the timezone on Ubuntu
Looking back on the basics of Java
[Processing × Java] How to use the class
How to install the legacy version [Java]
Output of the book "Introduction to Java"
[Processing × Java] How to use the function
Execute Java code stored on the clipboard.
I went to the Java Women's Club # 1
[Java] Color the standard output to the terminal
[Java] How to use the Calendar class
Sample to unzip gz file in Java
Pre-processing to display on the browser (compiler)
Steps to register Java files on GitHub
I want to play a GIF image on the Andorid app (Java, Kotlin)
Sample code to get the values of major SQL types in Java + MySQL 8.0