Skip to content

6. Available Commands

veronika2312 edited this page Feb 15, 2024 · 1 revision

Below, you can see the list of deployment framework commands (the required options are marked with an asterisk [*]):

1. syndicate assemble_java_mvn – the command to compile a java project with lambdas:

  • project_path* – the path to the Java project

    The provided path is the path for an mvn clean install. The artifacts are copied to a folder, which is be later used as the deployment bundle (the bundle path: bundles/${bundle_name}). The folders are created in the place, where the commands are executed later.

  • bundle_name: the bundle name, to which the build artifacts are gathered and later used for the deployment. Default value: $ProjectName_%Y%m%d.%H%M%S

2. syndicate assemble_node – the command to compile a NodeJS project with lambdas:

  • project_path* – the path to the NodeJS project

    The code is packed to a zip archive, where the external libraries are found, which are described in the package.json file.

  • bundle_name: the bundle name, to which the build artifacts are gathered and later used for the deployment Default value: $ProjectName_%Y%m%d.%H%M%S

3. syndicate assemble_python – the command to build the lambda artifacts, which are written on Python:

  • project_path*: the path to the Python project

    The code is packed to a zip archive, where the external libraries are found, which are described in the requirements.txt file, and internal project dependencies according to the described in local_requirements.txt file.

  • bundle_name: the bundle name, to which the build artifacts are gathered and later used for the deployment. Default value: $ProjectName_%Y%m%d.%H%M%S

4. syndicate build – the command, which allows to build an artifact. Includes the following command calls: syndicate test, syndicate assemble, syndicate package_meta, syndicate upload:

  • bundle_name: the bundle name, to which the build artifacts are gathered and later used for the deployment. Default value: $ProjectName_%Y-%m-%dT%H:%M:%SZ

  • force_upload: flag to override existing bundle with the same name

  • errors_allowed: flag to continue bundle building if some tests fail

5. syndicate package_meta – the command, which bundles all found meta descriptoions of the resources to one file, from which later the deployment is activated – build_meta.json. The file also comes to the deployment bundle:

  • bundle_name*: the bundle name, to which the build artifacts are gathered and later used for the deployment

6. syndicate create_deploy_target_bucket – an auxilary command which allows fast creating of an S3 bucket, which be later used as an artifactory. The deployment bundle becomes its part and the artifacts from it is used for deployment. Upon a call a bucket is created with the name specified in the deploy_target_bucket command

7. syndicate upload – the command for uploading the selected bundle from local storage to an S3 bucket:

  • bundle_name*: the bundle name, to which the build artifacts are gathered and later used for the deployment. NOTE: if not specified, the latest build will be uploaded

  • force_upload: flag to override existing bundle with the same name as provided

8. syndicate copy_bundle – the command allows fast copying of a bundle from one account to another. This can help in cases, when you need to perform migrations. If you have an existing artifactory, this command allows you to move the bundle needed to another account to deploy the equivalent infrastructure:

  • bundle_name*: the bundle name, to which the build artifacts are gathered and later used for the deployment

  • src_account_id*: the account ID, to which the bundle is to be uploaded

  • src_bucket_region*: the name of the region with the bucket

  • src_bucket_name*: the name of the bucket where target bundle is stored

  • role_name*: the role name from the specified account, which is assumed. Here you have to check the trusted relationship between the accounts. The active account must be a trusted one for the account which is specified in the command

  • force_upload: used if the bundle with the same name as provided already exists in a target account

