完成以下步骤,使用 Amazon S3 控制台上传 Example Corp. 网站资产。
- 将 Example Corp. 网站资产从我们的存储库下载到您的本地计算机。
- 解压您在本地计算机上下载的文件。
- 导航至 Web_generic\Web 文件夹,然后打开 index.html。 对此文件进行以下更改。此文件的默认格式包含在此步骤结束时。
必填:
- stateMachineArn = 将默认值替换为您在模块 3 中创建的状态机的 ARN。
- subnet1id = 将 <SUBNET-ID> 替换为您用于此项目的 VPC 中第一个私有子网的 ID。
- subnet2id = 将 <SUBNET-ID> 替换为您用于此项目的 VPC 中第二个私有子网的 ID。
- securitygroup = 将 <SECURITY-GROUP-ID> 替换为要与 AppStream 2.0 实例关联的安全组的 ID。
- url: = 将默认值替换为您的 API 执行 URL。
要获取此 URL,请打开 API Gateway 控制台。在导航窗格中,在 API 下,选择 examplecorp_eao,然后选择阶段。在阶段窗格中,展开测试,然后选择 POST。窗格顶部会显示调用 URL。URL 采用以下格式:
https://<UNIQUE-ID>.execute-api.amazonaws.com/test/execute
可选:
- ib_arn = 您要用于创建映像生成器的基本 AppStream 2.0 映像的 ARN。执行以下任一操作:
- 选项 1:要使用提供的默认映像(公共 Windows Server 2012 R2 基本映像),请将以下 ARN 中的 <REGION-CODE> 替换为您所在区域的值。
- arn:aws:appstream:<REGION-CODE>::image/AppStream-WinServer2012R2-09-18-2019
- 选项 2:要使用最近发布的 Windows Server 2016 或 Windows Server 2019 基本映像,请指定以下 ARN 之一:
- arn:aws:appstream:<REGION-CODE>::image/AppStream-WinServer2016-09-18-2019
- arn:aws:appstream:<REGION-CODE>::image/AppStream-WinServer2019-09-18-2019
- 选项 3:指定您拥有的私有映像的 ARN。要获取映像的 ARN,请使用 AppStream 2.0 DescribeImages API 操作或 describe-images AWS CLI 命令。映像 ARN 采用以下格式:
- 私有基本映像:arn:aws:appstream:<REGION-CODE>:<AWS-ACCOUNT-ID>:image/<IMAGE-NAME>
- 公共基本映像:arn:aws:appstream:<REGION-CODE>::image/<IMAGE-NAME>
- instance_type = 用于研讨会的 AppStream 2.0 实例类型。默认值为 stream.standard.medium。
您的账户必须为您选择的实例大小设置限制。默认情况下,stream.standard.medium 实例类型的账户限制为五个实例。
4.通过以下网址打开 Amazon S3 控制台:https://console.aws.amazon.com/s3/。
5.存储桶名称列表中,选择您在上一步中创建的存储桶的名称。
6.在 Amazon S3 控制台窗口的概览选项卡,选择上传。
7.在控制台窗口以外的窗口中,导航至本地计算机上解压的网站资产目录。选择该目录下的所有文件和文件夹。验证 Web 目录本身未选中。
8.将您的选择拖放到上传对话框。
9.选择上传。
10.等待上传完成,并验证概览选项卡上的列表中是否显示了正确的文件和文件夹。
<!DOCTYPE HTML>
<!--
Miniport by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Example Corp Enterprise Application Onboarding</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="icon" type="image/png" href="images/exampleco_ico.png">
<!-- API Call -->
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#submit").click(function(e) {
e.preventDefault();
var name = $("#fName").val(),
lastname = $("#lName").val(),
email = $("#email").val(),
deptcode = $("#deptcode").val(),
name_id = name.concat(deptcode),
ib_name = name.concat(deptcode,"_IB"),
ib_arn = "arn:aws:appstream:<REGION-CODE>::image/AppStream-WinServer2012R2-05-28-2019",
stateMachineArn = "arn:aws:states:<REGION-CODE>:<AWS-ACCOUNT-ID>:stateMachine:EAOv1",
subnet1id = "<SUBNET-ID>"
subnet2id = "<SUBNET-ID>"
securitygroup = "<SECURITY-GROUP-ID>"
fleet_name = deptcode.concat("_Fleet")
stack_name = deptcode.concat("_Stack")
$.ajax({
type: "POST",
url: 'https://<UNIQUE-ID>.execute-api.<REGION-CODE>.amazonaws.com/Prod/execution',
crossDomain: true,
contentType: 'application/json',
data: JSON.stringify({
'name': name_id,
'stateMachineArn': stateMachineArn,
'input': "{\"user_name\": \"" + name + "\", \"email\": \"" + email + "\", \"instance_type\": \"stream.standard.medium\", \"subnet1id\": \"" + subnet1id + "\", \"subnet2id\": \"" + subnet2id + "\", \"securitygroups\": \"" + securitygroup + "\", \"deptcode\": \"" + deptcode + "\", \"ib_arn\": \"" + ib_arn + "\", \"ib_name\": \"" + ib_name + "\", \"fleet_name\": \"" + fleet_name + "\", \"stack_name\": \"" + stack_name + "\"}"
}),
success: function(res, data, status){
console.log(res.message)
window.location.replace('https://docs.aws.amazon.com/appstream2/latest/developerguide/tutorial-image-builder.html');
},
error: function(res, data, status){
console.log(res.message)
}
});
})
});
</script>
</head>
<body class="is-preload">
<!-- Nav -->
<nav id="nav">
</nav>
<!-- Home -->
<article id="top" class="wrapper style1">
<div class="container">
<div class="row">
<div class="col-4 col-5-large col-12-medium">
<span class="image fit"><img src="images/exampleco.png" alt="Example Corp" /></span>
</div>
<div class="col-8 col-7-large col-12-medium">
<header>
<h2><strong>Enterprise Application Onboarding Portal</strong></h2>
</header>
<p>
<div class="col-12">
<form id="EAOForm">
<div class="row">
<h4>Fill out the following information to get started onboarding your applications to AppStream2.0. This will allow secure access to your application from any computer, anywhere
that has internet access via a web browser. No client device installations required.</h4>
<div class="col-6 col-12-small">
<input type="text" id="fName" placeholder="First Name" pattern="*" required>
</div>
<div class="col-6 col-12-small">
<input type="text" id="lName" placeholder="Last Name" pattern="*" required>
</div>
<div class="col-12">
<input type="email" id="email" placeholder="Email" pattern=".*" required>
</div>
<div class="col-6 col-12-small">
<input type="text" id="deptcode" placeholder="Department Code" pattern=".*" required>
</div>
<div class="col-12">
<ul class="actions">
<li><button id="submit" onclick="alert('You have submitted your request, please check your e-mail in 30 minutes.')">Start</button></li>
<li><button id="reset" class="alt">Clear</button></li>
</ul>
</div>
<p id="result"></p>
<h4>Within 30 minutes of clicking Start, you will be sent an e-mail with instructions on the next steps.</h4>
</div>
</form>
</div>
</p>
</div>
</div>
</div>
</article>
</body>
</html>