CloudSecurity | Cloud security projects with Spring Cloud Config Server | Microservice library
kandi X-RAY | CloudSecurity Summary
kandi X-RAY | CloudSecurity Summary
Cloud security projects with Spring Cloud Config Server and Vault
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Finish postConstruct .
- Writes the specified secret to the vault .
- Add OpenAPI .
- Information about application .
- Deletes the secret at the configured path .
- Update Hikari DB properties
- Entry point for the ConfigClient application .
- Get all credentials .
CloudSecurity Key Features
CloudSecurity Examples and Code Snippets
Community Discussions
Trending Discussions on CloudSecurity
QUESTION
I am writing a Powershell script to locate all EC2 Instances with a Public IP. I know how to get Elastic IP and Public Pool IP Associations in the NetworkInterfaces. However, when EC2 Instances that have been configured for a Public Pool IP (NOT an EIP) are powered down, the Public IP is released back into the pool and the Association is deleted from the NetworkInterface. I can't seem to find any flag or other configuration anywhere that would indicate that when the EC2 is powered back on it would request a new Public Pool IP. I need to identify powered down EC2 Instances that may come up with Public IP's for a security report without having to power them up to find out.
For example, this EC2 has a Public Pool IP when it is powered up. However, when it is powered down, as it is now, the Association object has been removed along with the IP. Is ther not some configuration somewhere that will indicate it will procure a new Public Pool IP upon powering up?
...ANSWER
Answered 2020-Jun-04 at 16:22The only way you can determine if an instance will have a pooled public ip address is by analyzing the CloudTrail logs.
On instance creation, a log entry is made. requestParameters in the log has a JSON Object called networkInterfaceSet which has an array of items, these items have the key associatePublicIpAddress which is either true or false.
At this time you can't determine if an EC2 will have a public IP Address when it is in the stopped state. Unless you have linked an Elastic IP to the instance.
When an EC2 instance is launched it can either inherit the allocation of a public IP address from the subnet settings or you can set it as public IP enabled, or disabled. This is recorded in the cloud trail log.
Currently there is no way to change that behavior or view the behavior other than the cloud trail log.
For example, if the subnet has public ip enabled, and when launching an EC2 instance and you explicitly disable it then the only way your instance can get a public IP address is to either recreate the instance from a snapshot, or assign an Elastic IP. If the instance is initially launched with a public IP, there is no way to remove the public IP.
Neither describe-network-interfaces or describe-instances provides any metadata pertaining to enabled or disabled public IP address excluding elastic IPs.
As you mentioned the only way to determine if an instance will have a public IP is to start the instance and view the running instance metadata.
The Amazon EC2 instance IP addressing documentation states:
You can control whether your instance receives a public IP address as follows:
Modifying the public IP addressing attribute of your subnet. For more information, see Modifying the public IPv4 addressing attribute for your subnet in the Amazon VPC User Guide.
Enabling or disabling the public IP addressing feature during launch, which overrides the subnet's public IP addressing attribute. For more information, see Assigning a public IPv4 address during instance launch.
A public IP address is assigned to your instance from Amazon's pool of public IPv4 addresses, and is not associated with your AWS account. When a public IP address is disassociated from your instance, it is released back into the public IPv4 address pool, and you cannot reuse it.
You cannot manually associate or disassociate a public IP address from your instance. Instead, in certain cases, we release the public IP address from your instance, or assign it a new one:
- We release your instance's public IP address when it is stopped, hibernated, or terminated. Your stopped or hibernated instance receives a new public IP address when it is started.
We release your instance's public IP address when you associate an Elastic IP address with it. When you disassociate the Elastic IP address from your instance, it receives a new public IP address.
If the public IP address of your instance in a VPC has been released, it will not receive a new one if there is more than one network interface attached to your instance.
If your instance's public IP address is released while it has a secondary private IP address that is associated with an Elastic IP address, the instance does not receive a new public IP address.
If you require a persistent public IP address that can be associated to and from instances as you require, use an Elastic IP address instead.
Experiment
I created an EC2 instance in a subnet where the assignment of a public IP address was enabled. I set the EC2 instance to assign a public IP address on launch. Changing the subnet auto-assign value had no affect. I repeated the process this time allowing the EC2 instance to be created with the setting of the subnet. I disabled auto assign within the subnet. The instance was created without a public IP as expected. I then enabled auto assign on the subnet, and stopped and started the instance. No public IP address was assigned.
Thus based on the documentation above and my experiment. Allocation of a pooled public IP address is decided at EC2 instance launch. This cannot be changed. I ran [describe-network-interfaces, describe-instances] CLI commands to get details on the ENI, and no metadata provides a flag to indicate that a Public IP address will be assigned when the instance is started. The only place I could find any information was in the CloudTrail log.
If you are using AWS best practice, EC2 instances should be started using CloudFormation. Here you will know if the EC2 instance will have a public IP.
Alternatively you do not allow the assigning of pooled public IP addresses by using service control policies or policies assigned to users. Then use alternative means to expose the machines either using elastic IP addresses or Load Balancers.
I think it is important to revisit your use case, to understand what you are trying to achieve.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CloudSecurity
You can use CloudSecurity like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the CloudSecurity component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page