Build, Deploy and Run
Prerequisites
Build
You can build the Lambda Functions using the command
sam build
It will create
- a
.zip package
for thedistributor
andmerger
function - a
Dockerimage
for theexecutor
function
Check out the Dockerfile
in the executor/
folder and the requirements.txt
file in the distributor/
and merger/
folder for more details about the dependencies.
Deploy
To deploy your Lambda Function using CloudFormation, use the command:
sam deploy --guided
It will run a wizard and ask for a final confirmation before deployment.
CloudFormation will keep track of your already deployed resources and will only re-deploy the changes.
Run
Before you can run the tests you need to upload the test cases to the S3 Bucket Testsbucket
.
You can do this with the AWS Console or with the AWS CLI.
The Folder structure in the S3 Bucket Testsbucket
shall look like that:
.
├── <project-name>
│ ├── tests
│ │ ├── <TestSuiteA>.robot
│ │ ├── <TestSuiteb>.robot
│ │ └── ...
│ └── resources
│ ├── <ResourceA>.resource
│ ├── <ResourceB>.resource
│ └── ...
└── <another-project>
├── tests
│ └── ...
└── ...
Multiple Test Projects (including Test Suites
inside a tests/
folder) can be stored on a single Testsbucket
.
The Distributor
and Executor
will download only the required project
folder (which is passed in the body of a http post request).
Upload Test Cases
From AWS Console
Either open the AWS Console landing page and navigate to S3
.
Or open the S3 Console page directly.
Select your Testsbucket
from the list of S3 Buckets.
You can either create the folders for your project manually or upload complete folders via the web page.
From AWS CLI
aws
can copy singe files or complete folders recursively.
To copy a folder tests/
from your local filesystem to the S3 Bucket you can user the command below:
aws s3 cp --recursive tests/ s3://<testbucket-name>/<project>/tests
Test Run from API Gateway Console
A real run via an HTTP Endpoint
Before you can use the HTTP Endpoint, you need to set up an API Key
and assign it to a Usage Plan
and a Stage
.
When triggering your Lambda Function via the HTTP Endpoint, you need to provide the API Key
in the Header
for authentication.
The reason is, that the API Endpoint will be available to the public and should require some authentication.
Beside API Keys
there are also other ways of authentication.
Add API Key and Usage Plan via API Gateway Console
Run with curl
Run with Postman
Cleanup
aws cloudformation delete-stack --stack-name rf-lambda-executor