Skip to content

Instantly share code, notes, and snippets.

@awsvpc
awsvpc / lnx-connection.tf
Created March 15, 2024 23:05 — forked from rybons/lnx-connection.tf
Sample of Linux connection with bastion info
data "template_file" "lnx_script" {
template = "${file("${path.module}/templates/lnx_script.sh")}"
vars {
var1 = "${var.var1}"
}
}
resource "aws_instance" "myinstance" {
connection {
type = "ssh"
@awsvpc
awsvpc / SSM-ListInstanceIds.json
Last active February 11, 2024 02:45 — forked from lampidudelj/ChangeCognitoPassword.json
AWS Automation Document - Change Cognito Password
{
"schemaVersion": "0.3",
"description": "Updates a Microsoft Windows AMI. By default it will install all Windows updates, Amazon software, and Amazon drivers. It will then sysprep and create a new AMI. Supports Windows Server 2008 R2 and greater.",
"assumeRole": "{{ AutomationAssumeRole }}",
"parameters": {
"SourceAmiId": {
"type": "String",
"description": "(Required) The source Amazon Machine Image ID."
},
"TopicArn": {
@armenr
armenr / ssh_key.tf
Created November 21, 2022 12:01 — forked from irvingpop/ssh_key.tf
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@JAMSUPREME
JAMSUPREME / get-ec2.yaml
Last active February 11, 2024 02:14
SSM Automation
description: |-
### EC2 stopper by tag
Stop EC2 instances by tag
schemaVersion: '0.3'
mainSteps:
- name: getInstancesByTag
action: 'aws:executeAwsApi'
outputs:
- Name: InstanceIds
@keithduncan
keithduncan / buildkite_agent_step_function.json
Created March 5, 2019 11:19
An AWS step function to register and ping multiple virtual Buildkite agents.
{
"StartAt": "RegisterBuildkiteAgents",
"TimeoutSeconds": 1800,
"States": {
"RegisterBuildkiteAgents": {
"Type": "Pass",
"Result": {
"TaskDefinitions": {
"Definitions": [],
"Count": 0
@dalethestirling
dalethestirling / postgres_instance.tf
Created September 10, 2017 22:41
Using provisioner for RDS password generation
resource "aws_db_instance" "postgres" {
identifier = "${var.postgres_id}"
name = "${var.postgres_name}"
engine = "${var.postgres_engine}"
engine_version = "${var.postgres_version}"
multi_az = "${var.postgres_multi_az}"
instance_class = "${var.postgres_class}"
db_subnet_group_name = "${var.postgres_subnet_group}"