Skip to content

Instantly share code, notes, and snippets.

@cagdas1
cagdas1 / index-v1.ts
Created February 16, 2023 14:03
CDK Migration Post
import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import { config } from "dotenv";
config();
class EC2BasicsStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Create a new VPC
@cagdas1
cagdas1 / cassandra.ts
Created February 4, 2023 22:11
Cassandra
import * as cdk from "aws-cdk-lib";
import * as cassandra from "aws-cdk-lib/aws-cassandra"
import { config } from "dotenv";
import { Construct } from "constructs";
config();
class CassandraStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
version: '3.8'
services:
mariadb:
image: 'docker.io/bitnami/mariadb:10.3-debian-10'
volumes:
- 'mariadb_data:/bitnami/mariadb'
environment:
- MARIADB_USER=bn_wordpress
- MARIADB_DATABASE=bitnami_wordpress
- ALLOW_EMPTY_PASSWORD=yes
@cagdas1
cagdas1 / templates.ts
Created March 9, 2020 22:42
Serveress EKS Helper
export function getKubernetesTemplates(
repo: any,
name: string,
containerPort: number,
replicaNumber: number
) {
return [
{
apiVersion: "apps/v1",
kind: "Deployment",
@cagdas1
cagdas1 / index.ts
Created March 9, 2020 22:38
Serverless EKS
import * as cdk from "@aws-cdk/core";
import * as eks from "@aws-cdk/aws-eks";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as iam from "@aws-cdk/aws-iam";
import * as ecrAssets from "@aws-cdk/aws-ecr-assets";
import { getKubernetesTemplates } from "./templates";
import { config } from "dotenv";
config();
class ServerlessEKSStack extends cdk.Stack {
@cagdas1
cagdas1 / index.ts
Created February 21, 2020 22:24
Wordpress on AWS
import * as cdk from "@aws-cdk/core";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as autoscaling from "@aws-cdk/aws-autoscaling";
import * as rds from "@aws-cdk/aws-rds";
import * as ecs_patterns from "@aws-cdk/aws-ecs-patterns";
import * as ecs from "@aws-cdk/aws-ecs";
require('dotenv').config();
const DB_PORT = +(process.env["DB_PORT"] as string);
const DB_NAME = process.env["DB_NAME"] as string;
@cagdas1
cagdas1 / .env
Last active February 21, 2020 00:10
# Replace the variables with your own
# You can use Speech Synthesis Markup Language (SSML) to customize the volume, pronunciation, and speed of your messages. https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html
# Information related to Cron expression config https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html
AWS_REGION="us-east-1"
ACCOUNT_ID="Your AWS Account ID"
DESTINATION_PHONE_NUMBER="+1xxxxxxxxxx"
ORIGIN_PHONE_NUMBER="+1xxxxxxxxxx"
LANGUAGE_CODE="en-US"
VOICE_ID="Joanna"
const { execSync } = require("child_process");
execSync(`cdk destroy --app='node PinpointStack.js' PinpointStack`, {stdio: 'inherit'});
execSync(`cdk destroy --app='node CallServiceStack.js' CallServiceStack`, {stdio: 'inherit'});
@cagdas1
cagdas1 / deploy.js
Last active February 20, 2020 23:48
const inquirer = require("inquirer");
const replace = require('replace-in-file');
const { execSync } = require("child_process");
require('dotenv').config();
const promptQuestions = [{
type: 'input',
name: 'longCode',
message: "What's the long-code (telephone number) you've created in Pinpoint console? Use the following formatting +12024104849",
}];
const cdk = require("@aws-cdk/core");
const lambda = require("@aws-cdk/aws-lambda");
const events = require("@aws-cdk/aws-events");
const targets = require("@aws-cdk/aws-events-targets");
const iam = require("@aws-cdk/aws-iam");
require('dotenv').config();
class CallServiceStack extends cdk.Stack {
constructor(scope, id, props) {
super(scope, id, props);