Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • configuration of the properties e.g. Cloud account, and CLI path.

  • cloning the code and environment file from the Git repository.

  • create the docker image and push it to the AWS ECR registry.

  • perform the deployment using the newly created image present at AWS ECR.

  • verify the deployment.

Checklist

...

We can see the details of ECR registry.

...

Configure Container

...

Account

Configure AWS Container Account under Topology. FlexDeploy will connect to the AWS private container registry and push the image.

...

  1. Docker Registry Token/password needs to be kept hidden. To update the same click on the pencil icon as shown below

  2. next update the AWS IAM user key under Secret Text. This is to make sure no one else can retrieve the password

...

Git

...

Repository Structure

The Git repository should be a docker based application. Dockerfile should be present in application to build the image and environment variables file to add the variables.

...

  1. navigate to the Workflows

  2. Select the “+” button from the left-hand pane to create a new workflow

...

The Workflow Group and Subgroup define the folder hierarchy. Once both workflows are created it should look like the below. No constraint on workflow or folder naming convention.

...

The steps of the workflow execution can be configured through the Workflow Definition section.

...

Below given is a sample build workflow to copy the file from Git repository.

...

Step-i: Clone Git Repository
This step will clone the Git repository codebase into the project execution working directory. The Git URL will be retrieved from Source Control configured under Project Configuration.

...

Step-ii: Copy the environment file
The below step will copy the environment file to the artifact. Also check the Produces Artifact option to save the files as artifact so that can be used from Deploy workflow.

...

Below given is a sample workflow to build and push image to AWS ECR and then use this Image to update Lambda function code.

...

Step-i: Clone Git Repository

This step will clone the Git repository codebase into the project execution working directory. The Git URL will be retrieved from Source Control configured under Project Configuration.

...

Step-ii: Build and Push the docker image to AWS private container registry

Below given is the Docker plugin(buildImage operation) configurations. The below step will build and push docker image to AWS private container registry.

...

The plugin operation by default would look for Dokerfile under TEMP directory. In case the same exist in some other folder, relative path has to be specified from TEMP directory.

Step-iii: updateLambdaFunctionCode

This step will deploy Lambda function code, and also publish the function version. We are setting function version variable, which we will use in upsert lambda operation.

...

In above configuration using following Inputs.

Input Name

Input Code

Type

Required

Description

Additional Arguments

FDAWS_LAMBDA_INP_ADD_ENV_VAR_ADDITIONAL_ARG

String

No

Literal key and value pairs. e.g. --region=us-east-1

And for boolean type arguments give the option without any value. e.g --publish --debug

Environment Variables

FDAWS_LAMBDA_INP_ENV_VAR

String

No

Environment Variables in acceptable format.

Publish new version

FDAWS_LAMBDA_INP_PUBLISH_VERSION

Boolean

No

Select to publish a new version. Default value is false.

Project Configuration

Navigate to the Project tab and create a Project with a logical name(AWS Deploy Lambda Function Using AWS ECR)

...

Configure the Build and Deploy workflow that has been created in previous steps as shown below.

...

Source Control

Configure the Source SCM repository under Source Control as shown below.

...

  1. To configure Project specific Source Control one first need to navigate to the Project Configuration tab.

  2. Next, expand the SOURCE CONTROL option from the left-hand pane.

  3. Select the appropriate Source Control Type

  4. Configure Source Repository. For detailed steps of Source Control configuration please refer to Configure Source Control in FlexDeployProject Properties

Project Properties

...

Lambda Function name: Name of the lambda function to deploy the code, if lambda function name is not given S3 key name will be use as function name.

Environment Variable File Path: Path of the file which contains list of the environment variables.

Please refer to the document for more details about Lambda function name and Environment Variable File path . AWS Lambda - Environment Variable File and zip File location options

KMS detail: Key Id or Key ARN details, both are accepted. Please refer to the document for more details. AWS Key Management Service - AWS Key Management Service

URI of a container Image: URI of a container image in the Amazon ECR registry.

Docker Image Name: The name of the docker image, including the repository if desired. i.e. foo/bar or bar.

Docker Image Tag: The tag of the docker image. For example: 1.2.3.

Target Properties

Select Topology from the menu and then select Targets. Select the target group and environment, provide the properties detail, according to the description.

Properties

Mandatory field

Description

Cloud Account

Optional

Select the Cloud Account to connect the Lambda Function.

CLI Path

Optional

Directory where Cloud CLI is installed.

AWS Region

Optional

Value of the AWS Region.

Below given are the environment-specific values which need to be updated.

...

Cloud Account

The AWS Cloud account needs to be set here from the drop-down. It will show all Cloud Accounts configured under Topology, which we have already mentioned earlier.

...

CLI Path

AWS CLI path can be set as environment property, if it’s not set then by default plugin will check for CLI in system classpath.

...

Override Properties at Project Level

Let assume a scenario, where we want to change Cloud account for any specific project. Apart from setting at environment level, it can also be set at project properties by using Override Property. Please check below mentioned steps.

  1. Navigate to the Project Configuration tab as shown above.

  2. Next, select the PROPERTIES option from the left-hand pane.

  3. Click on the OVERRIDE option.

  4. Select the Cloud Account option from Property.

  5. Select the Environment from the drop down list.

  6. Select the Target Group from the drop down list.

...

Build and Deploy Execution

For detailed steps on how to perform build and deploy, please refer to document. Deploy through FlexDeploy for AWS plugin

After Deploy Execution

Once the build and push image operation is done, we can see the details in the ECR registry.

...

Using the above image the deploy operation is executed, we can see the details of the image in the AWS console.

...

We can verify the deploy version from the plugin output and AWS console.

...

Container Image Settings

The following are common container image settings.

  • ENTRYPOINT – Specifies the absolute path to the entry point of the application.

  • CMD – Specifies parameters that we want to pass in with ENTRYPOINT.

  • WORKDIR – Specifies the absolute path to the working directory.

  • ENV – Specifies an environment variable for the Lambda function.

For more information about how Docker uses the container image settings, see ENTRYPOINT in the Dockerfile reference on the Docker Docs website. For more information about using ENTRYPOINT and CMD, see Demystifying ENTRYPOINT and CMD in Docker on the AWS Open Source Blog. We can override these configurations using the addLambdaEnvironmentVariables operation.

Example to override Image configuration using the addLambdaEnvironmentVariables operation.

...

Check Image Configuration information from the AWS console.

...

Please refer to the link for more information about docker cmd and entrypoint https://phoenixnap.com/kb/docker-cmd-vs-entrypoint