Skip to content

EC2 instance running Former2 for generating IaC scripts from existing AWS resources with temporary security credentials

License

Notifications You must be signed in to change notification settings

aws-samples/ec2-former2

ec2-former2

Former2 is a website that allows you to generate IaC (Infrastructure as Code) templates (such as CloudFormation, CDK, Terraform, etc) from existing AWS resources and is mentioned on AWS Open Source Blog (Accelerate infrastructure as code development with open source Former2 and How DNAnexus used the open source Former2 project to create infrastructure as code templates for their disaster recovery pipeline).

Some users have challenges creating access keys while others have security concerns about entering AWS security credentials on an external website, and would prefer a private web instance. However, Former2 requires browser helper extension that only works with websites that has domain names 127.0.0.1, localhost, former2.com and www.former2.com.

This CloudFormation template provisions an EC2 instance hosting Former2 website in your AWS account. You can remote in to generate and download IaC templates with temporary security credentials.

About CloudFormation templates

EC2 instances must be provisioned in a subnet with IPv4 internet connectivity.

Getting started

Provision EC2 with CloudFormation

Download the CloudFormation template. Login to your CloudFormation console. Choose Create Stack, Upload a template file, Choose File, select your .yaml file and choose Next. Enter a Stack name and specify parameters values.

EC2

  • ec2Name: EC2 instance name
  • processorArchitecture: Intel/AMD x86_64 or Graviton arm64. Default is Graviton (arm64)
  • instanceType: EC2 instance types. Do ensure type matches processor architecture.

Network

  • vpcID: VPC with internet connectivity. Select default VPC if unsure
  • subnetID: subnet with internet connectivity. Select subnet in default VPC if unsure
  • displayPublicIP: set this to No if your EC2 instance will not receive public IP address. EC2 private IP will be displayed in CloudFormation Outputs section instead. Default is Yes
  • assignStaticIP: associates a static public IPv4 address using Elastic IP address. Default is Yes

Remote Access

  • ingressIPv4: allowed IPv4 source prefix to your EC2 instance, e.g. 1.2.3.4/32. You can get your source IP from https://checkip.amazonaws.com
  • ingressIPv6: allowed IPv6 source prefix to your EC2 instance. Use ::1/128 to block all incoming IPv6 access. Default is ::/0

EBS

Continue Next with Configure stack options, Review Stack, and click Submit to launch your stack. After your stack has been successfully created, its status changes to CREATE_COMPLETE.

Login to EC2 instance

Once provisioned, go to Outputs section and use the Values associated with the following Keys

  • SSMSessionManager: provides shell access. From session manager terminal, set your ec2-user password with the command sudo passwd ec2-user
  • DCVwebConsole: DCV web browser client. Login as ec2-user and your configured password. Launch Firefox browser and install Former 2 Helper for Mozilla Firefox

ec2.png

  • GetTokenCommand: Copy entire string. In your DCV session, open a terminal, and paste copied value in to retrieve temporary security credentials*. Use these values to enter IAM credentials at http://localhost/#section-setup-credentials

ec2.png

Using Former2

Refer to Accelerate infrastructure as code development with open source Former2 blog post for usage guidance.

Attribution

CloudFormation template downloads Former2 web codes from Ian Mckay's GitHub repo which are released under MIT license.

Updating web codes

Former2 is under active development. To download latest codes, login to EC2 instance and run /home/ec2-user/update-former2 script.

About DCV web console

DCV supports file transfer. Usage indicates acceptance of DCV EULA.

file transfer

Native clients can be downloaded from https://download.nice-dcv.com/

Clean Up

To remove created resources, delete your created CloudFormation stack

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

EC2 instance running Former2 for generating IaC scripts from existing AWS resources with temporary security credentials

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •