All Projects → Flaconi → terraform-aws-bastion-ssm-iam

Flaconi / terraform-aws-bastion-ssm-iam

Licence: MIT license
AWS Bastion server which can reside in the private subnet utilizing Systems Manager Sessions

Programming Languages

HCL
1544 projects
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to terraform-aws-bastion-ssm-iam

terraform-aws-ecs-web-app
Terraform module that implements a web app on ECS and supports autoscaling, CI/CD, monitoring, ALB integration, and much more.
Stars: ✭ 175 (+573.08%)
Mutual labels:  terraform-module
terraform-aws-resource-naming
Terraform module to generate resource name with random_id added as suffix.
Stars: ✭ 18 (-30.77%)
Mutual labels:  terraform-module
Terraform Aws Eks
Terraform module to create an Elastic Kubernetes (EKS) cluster and associated worker instances on AWS
Stars: ✭ 2,464 (+9376.92%)
Mutual labels:  terraform-module
terraform-aws-autoscaling
A terraform module which provisions an auto scaling group along with its launch template
Stars: ✭ 32 (+23.08%)
Mutual labels:  terraform-module
terraform-github-repository-webhooks
Terraform module to provision webhooks on a set of GitHub repositories
Stars: ✭ 20 (-23.08%)
Mutual labels:  terraform-module
terraform-linode-k8s
Kubernetes installer for Linode
Stars: ✭ 63 (+142.31%)
Mutual labels:  terraform-module
terraform-aws-sqs
Terraform module which creates SQS resources on AWS 🇺🇦
Stars: ✭ 53 (+103.85%)
Mutual labels:  terraform-module
terraform-aws-vpn-gateway
Terraform module which creates VPN gateway resources on AWS 🇺🇦
Stars: ✭ 101 (+288.46%)
Mutual labels:  terraform-module
terraform-aws-ecs-cloudwatch-sns-alarms
Terraform module to create CloudWatch Alarms on ECS Service level metrics.
Stars: ✭ 23 (-11.54%)
Mutual labels:  terraform-module
Terraform Aws Vpc
Terraform module which creates VPC resources on AWS
Stars: ✭ 2,043 (+7757.69%)
Mutual labels:  terraform-module
combinator
Combinator.ml's central repo, documentation and website
Stars: ✭ 24 (-7.69%)
Mutual labels:  terraform-module
terraform-aws-zappa
Create a AWS VPC with associated resources for use with Zappa
Stars: ✭ 30 (+15.38%)
Mutual labels:  terraform-module
terraform-aws-eks-jx
A Terraform module for creating Jenkins X infrastructure on AWS
Stars: ✭ 55 (+111.54%)
Mutual labels:  terraform-module
terraform-aws-sns-topic
Terraform Module to Provide an Amazon Simple Notification Service (SNS)
Stars: ✭ 22 (-15.38%)
Mutual labels:  terraform-module
Autospotting
Saves up to 90% of AWS EC2 costs by automating the use of spot instances on existing AutoScaling groups. Installs in minutes using CloudFormation or Terraform. Convenient to deploy at scale using StackSets. Uses tagging to avoid launch configuration changes. Automated spot termination handling. Reliable fallback to on-demand instances.
Stars: ✭ 2,014 (+7646.15%)
Mutual labels:  terraform-module
provose
Provose is a new way to manage your Amazon Web Services infrastructure.
Stars: ✭ 27 (+3.85%)
Mutual labels:  terraform-module
terraform-module-template
Template repo with Terraform module basics
Stars: ✭ 17 (-34.62%)
Mutual labels:  terraform-module
terraform-oci-compute-instance
Terraform Module for creating Oracle Cloud Infrastructure compute instances
Stars: ✭ 29 (+11.54%)
Mutual labels:  terraform-module
terraform-aws-cloudwatch-logs
Terraform Module to Provide a CloudWatch Logs Endpoint
Stars: ✭ 59 (+126.92%)
Mutual labels:  terraform-module
terraform-aws-organization-access-group
Terraform module to create an IAM Group and Policy to grant permissions to delegated IAM users in the Organization's master account to access a member account
Stars: ✭ 16 (-38.46%)
Mutual labels:  terraform-module

