How to access the Always free Apex Instance through Public IP - oracle-apex

OCI Always Free Apex Application Created.
Public IP is available to the instance.
How to access Application using Public IP.
How to add Public IP in Apex Application?

Related

Redirect public IP address to the domain name in Amazon AWS EC2

I have deployed a web using Jetty Web Server on AWS EC2. I've registered the custom domain (mydomain.com) on Route 53 as well. It works perfect.
But I can still access my website through Public IP Address (1X.2XX.3XX.4XX)
How do you make it so that when a user accesses the Public IP Address it automatically redirects to the registered domain?
Or at least I can block direct access to the web via Public IP Address.

Attach public ip address to an AWS EC2 instance having multiple interfaces

I have an EC2 instance having 3 interfaces attached to it.
I want to attach a public IP address for management but it looks like AWS does not allow auto-assign public IP address and asks to attach an elastic IP address.
Is there any way to add an auto-assign public IP address to an EC2 instance having multiple interfaces for instance management (not elastic ip)?
I just tried it myself and, after adding multiple Elastic Network Interfaces, it displayed this message:
We can no longer assign a public IP address to your instance
The auto-assign public IP address feature for this instance is disabled because you specified multiple network interfaces. Public IPs can only be assigned to instances with one network interface. To re-enable the auto-assign public IP address feature, please specify only the eth0 network interface.

Public IP being assigned to EC2 Instance when an AD has been created

I have created an EC2 Instance to host a web application on IIS.
Were using a directory service and hosting an domain account on there.
The app pools on IIS will use the domain account to authenticate to the RDS instance.
When I joined the domain to the instance it has given it a public IP.
Is there a reason why it automatically gives it a public IP? Ideally we want to keep this private.

How to Detect if a Powered Down EC2 Instance will have an AWS Public Pool IP When Powered Back on

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?
PS X:\projects\GACM\cloudsecurity> (get-ec2instance -instanceid i-99999999999999999 -region us-east-1).instances.networkinterfaces|select *
Association :
Attachment : Amazon.EC2.Model.InstanceNetworkInterfaceAttachment
Description : Primary network interface
Groups : {launch-wizard-4}
Ipv6Addresses : {}
...
The 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.

How to Allocate running EC2 Instance's non-Elastic Public IP to Elastic IP

I'm using an AWS EC2 window's instance which has an Public IP. The Public IP is not elastic. The instance runs some app.
Now I've to deploy the app in ubuntu but the Public IP must be preserved. How can I do this?
When I allocate New Elastic IP, I get a random IP address, but I need the existing one which is being used by window's instance.
Is there any way to allocate existing Public IP to elastic IP?
No you will not be able to do that. You cannot convert an AWS Public IP to an Elastic IP. Once you close the server the public IP address gets released. You will have to make the necessary changes to your app to use the new IP address for the ubuntu and this time make sure you use elastic IP for the instance.