Bash scripts for Lab 1 of Migrating to AWS
Copy-and-pastable bash scripts
No warranties express or implied…
Trying to reduce the number of copies and pastes…
1.2.3:
AGENTS=$(aws discovery describe-agents --query agentsInfo[?health==\`HEALTHY\`].agentId --output text)
1.2.4:
aws discovery start-data-collection-by-agent-ids --agent-ids $AGENTS
1.2.5: Status of agents
aws discovery describe-agents --query agentsInfo[?health!=\`UNKNOWN\`].[agentId,health] --output text
(Easier to read the output)
1.3.4:
aws discovery list-configurations --configuration-type PROCESS --filters name="process.name",values="nginx",condition="CONTAINS"
NGINX=$(aws discovery list-configurations --configuration-type PROCESS --filters name="process.name",values="nginx",condition="CONTAINS" --query configurations[].\"server.agentId\" --output text) | sed "s/ /,/g"
1.3.5:
aws discovery list-configurations --configuration-type PROCESS --filters name="server.agentId",values=$NGINX,condition="CONTAINS"
NGINXIDS=$(aws discovery list-configurations --configuration-type PROCESS --filters name="process.name",values="nginx",condition="CONTAINS" --query configurations[].\"server.configurationId\" --output text)
1.3.6:
MYSQL=$(aws discovery list-configurations --configuration-type PROCESS --filters name="process.name",values="mysqld",condition="CONTAINS" --query configurations[].\"server.configurationId\" --output text)
1.3.7:
But they told us to get AgentIds in 1.3.4, not config ids! That was in 1.3.5!
aws discovery create-tags --tags key=webserver,value=nginx --configuration-ids $NGINXIDS
1.3.8:
aws discovery create-tags --tags key=webserver,value=nginx --configuration-ids $MYSQL
Posted in Training Courses with : Lab Guides, Migrating to AWS, AWS Application Discovery Service