9. syndicate deploy – the command to create resources in the account:

  • deploy_name: the deploy name, gives agility in managing and deploying the infrastructure in one account. You can create infrastructure, using one and the same bundle, but with different configuration regions. These are two different deploys, and each of them has its own name, so that clean didn’t depend on the deploy.

  • bundle_name: bundle name, to which the build artifacts are gathered and later used for the deployment

  • deploy_only_types: names of the resources to be deployed. You can deploy for example only DynamoDB tables from the file with the meta description of all resources

  • deploy_only_resources: names of the resources to be deployed. You can deploy only selected ressources, specifying their names

  • deploy_only_resources_path: the path to the .json file containing the list of the resources from the meta description, which are to be deployed. This simplifies the syntax of the previous parameter, if you need to deploy a big list of selected resources. The file contains a string array.

  • excluded_resources: names of the resources, which are excluded from the deploy.

  • excluded_resources_path: the path to a .json file that lists the names of the resources which should be excluded from the deployment. The file contains a string array.

  • excluded_types: names of the resource types, which are excluded from the deploy. For example, you need to deploy everything except the DynamoDB tables.

  • continue_deploy: flag to continue failed deploy.

  • replace_output: flag to replace the existing deploy output.

    Before the deployment starts, static aliases from the file sdct_aliases.conf are resolved.

    When the deployment is over, the dynamic aliases are applied, as specified in the operation files.

    During the deployment, an output file (<deploy_name>.json) with the description of all deployed resources is created. The file is saved to the S3 bucket in outputs folder in the bundle with the deployed recourses.

    Below, you can see the order of resource deployment:

    Order Resource
    1 iam_policy
    2 iam_role
    3 dynamodb_table
    4 s3_bucket
    5 cloudwatch_rule
    6 dynamodb_stream
    7 sns_topic
    7 sqs_queue
    9 kinesis_stream
    10 cloudwatch_alarm
    11 lambda
    12 state_activity
    13 step_functions
    14 api_gateway
    15 cognito_federated_pool
    16 beanstalk_app
    17 ec2_instance
    18 sns_application

10. syndicate update - the command which updates the application resources according to the specified bundle:

  • deploy_name*: the deployment name. This parameter allows the framework to decide, which exactly output file should be used for update.

  • bundle_name*: bundle name, to which the build artifacts are gathered and later used for the deployment.

  • update_only_types: the names of the resource types to be updated. Currently aws-syndicate only supports lambda, lambda layers, IAM policy, IAM role, batch job definition and batch compute environment.

  • update_only_resources: the name of the resources to be deleted. Allows to update specific resources only. For example, your bundle contains two lambdas. Only one specific lambda can be updated using this option.

  • update_only_resources_path: the path to a json-file with the resources from the meta description, which are to be updated. The file consists of a string array.

  • replace_output: the flag to replace the existing deploy output file

11. syndicate clean – the command which allows to delete the resources from the account:

  • deploy_name*: the deployment name. This parameter allows the framework to decide, which exactly output file should be used. The resources are cleaned based on the output file which is created during the deployment process. If not specified, resolves the latest deploy name.

  • bundle_name*: the name of the bundle, which was specified during the deployment. If not specified, resolves the latest bundle name

  • clean_only_types: the names of the resource types to be deleted. You can delete, for example, only DynamoDB tables.

  • clean_only_resources: the name of the resources to be deleted. Allows to delete specific resources only.

  • clean_only_resources_path: the path to a json-file with the resources from the meta description, which are to be deleted. The file consists of a string array.

  • excluded_resources: the resource names, which are excluded from the clean and are not deletedю

  • excluded_resources_path: the path to a json file with the names of resources, which are excluded from the clean procedure. The file consists of a string name array.

  • excluded_types: names of the resource types, which are excluded from the clean procedure and arenot deleted. For example, you need to deploy everything except the DynamoDb tables.

  • rollback: flag to remove failed deployed resources.

  • clean_externals: This parameter allows the framework to clean external AWS resources (disabled by default).

    The Clean parameter also has its priorities:

    Order Resource
    1 iam_policy
    2 iam_role
    3 dynamodb_table
    4 s3_bucket
    5 cloudwatch_rule
    6 dynamodb_stream
    7 sns_topic
    7 sqs_queue
    9 kinesis_stream
    10 cloudwatch_alarm
    11 lambda
    12 state_activity
    13 step_functions
    14 api_gateway
    15 cognito_federated_pool
    16 beanstalk_app
    17 ec2_instance
    18 sns_application

    Using the clean command, you delete only the resources which are created at the start of a certain deployment and specified in the deployment output file.

    The Output folder is deleted from the S3 bucket at the end of the clean procedure.

12. syndicate test – the command which allows to discover and run tests inside PYTHON project configuration path:

  • suite: supported testing frameworks. Possible options: unittest, pytest, nose. Default value: unittest.
  • test_folder_name: directory in the project that contains tests to run. Default value: tests.
  • errors_allowed: flag to return successful response even if some tests fail.

