I want to connect from an Amazon Elastic Compute Cloud (Amazon EC2) instance that was created by Data Pipeline in a public subnet to an instance or data store outside of the virtual private cloud (VPC).

Create an Elastic IP address, and then use the ShellCommandActivity Data Pipeline object to execute the associate-address command. This command assigns a specified Elastic IP address to an instance, and then releases the address when the instance terminates.

1.    Allocate an Elastic IP address. Note the Allocation ID—you need it when you run the associate-address command later.

2.    Be sure that the Elastic IP address is allowed in the security group of the instance or data store that you want to connect to.

3.    Open the Data Pipeline console.

4.    On the List Pipelines page, choose your Pipeline ID, and then choose Edit Pipeline to open the Architect page.

5.    Choose Add in the upper-left corner, and then choose ShellCommandActivity.

6.    Open the Activities section, and then find the ShellCommandActivity object. It's called something like "DefaultShellCommandActivity1."

7.    In the Add an optional field list, choose Command.

8.    Enter a command similar to the following. Replace the values for instance-id, allocation-id, and region.

INSTANCE=`(wget -q -O - http://instance-data/latest/meta-data/instance-id)`; aws ec2 associate-address --instance-id $INSTANCE --allocation-id eipalloc-5723d13e --region us-east-1

9.    Choose Save. When your pipeline is activated, Data Pipeline assigns the Elastic IP address to the EC2 instance. You can then connect from that instance to the instance or data store that is outside of the VPC.

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2019-02-27