GithubHelp home page GithubHelp logo

kunduso / ec2-userdata-terraform Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 21.0 105 KB

Create an Amazon EC2 instance and work with the `user_data` script. There are 9 different branches of the repository covering unique use cases.

License: The Unlicense

HCL 77.64% Smarty 22.36%
amazon-ec2 iam-role ssm-parameter-store terraform amazon-ec2-userdata amazon-session-manager amazon-vpc-endpoint

ec2-userdata-terraform's Introduction

License: Unlicense GitHub pull-requests closed GitHub pull-requests GitHub issues-closed GitHub issues Image

Motivation

This GitHub repository contains multiple use cases of working with Terraform to provision Amazon EC2 instances. Specific Git branches separate these use cases. To read more about that, click here.

Securely accessing and managing your Amazon EC2 instances for Windows has become a critical task for cloud engineers and IT administrators. In this blog post, I explored how you can leverage AWS Systems Manager's Fleet Manager to remotely connect to your EC2 instances using the familiar Remote Desktop Protocol (RDP), without the need for complex network configurations or exposing your instances to the public internet.

This repository contains the Terraform code to provision an Amazon EC2 instance for Windows with secure RDP access using AWS Systems Manager's Fleet Manager. The code demonstrates how to set up the necessary AWS services, including VPC Endpoints, security groups, and IAM policies, to enable this secure remote access solution.

Prerequisites

I installed terraform before I worked on this repository. Installation information is available in the install guide.
I used the access_key and the secret_key of an IAM user that had permission to create all the resources managed via this terraform code.
I created a terraform.tfvars file to store them.

Usage

Ensure that the IAM user whose credentials are being used in this configuration has permission to create and manage all the resources that are included in this repository.
Review the code, especially the iamrole.tf and ec2.tf file to understand all the concepts associated with creating an IAM role, attaching the role to the AWS managed policy, creating an IAM instance profile with the IAM role and finally attaching the IAM instance profile to the Amazon EC2 instance.

Next, run terraform init
Then run terraform plan
And finally run terraform apply

Other use-cases in this repository

There are eleven other branches in this repository discussing other use-cases:

No. Use-Case Branch
1. Add an Amazon EC2 instance https://github.com/kunduso/ec2-userdata-terraform/blob/add-amazon-ec2/ReadMe.md
2. Add a user_data script to an Amazon EC2 instance https://github.com/kunduso/ec2-userdata-terraform/blob/add-userdata/ReadMe.md
3. Attach an AWS IAM role to an Amazon EC2 instance https://github.com/kunduso/ec2-userdata-terraform/blob/add-iam-role/ReadMe.md
4. Install AWS.Tools module for PowerShell on Amazon EC2 instance running Windows Server using user_data script https://github.com/kunduso/ec2-userdata-terraform/blob/add-aws.tools-powershell-to-userdata/ReadMe.md
5. Install AWS CLI on an Amazon EC2 instance running Windows Server using user_data script https://github.com/kunduso/ec2-userdata-terraform/blob/add-awscli-to-userdata/ReadMe.md
6. Manage sensitive variables in Amazon EC2 with AWS Systems Manager Parameter Store https://github.com/kunduso/ec2-userdata-terraform/blob/add-ssm-parameter/ReadMe.md
7. Download Amazon S3 bucket contents to Amazon EC2 instance https://github.com/kunduso/ec2-userdata-terraform/blob/add-s3-access/ReadMe.md
8. Access AWS Secrets Manager secret from Amazon EC2 instance https://github.com/kunduso/ec2-userdata-terraform/blob/access-secrets-python/ReadMe.md
9. Create an Amazon EC2 instance with Session Manager access https://github.com/kunduso/ec2-userdata-terraform/blob/add-iam-role-for-session-manager/ReadMe.md
10. Install and configure CloudWatch Logs agent on Amazon EC2 instance for Windows using user data https://github.com/kunduso/ec2-userdata-terraform/blob/add-cloudwatch-agent/ReadMe.md
11. Create an Amazon EC2 instance using Terraform with Session Manager access using VPC Endpoint https://github.com/kunduso/ec2-userdata-terraform/blob/add-vpc-endpoint/ReadMe.md

License

This code is released under the Unlincse License. See LICENSE.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.