How to count AWS Servers that deploy oracle server

0

Hi, I have an AWS cloud account with many EC2 and RDS servers running. I need to run a monthly script to count the number of EC2 and RDS instances that are running an oracle EE or SE engine software.

Can this be done using CLI query or another AWS service and how can it be scripted?

2回答
1
承認された回答

Hello.

I think it is possible to count by creating a script using AWS CLI or AWS SDK.
For example, you can count the number of RDS instances of "oracle-ee" using the shell script below.
If you change "oracle-ee" to "oracle-se2", you can count "Oracle Standard Edition Two" RDS instances.

#!/bin/bash

engine="oracle-ee"

instance_count=$(aws rds describe-db-instances --query 'DBInstances[?Engine==`'"$engine"'`]' --output json | jq '. | length')

echo "$instance_count"

In the case of EC2, I think it can be made into a shell script if a name tag is set that allows you to identify the software running within the instance.

profile picture
エキスパート
回答済み 10ヶ月前
profile picture
エキスパート
レビュー済み 9ヶ月前
profile pictureAWS
エキスパート
レビュー済み 10ヶ月前
  • Hi, re EC2 instances, you could run via AWS SSM a script in each of your instances to detect if Oracle is running by checking some of the standard processes that must be present for an Oracle server to be active.

  • +1 to SSM (you need the SSM agent to be installed and running, might not be the case if these VMs were lifted and shifted as is from on-prem). When running on EC2, there will be no data collected by AWS that will show what applications are running inside the EC2s - you need to be logged into the machine to understand what's running there.

  • Where do you create and schedule the cronjob and shell script? Do you run cloudshell for that since there are many RDS and EC2 instances and RDS does not allow operating system access.

    Also, your query for the RDS instance was based on "describe-db_instance" result. Would not the same work for EC2 instead of querying a name tag?

    Thanks,

  • I think CloudShell could not use crontab. So I think there is a way to prepare EC2 or use something like AWS Batch to periodically execute a shell. Another option is to create a Lambda and rewrite the shell script I shared in Python.

    Also, your query for the RDS instance was based on "describe-db_instance" result. Would not the same work for EC2 instead of querying a name tag?

    If you do not use the Name tag, EC2 cannot check processes etc. without logging into the OS. So, as @Didier_Durand says, if EC2 is managed by SSM, I think you can check it using something like RunCommand.

  • I think the EC2 machines might have tags but not to indicate the software installed. Can you add multiple tags to one machine for this?

    I have not used Python/Lamda before so I am not sure how easy it would be write this but I did wrote Shell scripts before. Can you run the shell script and cronjob on any EC2 machine in the cloud account?

1

I recommend using AWS License manager. It can Identify Oracle instances licenses and provide a report on usage. See here: https://aws.amazon.com/blogs/mt/tracking-your-oracle-licenses-using-aws-license-manager/

AWS
回答済み 10ヶ月前
  • That is very good article. I need to test the license manager to see if it would give me the number of deployments of oracle in the environment.

    We mostly use RDS with LI option so we dont own any licenses. Would it still give us the answers in case someone added several RDS instances with Oracle and LI option?

    It seems License manager is more designed for licenses you buy/own and then you input this information into the tool and then whenever you create an EC2 or RDS intance you link it to the license configuration and AWS will subtract the number of licenses need automatically.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