Skip to content

Instantly share code, notes, and snippets.

View Rud5G's full-sized avatar
🏡
Working remotely

Rudger Rud5G

🏡
Working remotely
View GitHub Profile
@Rud5G
Rud5G / cluster-utils.ts
Last active November 10, 2024 14:08
from aws-quickstart/cdk-eks-blueprints
import { Construct } from "constructs";
import * as customResource from 'aws-cdk-lib/custom-resources';
import { ClusterInfo } from "../spi";
interface Tag {
Key: string;
Value: string;
}
@Rud5G
Rud5G / add-cfn-nag-suppression.ts
Last active November 9, 2024 19:02
addCfnNagSuppression
import { CfnResource } from 'aws-cdk-lib';
import { IConstruct } from 'constructs';
export interface CfnNagSuppression {
readonly id: string;
readonly reason: string;
}
export function addCfnNagSuppression(resource: IConstruct, suppression: CfnNagSuppression): void {
const cfnResource = resource.node.defaultChild as CfnResource;
@Rud5G
Rud5G / node-setup.sh
Created September 22, 2024 13:00
K3s Pi Cluster Node setup
echo 'execute manually'
exit 0
# become root
sudo bash
# add vim
apt install vim
@Rud5G
Rud5G / terraform_state_cloudformation_template.yml
Created August 18, 2024 15:07 — forked from qtangs/terraform_state_cloudformation_template.yml
CloudFormation Template for creating S3 bucket and DynamoDB table to hold Terraform state and locks
AWSTemplateFormatVersion: 2010-09-09
Description: >
Template for creating S3 bucket and DynamoDB table to hold Terraform state and locks
Validate: aws cloudformation validate-template --template-body file://terraform_state.yml
Deploy: aws cloudformation create-stack --region us-east-1 --stack-name Terraform-State-Resources --enable-termination-protection --template-body file://terraform_state.yml --parameters ParameterKey=TerraformStateBucketPrefix,ParameterValue=terraform-state ParameterKey=TerraformStateLockTableName,ParameterValue=terraform-state-locks
Parameters:
TerraformStateBucketPrefix:
Type: String
Default: terraform-state
Description: A prefix for S3 bucket name, account id will be added to ensure global uniqueness
aws iam create-group --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonRoute53FullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/IAMFullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonVPCFullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonSQSFullAccess --group-name kops
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonEventBridgeFullAccess --group-name kops
import * as cdk from 'aws-cdk-lib';
import * as pipelines from 'aws-cdk-lib/pipelines';
import { Construct } from 'constructs';
import { PipelineStage } from '../pipeline-stage/pipeline-stage';
import { environments } from '../pipeline-config/pipeline-config';
export class PipelineStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
import * as apigw from 'aws-cdk-lib/aws-apigateway';
import * as cdk from 'aws-cdk-lib';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as nodeLambda from 'aws-cdk-lib/aws-lambda-nodejs';
import * as path from 'path';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
import * as cdk from 'aws-cdk-lib';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
import { RemovalPolicy } from 'aws-cdk-lib';
export interface StatefulStackProps extends cdk.StackProps {
bucketName: string;
}
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { EnvironmentConfig } from '../pipeline-types/pipeline-types';
import { StatefulStack } from '../../app/stateful/stateful-stack';
import { StatelessStack } from '../../app/stateless/stateless-stack';
// this is our stage made up of multiple stacks which will be deployed to various environments
// based on config i.e. feature-dev, staging, prod, which also includes our application config
export class PipelineStage extends cdk.Stage {
import * as dotenv from 'dotenv';
import {
Account,
EnvironmentConfig,
Region,
Stage,
} from '../pipeline-types/pipeline-types';
dotenv.config();