Giter Club home page Giter Club logo

Comments (7)

welcome-to-palo-alto-networks avatar welcome-to-palo-alto-networks commented on July 18, 2024

🎉 Thanks for opening your first issue here! Welcome to the community!

from pcs-sizing-scripts.

tkishel avatar tkishel commented on July 18, 2024

Thank you for this report. I see that

https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#output

Prisma Cloud only counts running instances when calculating credit consumption. In your possible solution, you did not include this filter:

--filters "Name=instance-state-name,Values=running"

https://github.com/PaloAltoNetworks/pcs-sizing-scripts/blob/main/aws/resource-count-aws.sh#L106

Could you explain why this script should count stopped instances?

I see that AmiLaunchIndex is documented as a property of a described instance:

https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#output

How does the existence of the AmiLaunchIndex property change the count of this script?

If you could provide example output (with any sensitive data redacted) from a call to describe-instances with the AmiLaunchIndex and State properties, similar to:

https://github.com/PaloAltoNetworks/pcs-sizing-scripts/blob/main/spec/resource-count-aws_spec.sh#L136

We could test this.

Thanks!

from pcs-sizing-scripts.

hiroinfinity avatar hiroinfinity commented on July 18, 2024

Thank you for your reply.

--filters "Name=instance-state-name,Values=running"
My possible solution is include this filter, because this filter include the function aws_ec2_describe_instances.
https://github.com/PaloAltoNetworks/pcs-sizing-scripts/blob/main/aws/resource-count-aws.sh#L107

I will provide an example output below.
In this case, the desired count is 3, but the current count is 2.

{
    "Reservations": [
        {
            "Groups": [],
            "Instances": [
                {
                    "AmiLaunchIndex": 0,
                    "InstanceId": "i-01234567890",
                }
            ],
        },
        {
            "Groups": [],
            "Instances": [
                {
                    "AmiLaunchIndex": 0,
                    "InstanceId": "i-abcdefghijk",
                },
                {
                    "AmiLaunchIndex": 1,
                    "InstanceId": "i-567890abcde",
                }
            ]
        }
    ]
}

Would you please confirm?
Thanks!

from pcs-sizing-scripts.

tkishel avatar tkishel commented on July 18, 2024

Sorry, I missed that those filters are defined in the function.

This appears to be an issue with the output from aws ec2 describe-instances having Reservations as the outer object rather than Instances as the outer object, rather than the existence of AmiLaunchIndex.

I don't know if this is a recent change in the output, given ...

550a5e4#diff-df255a31916be93e0b704bdc951dbbcd607fe60c7a9f25ac3513edb61dcf96e6R15

... or if it is somehow context-sensitive, but I'll submit a PR that expects:

{
    "Reservations": [{
            "Groups": [],
            "Instances": [{
                    "InstanceId": "0abcdef1234567890"
                },
                {
                    "InstanceId": "0abcdef1234567891"
                }
            ]
        },
        {
            "Groups": [],
            "Instances": [{
                "InstanceId": "1abcdef1234567890"
            }]
        }
    ]
}

Rather than:

{
	"Instances": [{
		"InstanceId": "0abcdef1234567890"
	}]
}

... from the aws ec2 describe-instances command.

from pcs-sizing-scripts.

tkishel avatar tkishel commented on July 18, 2024

@HeroInfinity could you confirm this fix?

from pcs-sizing-scripts.

hiroinfinity avatar hiroinfinity commented on July 18, 2024

@tkishel Great! I've solved it.

from pcs-sizing-scripts.

tkishel avatar tkishel commented on July 18, 2024

Thank your for reporting and confirming!

from pcs-sizing-scripts.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.