13. syndicate warmup – the command which warmups Lambda functions to avoid "cold starts":

  • bundle_name: the name of the bundle that contains lambdas to warmup. If not specified, resolves the latest bundle name
  • deploy_name: name of the deploy. If not specified, resolves the latest deploy name
  • api_gw_id: list of API Gateway IDs to warmup.
  • stage_name: list of stage names of provided API Gateway IDs.
  • lambda_auth: flag that should be specified if API Gateway Lambda Authorizer is enabled.
  • header_name: name of authentication header.
  • header_value: authentication header value.

14. syndicate generate project – the command which generates project with all the necessary components and in a right folders/files hierarchy to start developing quickly:

  • name*: the project name.
  • path: the path to project folder. The default value is current working directory.

It creates the following files:

  • .syndicate: contains only the project name. Lambdas and build_projects_mapping need be added manually.
  • .gitignore: contains .syndicate file and logs/ folder.
  • Changelog.md: contains the draft of the changelog.
  • deployment_resources.json: contains description of lambda-basic-execution policy.
  • README.md: contains the draft of the README.

15. syndicate generate lambda – the command which generates required environment for lambda function:

  • name*: the list of lambda function names.
  • runtime*: lambda runtime. Possible values: python, java, nodejs.
  • project_path: path to the project folder. Default value: the one from the current config if it exists. Otherwise - the current working directory.

16. syndicate generate config – the command which generates syndicate.yml and syndicate_aliases.yml configuration files:

  • name*: the name of the configuration to create. Generated config will be created in folder .syndicate-config-${name}. May contains name of the environment.
  • region*: the region that is used to deploy the application.
  • bundle_bucket_name*: the name of the S3 bucket that is used for uploading artifacts. It will be created if specified.
  • access_key: AWS access key id that is used to deploy the application. If not specified, aws-syndicate will try to get credentials out of the session.
  • secret_key: AWS secret key that is used to deploy the application. If not specified, aws-syndicate will try to get credentials out of the session.
  • config_path: path to store generated configuration file.
  • prefix: prefix that is added to project names while deployment by pattern: ${prefix}resource_name${suffix}. Must be less than or equal to 5.
  • suffix: suffix that is added to project names while deployment by pattern: ${prefix}resource_name${suffix}. Must be less than or equal to 5.

17. syndicate generate meta - a group of commands-generators to create deployment resources meta with given of default parameters:

  • project_path: the path to the target project. The Syndicate will look for deployment_resources.json exactly in this directory. The parameter can be omitted to make the Syndicate get it from the config file syndicate.yml.

Available generators:

Resource type
dynamodb
dynamodb_global_index
dynamodb_autoscaling
s3_bucket
api_gateway
api_gateway_resource
api_gateway_resource_method
iam_policy
iam_role
kinesis_stream
sns_topic
step_function
step_function_activity
ec2_instance
sqs_queue
sns_application
cognito_user_pool
cognito_federated_pool
batch_compenv
batch_jobqueue
cloudwatch_alarm
cloudwatch_event_rule
documentdb_cluster
documentdb_instance

Each resource generator has it's own parameters but most of them can be omitted to use the default ones.

18. syndicate sync – the command that syncs the state of local project state file (.syndicate) and the remote one.

19. syndicate profiler – the command that displays application Lambda metrics:

  • bundle_name: the name of the bundle from which to select lambdas for collecting metrics. If not specified, resolves the latest bundle name.
  • deploy_name: name of the deploy. If not specified, resolves the latest deploy name.
  • from_date: the date from which collect lambda metrics.
  • to_date: the date until which collect lambda metrics.

20. syndicate status – the command that shows the state of a local project state file (.syndicate). NOTE: The flags are incompatible and the status is displayed according to the first entered flag:

  • events: flag to show event logs of the project.
  • resources: flag to show a summary of the project resources.

Status displays the following content: project name, state, latest modification, locks summary, latest event, project resources.

21. syndicate tags apply – the command applies the tags specified in the Syndicate config to all the deployed resources if they exist (if latest_deploy exists).

22. syndicate tags remove – the command removes the tags specified in the Syndicate config from all the deployed resources. The command succeeds even if some resources don't have the tag which is going to be removed.