为了了解每个文件的所有者EC2 instance,我cloudtrail logs通过 查询存储在 S3 中的文件Athena。
我在 Athena 有一张表,其结构如下:
CREATE EXTERNAL TABLE cloudtrail_logs (
eventversion STRING,
useridentity STRUCT<
type:STRING,
principalid:STRING,
arn:STRING,
accountid:STRING,
invokedby:STRING,
accesskeyid:STRING,
userName:STRING,
sessioncontext:STRUCT<
attributes:STRUCT<
mfaauthenticated:STRING,
creationdate:STRING>,
sessionissuer:STRUCT<
type:STRING,
principalId:STRING,
arn:STRING,
accountId:STRING,
userName:STRING>>>,
eventtime STRING,
eventsource STRING,
eventname STRING,
awsregion STRING,
sourceipaddress STRING,
useragent STRING,
errorcode STRING,
errormessage STRING,
requestparameters STRING,
responseelements STRING,
additionaleventdata STRING,
requestid STRING,
eventid STRING,
resources ARRAY<STRUCT<
ARN:STRING,
accountId:STRING,
type:STRING>>,
eventtype STRING,
apiversion STRING,
readonly STRING,
recipientaccountid STRING, …Run Code Online (Sandbox Code Playgroud) sql json broadcastreceiver amazon-web-services amazon-athena
我们如何制作 terraform 创建的 launch_template 资源,将标签添加到创建的 EBS 卷并将其附加到使用的 AMI ?
我正在创建一些资源,例如 Alb、安全组,并且我使用 github 中的模块:
module "efs_sg" {
source = "git::https://github.com/terraform-aws-modules/terraform-aws-security-group.git"
version = "3.2.0"
name = "${var.default_tags["app"]}-efs"
description = "Security group for FE "
vpc_id = data.terraform_remote_state.network.outputs.vpc_id
computed_ingress_with_source_security_group_id = [
{
from_port = 2049
to_port = 2049
protocol = "tcp"
description = "NFS"
source_security_group_id = "${module.asg_sg.this_security_group_id}"
}
]
number_of_computed_ingress_with_source_security_group_id = 1
tags = "${var.default_tags}"
}
Run Code Online (Sandbox Code Playgroud)
当我执行 terraform apply/plan 时,出现此错误:
错误:版本约束无效
Cannot apply a version constraint to module "efs_sg" (at
terraform/dev/eu-west-1/sg.tf:107) because it has a non Registry
URL.
Run Code Online (Sandbox Code Playgroud)
我在用着Terraform v0.12.12
如何解决这个问题?
My instance is on this AMI: amzn2-ami-hvm-2.0.20191116.0-x86_64-gp2 (ami-01f14919ba412de34)
I want to install docker following this document so here is the output of my commands:
[ec2-user@ip-10-193-192-42 ~]$ sudo amazon-linux-extras install docker
Installing docker
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cleaning repos: amzn2-core amzn2extra-docker docker-ce-stable
12 metadata files removed
6 sqlite files removed
0 metadata files removed
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 2.4 kB 00:00
amzn2extra-docker | 1.3 kB 00:00
docker-ce-stable | 3.5 kB 00:00
(1/6): amzn2-core/2/x86_64/group_gz | 2.6 …Run Code Online (Sandbox Code Playgroud) 我创建了一个 AWS cloudformation,它创建了一个启动配置和一个自动缩放组。在启动配置中的用户数据中,我配置了文件系统挂载目标,并安装了 cloudwatch 代理:
代码编辑
"LaunchConfig":{
"Type":"AWS::AutoScaling::LaunchConfiguration",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"files" : {
"/etc/cwlogs.cfg": {
"content": { "Fn::Join" : ["", [
"[general]",
"state_file = /var/awslogs/state/agent-state",
"[/var/log/syslog]",
"file = /tmp/",
"log_group_name = ecs-dataloader",
"log_stream_name = ECS-loader",
"datetime_format = %b %d %H:%M:%S"
]]},
"mode": "000755",
"owner": "root",
"group": "root"
},
"/etc/ecs/ecs.config": {
"content": { "Fn::Join" : ["", [
"ECS_CLUSTER=", { "Ref" : "ClusterName" }
]]},
"mode": "000755",
"owner": "root",
"group": "root"
}
},
"commands": { …Run Code Online (Sandbox Code Playgroud) 我构建了一个 AWS Batch 计算环境。我想在作业中运行一个 python 脚本。这是我正在使用的 docker 文件:
FROM python:slim
RUN apt-get update
RUN pip install boto3 matplotlib awscli
COPY runscript.py /
ENTRYPOINT ["/bin/bash"]
Run Code Online (Sandbox Code Playgroud)
我的任务定义中的命令是:
python /runscript.py
Run Code Online (Sandbox Code Playgroud)
当我在 AWS 控制台中提交作业时,我在 CloudWatch 中收到此错误:
/usr/local/bin/python: /usr/local/bin/python: cannot execute binary file
Run Code Online (Sandbox Code Playgroud)
并且该作业的状态为 FAILED。
出了什么问题?我在本地运行容器,并且可以毫无错误地启动脚本。
如何在Spring MVC 3的控制器中将多个对象添加到ModelAndView中?那可能吗?
我有一个页面jsp,我将使用不同POJO类的许多属性,所以我需要在表单中使用两个commandName.可以在控制器中使用多个@ModelAttribute,那么如果多个commandName不工作又有什么意义呢?
例如,我想插入一个信息,名称和函数,name是类Agent中的一个属性,function是类Activity中的一个属性?我该怎么办?
@RequestMapping(value="/fiche_service",method=RequestMethod.GET)
public ModelAndView Fiche_service(@ModelAttribute Activite activitey,@ModelAttribute Etablissement etabl,ModelMap model) {
Agent ag = new Agent();
return new ModelAndView("FicheService","agent",ag);
}
Run Code Online (Sandbox Code Playgroud)
<form:form
action="${pageContext.request.contextPath}/ajouter_activite"
method="post" commandName="activity" commandName="etabl">
<table id="tabmenu">
<tr>
<td>Fonction :</td>
<td><form:input type="text" class="round default-width-input" path="fonction"/></td>
</tr>
<tr>
<td>Nom d'établissement :</td>
<td><form:input type="text" class="round default-width-input" path="noml"/></td>
</tr>
<tr>
<td>Ville :</td>
<td><form:input type="text" class="round default-width-input" path="villel"/></td>
</tr>
<tr>
<td>Délégation :</td>
<td><form:input type="text" class="round default-width-input" path="cd_reg"</td>
</tr>
<tr>
<td>Date début :</td>
<td><form:input type="text" name="date" class="tcal" value="" path="dateAffect"/></td>
</tr>
<tr>
<td>Date …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有主表单和子表单.我想ShowIntaskBar为子窗体设置为false,但问题是当我通过菜单打开它时,它会显示并消失,然后当我再次打开它时,它会变得可见.所以我不想打开它两次才能看到它.如何解决这个问题?
子表单代码:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ShowInTaskbar = False
End Sub
Run Code Online (Sandbox Code Playgroud)
父(主)表单代码:
Private Sub ?????????????ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ?????????????ToolStripMenuItem.Click
Form1.ShowDialog()
End Sub
Run Code Online (Sandbox Code Playgroud) 我可以使用以下代码获取表单的值:
<input type="text" formControlName="subscriptionFormName" id="subscriptionFormName" #UserName class="form-control" mdbInputDirective>
<button class="btn btn-indigo btn-lg btn-block waves-light" type="button" (click)="OnSubmit(UserName.value)" mdbWavesEffect>Send
<i class="fa fa-paper-plane-o ml-1"></i>
</button>
Run Code Online (Sandbox Code Playgroud)
但是我需要获取表单的所有值,所以我可以这样做:
<button class="btn btn-indigo btn-lg btn-block waves-light" type="button" (click)="OnSubmit(allFormValues)" mdbWavesEffect>Send
<i class="fa fa-paper-plane-o ml-1"></i>
</button>
user: User;
ObSubmit(values) {
user.UserName = values.UserName;
user.Password = values.Password;
......
}
Run Code Online (Sandbox Code Playgroud)
下面是完整的代码:
<div class="row">
<div class="col-md-12 text-left">
<form [formGroup]="subscriptionForm">
<h3 style="color: gray; text-align: center;">Registration</h3>
<div class="row">
<div class="col-md-6">
<div class="md-form">
<i class="fa fa-user prefix grey-text"></i>
<input type="text" formControlName="UserName" id="UserName" class="form-control" mdbInputDirective>
<label …Run Code Online (Sandbox Code Playgroud) 我有两页,第一页有一个带有隐藏字段的表单,可以将参数发送到第二页。如果用户在带有隐藏字段的表单为空时转到第二页,我想返回一条错误消息,因此为此我尝试了该操作,但它不起作用:
@RequestMapping(value="/generate",method=RequestMethod.POST)
public String FicheService(@ModelAttribute Movement movement,@RequestParam("nom") String nom, @RequestParam("number") Integer number,ModelMap model){
if(nom=="" && number == null) { model.addAttribute("errorMessage",true);
return "firstPage";
}
else { return "secondPage";}
}
Run Code Online (Sandbox Code Playgroud)
如何检查@RequestParam 是否为空?
我在 Amazon linux 2 实例上安装了 prometheus,这是我在用户数据中使用的配置:
cat << EOF > /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Restart=on-failure
#Change this line if you download the
#Prometheus on different path user
ExecStart=/home/prometheus/prometheus/prometheus --config.file=/home/prometheus/prometheus/prometheus.yml --storage.tsdb.path=/app/prometheus/data
[Install]
WantedBy=multi-user.target
EOF
cat << EOF > /home/prometheus/prometheus/prometheus.yml
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout …Run Code Online (Sandbox Code Playgroud) 我想在删除应用程序中的任何元素之前显示确认消息,我有:
<form:form name="formule" method="get" commandName="user"
onsubmit="confirmDelete('${pageContext.request.contextPath}/delete_element')">
<form:input type="hidden" path="id" name="id" />
<input type="submit" value="DELETE" />
</form:form>
Run Code Online (Sandbox Code Playgroud)
功能 :
function confirmDelete(delUrl) {
if (confirm("Are you sure ?")) {
document.location = delUrl;
}
}
Run Code Online (Sandbox Code Playgroud)
这是控制器:
@RequestMapping(value = "/delete_element", method = RequestMethod.GET)
public String getInfo(@ModelAttribute User user,@RequestParam("id") int id,ModelMap model) {
userservice.DeleteUser(id);
return "ViewName";
}
Run Code Online (Sandbox Code Playgroud)
这就是我得到的:函数的链接没有把我带到控制器所以没有发生任何事情,我们可以说javascript发送的请求没有到达服务器 ..是否真的很难在Spring MVC中集成任何东西像那样 ?!
spring-mvc ×4
docker ×2
json ×2
spring ×2
terraform ×2
.net ×1
angular ×1
aws-batch ×1
controller ×1
html ×1
java ×1
javascript ×1
linux ×1
model ×1
prometheus ×1
python ×1
sql ×1
user-data ×1
validation ×1
vb.net ×1