Skip to main content

Deploying an EC2 Instance Using Cross-Stack References

Hands-On Lab

 

Photo of Craig Arcuri

Craig Arcuri

AWS Training Architect II in Content

Length

00:30:00

Difficulty

Intermediate

In this lab, we will learn how to configure and use cross-stack references. We will use export and import commands in a template to enable the sharing of data between stacks.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Deploying an EC2 Instance Using Cross-Stack References

Introduction

In this lab, we will learn how to configure and use cross-stack references. We will use export and import commands in a template to enable the sharing of data between stacks.

Connect to the Lab

  1. Log in to the AWS console with the cloud_user credentials provided on the lab instructions page.
  2. Make sure you are using the us-east-1 (N. Virginia) region.

Deploy the Network Stack with AWS CloudFormation

  1. Navigate to the CloudFormation service.
  2. Click Create stack.
  3. Under Specify template, select Upload a template file.
  4. Click Choose file, and select the network stack template (crossstack.json) provided with the lab.
  5. Click View in Designer.
  6. Click the square fullscreen icon on the right side of the page to expand the template.
  7. Review the contents of the template.
  8. Click the checkmark icon at the top of the page to validate the template.
  9. Click the cloud arrow icon at the top of the page to create the stack.
  10. On the Create stack page, click Next to accept the defaults and go to the next step.
  11. Name the stack "networkstack", then click Next.
  12. On the Configure stack options page, ignore the error, and click Next.
  13. On the Review page, click Create stack.
  14. Once the stack has finished deploying, review the Outputs line of the template.

Deploy an Amazon EC2 Instance using Cross-Stack References with AWS CloudFormation

  1. From the CloudFormation Stacks page, click Create stack.
  2. Under Specify template, select Upload a template file.
  3. Click Choose file, and select the application stack template (crossstackapp.json) provided with the lab.
  4. Click View in Designer.
  5. Click the square fullscreen icon on the right side of the page to expand the template.
  6. Review the contents of the template.
  7. Click the checkmark icon at the top of the page to validate the template.
  8. Click the cloud arrow icon at the top of the page to create the stack.
  9. On the Create stack page, click Next to accept the defaults and go to the next step.
  10. For Stack name, type "appstack".
  11. Under Parameters, change the NetworkStackName to "networkstack".
  12. Click Next.
  13. On the Configure stack options page, ignore the error, and click Next.
  14. On the Review page, click Create stack.
  15. Once the stack has finished deploying, review the contents of the Events tab.
  16. From the networkstack page, select appstack, and click Delete > Delete stack.
  17. Select networkstack, and click Delete > Delete stack.

Conclusion

Congratulations, you've successfully completed this hands-on lab!