def create_data_dir(self, root_dir: str) -> None: """Create data to be pushed to bucket used by cloudformation for resources.""" # Create directory specific to that lambda package_dir = os.path.join(root_dir, name_to_id(self.name), "package") # Install the requirements if self.requirement_file is not None: p = Run( python_script("pip") + ["install", f"--target={package_dir}", "-r", self.requirement_file], output=None, ) assert p.status == 0 # Copy user code self.populate_package_dir(package_dir=package_dir) # Create an archive create_archive( f"{self.name}_lambda.zip", from_dir=package_dir, dest=root_dir, no_root_dir=True, ) # Remove temporary directory rm(package_dir, recursive=True)
def s3_cp(from_path: str, s3_url: str) -> bool: cmd = ["s3", "cp", f"--sse={self.sse}"] if self.aws_profile: cmd.append(f"--profile={self.aws_profile}") cmd += [from_path, s3_url] s3 = Run(python_script("aws") + cmd, output=None) return s3.status == 0
def s3_cp(from_path, s3_url): cmd = ["s3", "cp", "--sse=%s" % self.sse] if self.aws_profile: cmd.append("--profile=%s" % self.aws_profile) cmd += [from_path, s3_url] s3 = Run(python_script("aws") + cmd, output=None) return s3.status == 0