AWS Bastion SSM IAM

Lint Status Docs Status Tag license

Terraform module which provides a Bastion for AWS utilizing

  • Autoscaling group of min/max 1 for resiliency
  • AWS SSM Session Manager, this allows users to start a Terminal Session or Tunnel to an instance without the need of public internet access
  • ec2-instance-connect, for the creation of temporary ssh keys on the instance

NOTE Important, this module managed the SSM Document SSM-SessionManagerRunShell, in some cases it already exists. To make sure Terraform is used to maintain this Document please execute: aws ssm delete-document --name SSM-SessionManagerRunShell. In case you do not want to overwrite SSM-SessionManagerRunShell, you can use the module directive create_new_ssm_document to create a different document name. This document needs to be refered to as follows: SSM_DOCUMENT_NAME="SSM-SessionManagerRunShell-JKURx" ./ssh_terminal

NOTE For this to work you need to install the session manager plugin for the AWSCLI, click (here)[https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html] for more information.

Examples

Check the examples directory for installation.

Client

SSH Terminal

The bash script client/ssh_terminal provides a simplified way to ssh to the IAM Bastion, it uses a recent awscli-client with ssm terminal support.

SSH Tunnel

The bash script client/ssh_tunnel creates an SSH tunnel using the BASTION, it uses a recent awscli-client with ssm terminal support and ec2-instance-connect for uploading the SSH Public key to AWS. Make sure the BASTION has access to the resources it needs access to by modifying the Security Group of the resouce.

By default the public key file $HOME/.ssh/id_rsa.pub will be used for temporary access. The ENVIRONMENT variable SSH_PUB_KEY_FILE can be used to set a different public key, as of now AWS does not support ed25519 public keys. By default the ENVIRONMENT variable AWS_REGION will be used for the awscli-tool, if you are using awscli profiles, please provide the correct region by setting the AWS_REGION-variable. If DEV_LOCAL_PORT is specified, the ssh tunnel will be created with DEV_LOCAL_PORT as local port to connect to, if not a RANDOM port will be used.

Example:

./ssh_tunnel private_subnet.isdfjsdf.eu-central-1.rds.amazonaws.com:3306

Requirements

Name Version
terraform >= 1.2.4
aws >= 3
random >= 3.1

Providers

Name Version
aws >= 3
random >= 3.1
template n/a

Modules

No modules.

Resources

Name Type
aws_autoscaling_group.this resource
aws_cloudwatch_log_group.this resource
aws_iam_instance_profile.this resource
aws_iam_role.this resource
aws_iam_role_policy.kms resource
aws_iam_role_policy_attachment.this resource
aws_kms_key.this resource
aws_launch_configuration.this resource
aws_security_group.allow_egress resource
aws_ssm_document.session_manager_prefs resource
random_string.this resource
aws_ami.amazon_linux_2 data source
aws_caller_identity.current data source
aws_iam_policy_document.kms_key_policy data source
aws_iam_policy_document.kms_key_policy_iam_profile data source
aws_iam_policy_document.trust_policy data source
aws_region.current data source
template_file.init data source

Inputs

Name Description Type Default Required
subnet_ids The subnets where the Bastion can reside in, they can be private list(string) n/a yes
vpc_id The VPC-ID string n/a yes
create_new_ssm_document This module can create a new SSM document for the SSH Terminal bool false no
create_security_group This module can create a security group for the bastion instance by default bool true no
image_id AMI to be used. If blank, latest amazon linux 2 will be used string "" no
instance_type The instance type of the bastion string "t3.nano" no
log_retention The amount of days the logs need to be kept number 30 no
name The name to be interpolated, defaults to bastion-ssm-iam string "bastion-ssm-iam" no
security_group_ids The security group ids which can be given to the bastion instance, defaults to empty list(string) [] no
tags Tags to be added to the launch configuration for the bastion host, additionally to name tag
list(object({
key = string
value = string
propagate_at_launch = bool
}))
[] no

Outputs

Name Description
instance_profile_name The instance profile name of SSM
security_group_id The security group id of the bastion server
ssm_document_name The document name of SSM

License

MIT

Copyright (c) 2021 Flaconi GmbH

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].