The twelve-factor methodology is used for building software-as-a-service (SAAS) applications using any kind of programming language together with different backing services. Following this approach, it is possible to deploy an app that has minimum deviations between production and development, can be scaled and deployed to most cloud platforms without the need for system administrators or servers, and has a great connection with the base operating system. In general, these cloud-friendly applications do not only operate in the cloud — they also adopt elastic scalability, ephemeral file systems and statelessness. It is common for them to approach everything as a service which makes them easy to scale and deploy swiftly together with fast delivery of features and other changes. There are particular rules, guidelines and recommendations to follow for each factor/aspect of this methodology in order to develop a cloud-native application. Codebase The first and priority of the twelve factors is the codebase and it represents a single repository or a set of them sharing a root commit. An application must have only one codebase which is consistent across all application deployments and monitored in a version control system. One codebase is thought to have multiple deploys if the developers and their code are well organized. On the other hand, if an application is made up of a couple or more source code repositories, automating the build and deployment phases of the app's life cycle is practically impossible. Having several development teams working on a single codebase can lead to considerable problems. As a conclusion, good developer expertise, coordination and structure among the teams enable the application to have a functioning and well-organized codebase. It is certainly possible to share code across many applications using the one code, one app approach. It's also crucial to determine if shared code should be treated as a microservice or as a standalone product. If shared code is a different product, it could be included as a dependency in the app. Dependencies Modern dependency management includes an integrated server that contains everything an application needs to run in a single build artifact. Applications should always bring their dependencies to the cloud in order to be self-contained and have an embedded server. The majority of programming languages have facilities that empower developers to define dependencies and delegate duty to make sure that those dependencies are fulfilled with a certain tool. Declared dependencies must be isolated at all times. Isolation might be accomplished by examining the specified dependencies and grouping them into a sub-structure beneath or inside the application's artifact. The code can't rely on dependencies already being present on the deployment destination. Furthermore, a cloud-native application never assumes the presence of system-wide packages. Possible failures can bring down a whole server or cost a corporation a financial loss due to undetected data corruption if dependencies are not adequately isolated. The idea of repeated deployments is important to properly manage an application's dependencies, thus no assumption should be made that the runtime into which an application is deployed is not automated. If dependencies are maintained with control and consistency, applications will be one level closer to being able to operate in cloud environments. Configuration The safest approach to save and maintain an application's configuration is to use env vars, which implies externalizing and storing the config in the environment. Non-changeable components do not belong in the configuration since it comprises of components that are variable throughout different deploys. Internal information that is part of the app must not be included in configuration. To clarify, if a value is consistent across all deploys, it isn't configuration. According to twelve-factor rules, configuration should be kept distinct from code, because code doesn't vary across different deploys, but configuration often does. With this separation, it is easier to alter environment variables as no code is being affected. It's extremely important to be cautious while keeping security credentials - they should never be kept in the codebase. Bundled assets remain part of the codebase even if security credentials are stored in some properties files or retrieved from the source code. Since environment variables are maintained individually for each deploy, the application concept that contains them scales efficiently.10/10/2022
1 monolithic architectures and their problems 2 microservices and why both 1&2: http://aws-de-media.s3.amazonaws.com/images/AWS_Summit_Berlin_2016/sessions/pushing_the_boundaries_1300_microservices_on_aws.pdf8/15/2022
ana@DESKTOP-U0ULQ81:/mnt/c/Users/it/cloudana_git/LDM_GIT/ldm/ldm$ packer build -force -var "latest_ldm=$latest_ldm" -var-file="marketplace.pkrvars.hcl" test.pkr.hcl amazon-ebs.example: output will be in this color. azure-arm.example: output will be in this color. ==> azure-arm.example: Running builder ... ==> azure-arm.example: Getting tokens using device flow ==> azure-arm.example: Getting token for https://management.azure.com/ ==> azure-arm.example: Loading auth token from file: /home/ana/.azure/packer/oauth-184a7bbc-05d1-4814-acdb-8647136eff21mgmt.json ==> azure-arm.example: Auth token found in file: /home/ana/.azure/packer/oauth-184a7bbc-05d1-4814-acdb-8647136eff21mgmt.json ==> amazon-ebs.example: Force Deregister flag found, skipping prevalidating AMI Name3/11/2022
Best practice rules for AWS Lambda https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/Lambda/ also best practices, has some advices https://aws.plainenglish.io/aws-lambda-best-practices-7454da49314d --> Since serverless computing has its own set of disadvantages, it may not be appropriate for everyone or every use case. When it comes to developing Lambda code, knowing how a lambda function works may help us identify some of the best practices to follow when utilizing lambda functions, as well as the value of each best practice. Function code and dependencies, function configuration, logging and monitoring are among the key practices described below. 1. The lambda handler should be separated from service logic It is recommended that the business logic be written in a separate service layer rather than in the handler function itself. It's because it makes it much simpler to write more readable and intelligible code, as well as unit-testable code for the business logic. For example, the handler function will be an entry point for a lambda function and let's say that multiple variables are passed into the mentioned handler function. It may get problematic if each lambda triggers an event with the first parameter containing all information about the triggering event.12/13/2021
By clicking below, you agree to our terms of service.
New to HackMD? Sign up