<p>I got the answer from AWS support:</p>
<p>The reason why you are seeing that notification is because it is in accordance to your launch configuration (staging-1-deploy) settings. During the creation of a launch configuration, the assignment of public IP addresses to EC2 instances defaults to <code>Only assign a public IP address to instances launched in the default VPC and subnet. (default)</code> [1]. To support automatic assignment of public IP addresses to your EC2 instances as they are launched, you will have to change the launch configuration settings. Since a launch configuration cannot be edited [2], you can create a new one by copying your current launch configuration. Follow the steps below to achieve this:</p>
<ol>
<li>Go to your AWS console, select <code>Launch Configurations</code>, select <code>staging-1-codedeploy</code></li>
<li>At the bottom of the details, click the grey <code>Copy Configuration</code> button on the right.</li>
<li>Click<code>Edit Details</code> link, then click <code>Advanced Details</code> on the resulting page.</li>
<li>Go to <code>IP Address Type</code> and select the second option, <code>Assign a public IP address to every instance.</code></li>
<li>[optional] Change the name of the launch configuration if need be and</li>
<li>Save launch configuration</li>
</ol>
<p>You can now proceed to use your new launch configuration for your auto-scaling group and all your EC2 instances will be assigned public IP addresses as desired.
I have attached a few screenshots to show some of the steps described above.</p>

CC BY-SA 4.0
2019-01-15T01:13:36.443Z
Where's the screenshots you mentioned?
Gene
CC BY-SA 4.0
2018-08-01T08:06:30.257Z
2024-02-06T11:45:15.920Z
2024-02-06T11:45:15.920Z
abbood
<p>I'm trying to migrate our deployment process over to aws code deploy (by following instructions here:<a href="https://pionect.nl/autoscaling-aws-laravel-codedeploy-opsworks-chef-automation/" rel="nofollow noreferrer">https://pionect.nl/autoscaling-aws-laravel-codedeploy-opsworks-chef-automation/</a>). </p>

<p>When I'm creating the auto-scaling group, I selected the same vpc as my other instances belong to. However when I do that, it says that it the ec2 instance will not be assigned a public ip. How come? My other instances have the same vpc id and are assigned an ip address just fine.</p>

<p><a href="https://i.sstatic.net/oLdoB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oLdoB.png" alt="enter image description here"></a></p>

<p><a href="https://i.sstatic.net/ijq1U.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ijq1U.jpg" alt="enter image description here"></a></p>

<amazon-ec2><aws-vpc><aws-codedeploy>
Why don't the instances in the auto-scaling group get assigned public ip addresses unless it's a default vpc?
abbood
# Why don't the instances in the auto-scaling group get assigned public ip addresses unless it's a default vpc?

(Asked by: username_0 on 2018-08-01)

I'm trying to migrate our deployment process over to aws code deploy (by following instructions here:<https://pionect.nl/autoscaling-aws-laravel-codedeploy-opsworks-chef-automation/>).

When I'm creating the auto-scaling group, I selected the same vpc as my other instances belong to. However when I do that, it says that it the ec2 instance will not be assigned a public ip. How come? My other instances have the same vpc id and are assigned an ip address just fine.

[![enter image description here](https://i.sstatic.net/oLdoB.png)](https://i.sstatic.net/oLdoB.png)

[![enter image description here](https://i.sstatic.net/ijq1U.jpg)](https://i.sstatic.net/ijq1U.jpg)

**Tags:** amazon-ec2, aws-vpc, aws-codedeploy


---

## 1 answers

### Answer by username_0 on 2018-08-01. Score: 1 | Accepted answer

I got the answer from AWS support:

The reason why you are seeing that notification is because it is in accordance to your launch configuration (staging-1-deploy) settings. During the creation of a launch configuration, the assignment of public IP addresses to EC2 instances defaults to `Only assign a public IP address to instances launched in the default VPC and subnet. (default)` [1]. To support automatic assignment of public IP addresses to your EC2 instances as they are launched, you will have to change the launch configuration settings. Since a launch configuration cannot be edited [2], you can create a new one by copying your current launch configuration. Follow the steps below to achieve this:

1. Go to your AWS console, select `Launch Configurations`, select `staging-1-codedeploy`
2. At the bottom of the details, click the grey `Copy Configuration` button on the right.
3. Click`Edit Details` link, then click `Advanced Details` on the resulting page.
4. Go to `IP Address Type` and select the second option, `Assign a public IP address to every instance.`
5. [optional] Change the name of the launch configuration if need be and
6. Save launch configuration

You can now proceed to use your new launch configuration for your auto-scaling group and all your EC2 instances will be assigned public IP addresses as desired.
I have attached a few screenshots to show some of the steps described above.

> **Comments:**
> **username_1**: Where's the screenshots you mentioned?  

---

