MCPcopy Index your code
hub / github.com/zappa/Zappa / deploy

Method deploy

zappa/cli.py:794–1036  ·  view source on GitHub ↗

Package your project, upload it to S3, register the Lambda function and create the API Gateway routes.

(self, source_zip=None, docker_image_uri=None)

Source from the content-addressed store, hash-verified

792 print(out.read())
793
794 def deploy(self, source_zip=None, docker_image_uri=None):
795 """
796 Package your project, upload it to S3, register the Lambda function
797 and create the API Gateway routes.
798 """
799
800 if not source_zip or docker_image_uri:
801 # Make sure the necessary IAM execution roles are available
802 if self.manage_roles:
803 try:
804 self.zappa.create_iam_roles()
805 except botocore.client.ClientError as ce:
806 raise ClickException(
807 click.style("Failed", fg="red")
808 + " to "
809 + click.style("manage IAM roles", bold=True)
810 + "!\n"
811 + "You may "
812 + click.style("lack the necessary AWS permissions", bold=True)
813 + " to automatically manage a Zappa execution role.\n"
814 + click.style("Exception reported by AWS:", bold=True)
815 + format(ce)
816 + "\n"
817 + "To fix this, see here: "
818 + click.style(
819 "https://github.com/Zappa/Zappa#custom-aws-iam-roles-and-policies-for-deployment",
820 bold=True,
821 )
822 + "\n"
823 )
824
825 # Create or resolve EFS configurations
826 if self.efs_config:
827 for efs in self.efs_config:
828 if "Arn" not in efs:
829 # Auto-create EFS resources for entries without an ARN
830 efs["Arn"] = self.zappa.create_efs(
831 lambda_name=self.lambda_name,
832 vpc_config=self.vpc_config,
833 mount_path=efs["LocalMountPath"],
834 throughput_mode=efs.get("ThroughputMode", "bursting"),
835 performance_mode=efs.get("PerformanceMode", "generalPurpose"),
836 )
837
838 # Make sure this isn't already deployed.
839 deployed_versions = self.zappa.get_lambda_function_versions(self.lambda_name)
840 if len(deployed_versions) > 0:
841 raise ClickException(
842 "This application is "
843 + click.style("already deployed", fg="red")
844 + " - did you mean to call "
845 + click.style("update", bold=True)
846 + "?"
847 )
848
849 if not source_zip and not docker_image_uri:
850 # Make sure we're in a venv.
851 self.check_venv()

Callers 2

dispatch_commandMethod · 0.95
test_cli_awsMethod · 0.95

Calls 15

check_venvMethod · 0.95
create_packageMethod · 0.95
callbackMethod · 0.95
scheduleMethod · 0.95
deploy_api_gatewayMethod · 0.95
touch_endpointMethod · 0.95
remove_local_zipMethod · 0.95
remove_uploaded_zipMethod · 0.95
parse_s3_urlFunction · 0.85
create_iam_rolesMethod · 0.80
create_efsMethod · 0.80

Tested by 1

test_cli_awsMethod · 0.76