1. copy the instance id from aws console to file

2. remove the , from file

sed -i 's/,//g' file

3. get ip address list to file2

$ cat getip.sh
#!/bin/bash
for id in `cat file`
do
#echo $id >> file2
aws ec2 describe-instances --instance-ids $id | grep PrivateIpAddress | head -1 | awk -F ":" '{print $2}' | sed 's/[",]//g' >> file2
done

4. copy file2 to host.txt,

5. create inssm.bat

@echo off
net use x: \\10.xx.xx.241\Share /user:joinad password
x: REM “Replace your codes starts from here”
Ec2Install.exe /sp- /silent /norestart
REM “replace your codes end of here.”
if %ERRORLEVEL% NEQ 0 goto failed
echo "SSM agent updated DONE!" cd ..
echo %computername% %date% %time% >> ComputerList.txt
echo "Updating of SSM agent succeeded. "
goto end :faile
echo $%computername% %date% %time% >> ComputerList.txt
echo "Updating of SSM agent failed. " :end
c:
net use x: /delete

6. run inssm.bat script to remote host via psexec

for /F "tokens=*" %%A in (host.txt) do C:\PSTools\PsExec.exe \\%%A -u admin -p "pwd" -c -w c:/ "C:\inssm.bat"

  

  

  

Update SSM agent to each EC2 via Bat and bash script的更多相关文章

  1. AWS EC2 实例 SSH 无法登录故障

    文章链接 故障表现 在使用 jumperver 登录 AWS ec2 实例的时候发现 ssh 配合秘钥登录的时候无法登录, 具体报错如下: ssh -i /path/xx.pem user@10.0. ...

  2. zabbix 布署实践【2 agent安装】

    客户端的安装相对较为简单,主要是更新它的repo源   以CentOS7为例 rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabb ...

  3. 用AntDeploy如何更新Agent

    AntDeploy AntDeploy是一款开源的一键发布部署工具,目的是代替重复性的发布动作,提高部署效率 1.一键部署iis 2.一键部署windows服务 3.一键部署到Docker 4.支持增 ...

  4. AWS EC2 PV Drivers 驱动升级

    问题 从2019-10-23起,我的AWS实例不断的重启(大概6个小时左右),或者连接不上(远程连接不上并PING不通IP),但控制台显示running. 分析与解决方法 通过查看dump文件,发现是 ...

  5. Linux Wine with *.bat *.exe ( Photoshop and etc.. )

    Firtly all you need is to install wine on your computer. Mine is ubuntu 12.04 which is running KDE o ...

  6. on duplicate key update 的用法说明(解决批量操作数据,有就更新,没有就新增)mybatis批量操作数据更新和添加

    项目用的ORM框架是用springdatajpa来做的,有些批量数据操作的话,用这个效率太低,所以用mybatis自己写sql优化一下. 一般情况,我们肯定是先查询,有就修改,没有就添加,这样的话,单 ...

  7. 在Linux/redhat中安装amazon-ssm-agent及注意事项

    操作系统:Red Hat Enterprise Linux Server release 7.9 (Maipo) 首先说明一下SSM是什么.引用官网的说明: AWS Systems Manager A ...

  8. Pyhton开源框架(加强版)

    info:Djangourl:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 ...

  9. Python开源框架

    info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...

随机推荐

  1. DeepLearning - Forard & Backward Propogation

    In the previous post I go through basic 1-layer Neural Network with sigmoid activation function, inc ...

  2. NMAP-端口扫描

    1.时序选项 -T0 -> -T5 速度变快,但是准确性下降,nmap默认是T3 2.指定端口 3.扫描指定TCP和UDP端口 4.快速扫描常见100个端口 5.扫描常见的n的端口 6.TCP ...

  3. POJ 1741 Tree(树的分治)

    Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Def ...

  4. HDU 1007 Quoit Design(计算几何の最近点对)

    Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings ...

  5. Graph Theory

    Description Little Q loves playing with different kinds of graphs very much. One day he thought abou ...

  6. JS判断备忘

    快速引入jquery并显示重点内容 (function(d,j,s,t){t=d.body.appendChild(d.createElement("script"));t.onl ...

  7. python异步初步窥探

    1.异步之难:因为其执行吮吸不可预料,当下正要发生什么事件不可预料.        程序下一步行为往往依赖上一步值执行结果,如何知晓上次异步调用已完成并获取结果,        回调成了必然选择,那又 ...

  8. 利用闭包判断Dom元素和滚动条的方向

    本文收集整理自网上. 一,判断滚动条的方向,利用闭包首先保存滚动条的位置,然后当滚动时候不断更新滚动初始值,然后通过差指判断方向 function scroll(fn) { //利用闭包判断滚动条滚动 ...

  9. 单行文字溢出和多行文字溢出省略号显示的CSS样式

    单行文字溢出,CSS样式 <h6 style="width:70px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis ...

  10. div、span绑定内容改变事件

    内容改变事件onchange只适用于form表单标签(input.select.textarea) 当需要对div.span标签进行内容改变监听则无法适用,查阅了一些资料发现jquery有针对的方法, ...