Skip to content

cloudposse/example-app-on-lambda-with-gha

Repository files navigation

example-app-on-lambda

example-app-on-lambda

This repository defines the example application for Lambda Deployments developed with Cloud Posse.

Latest ReleaseSlack Community

Dev - Staging - Prod

Example Python application deployed on AWS Lambda with Github Actions.

What

This example uses three reusable workflows and one workflow for PRs, one for Main branch commits, and one for releases.

  • The first workflow is triggered on a PR. It builds the application, publishes the zip to AWS S3 and updates ssm variables for the application.
  • The second workflow is triggered on a commit to the main branch. It builds the application, publishes the zip to AWS S3 and updates ssm variables for the application.
  • The third workflow is triggered on a release. It copies the application from the staging s3 bucket to the production s3 bucket and updates ssm variables for the application.

The reusable workflows are prefixed with reusable and are located in the .github/workflows directory. They assist with the following:

  • reusable-publish-lambda-zip.yaml - This workflow builds the application, publishes the zip to AWS S3 and updates ssm variables for the application.
  • reusable-deploy-lambda.yaml - This workflow deploys the application to AWS Lambda using GitOps by triggering a stack.
  • reusable-promote-lambda-zip.yaml - This workflow copies the application from the staging s3 bucket to the production s3 bucket and updates ssm variables for the application.

How

There are three supporting github actions that are prefixed with reusable. These break down the tasks for managing lambda applications.

All of the workflows in this repository can be used directly in your own repository with little need for modification. The only changes that need to be made are to the .github/config/app.yaml file. This file contains the S3 bucket and IAM Roles that are used by the workflows.

Getting Started

To get started, you will need to create a new repository from this template. Then you will need to update the .github/config/app.yaml to use your own s3 bucket and ssm variables. The IAM roles used in each account (dev, staging, prod) will all also need to be set.

The cicd-role-arns (IAM Role ARNs) can be created by using the github-oidc-roles component found here deployed with the lambda-cicd policy. The artifacts-role-arn can also be created by the above component, it is deployed as the same account as the s3-bucket. The s3 bucket can be created by using the s3-bucket component found here with the following privileged_principal_actions policy:

privileged_principal_actions:
  - s3:PutObject
  - s3:GetObject
  - s3:ListBucket
  - s3:GetBucketLocation

Similarly the bucket will need to trust the artifacts-role-arn in the privileged_principal_arns variable. example

        privileged_principal_arns:
        - arn:aws:iam::01234567890:role/acme-core-gbl-artifacts-gha-iam-lambda-cicd: [""]

Related Projects

Check out these related projects.

✨ Contributing

This project is under active development, and we encourage contributions from our community. Many thanks to our outstanding contributors:


This project is part of our comprehensive "SweetOps" approach towards DevOps.

It's 100% Open Source and licensed under the APACHE2.

✨ Contributing

🐛 Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

💻 Developing

If you are interested in being a contributor and want to get involved in developing this project or help out with our other projects, we would love to hear from you! Shoot us an email.

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull Request so that we can review your changes

NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!

🌎 Slack Community

Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.

📰 Newsletter

Sign up for our newsletter that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.

📆 Office Hours

Join us every Wednesday via Zoom for our weekly "Lunch & Learn" sessions. It's FREE for everyone!

About

This project is maintained and funded by Cloud Posse, LLC.

We are a DevOps Accelerator. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.

Learn More

Work directly with our team of DevOps experts via email, slack, and video conferencing.

We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.

  • Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
  • Release Engineering. You'll have end-to-end CI/CD with unlimited staging environments.
  • Site Reliability Engineering. You'll have total visibility into your apps and microservices.
  • Security Baseline. You'll have built-in governance with accountability and audit logs for all changes.
  • GitOps. You'll be able to operate your infrastructure via Pull Requests.
  • Training. You'll receive hands-on training so your team can operate what we build.
  • Questions. You'll have a direct line of communication between our teams via a Shared Slack channel.
  • Troubleshooting. You'll get help to triage when things aren't working.
  • Code Reviews. You'll receive constructive feedback on Pull Requests.
  • Bug Fixes. We'll rapidly work with you to fix any bugs in our projects.

README Commercial Support

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Trademarks

All other trademarks referenced herein are the property of their respective owners.


Copyright © 2017-2023 Cloud Posse, LLC

README Footer Beacon

About

Example Lambda Python application using workflows

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published