我在 aws amplify 中创建了一个前端,并使用路由 53 在 amplify 上创建了一个自定义域。然后我创建了一个子域,例如 api.domain.com 用于我的 Spring Boot 后端 rest api。子域仅使用 http。要将其与 https 一起使用,我需要指定:
server.ssl.key-store、server.ssl.key-store-password 和 server.ssl.keyAlias
在文档中,我发现了以下提示,但我无法访问 Amazon Certificate Manager (ACM) 上的证书:AWS Amplify Console 在所有页面上生成免费的 HTTPS 证书并在所有 Route53 托管域上自动激活它。SSL 证书由 Amazon Certificate Manager 生成并支持通配符域。ACM 处理为基于 AWS 的网站和应用程序创建和管理公共 SSL/TLS 证书的复杂性。使用通配符选项,主域和所有子域都由一个证书覆盖。
那么问题来了,如何获取我需要在spring boot中指定的信息呢?
ssl https amazon-web-services aws-certificate-manager aws-amplify
我尝试结合 stackoverflow 的两个答案(第一和第二)
InitialSessionState iss = InitialSessionState.CreateDefault();
// Override ExecutionPolicy
PropertyInfo execPolProp = iss.GetType().GetProperty(@"ExecutionPolicy");
if (execPolProp != null && execPolProp.CanWrite)
{
execPolProp.SetValue(iss, ExecutionPolicy.Bypass, null);
}
Runspace runspace = RunspaceFactory.CreateRunspace(iss);
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
//Here's how you add a new script with arguments
Command myCommand = new Command(scriptfile);
CommandParameter testParam = new CommandParameter("key","value");
myCommand.Parameters.Add(testParam);
pipeline.Commands.Add(myCommand);
// Execute PowerShell script
results = pipeline.Invoke();
Run Code Online (Sandbox Code Playgroud)
在我的 powershell 脚本中,我有以下参数:
Param(
[String]$key
)
Run Code Online (Sandbox Code Playgroud)
但是,当我执行此操作时,会出现以下异常:
System.Management.Automation.CmdletInvocationException: Cannot validate argument on parameter 'Session'. …Run Code Online (Sandbox Code Playgroud)