Skip to content

Instantly share code, notes, and snippets.

UserData:
Fn::Base64:
Fn::Sub:
- |
#!/bin/bash -xe
echo ECS_CLUSTER=${EcsCluster} >> /etc/ecs/ecs.config
yum install -y aws-cfn-bootstrap ec2-instance-connect awscli
amazon-linux-extras install epel
yum install -y s3fs-fuse
mkdir -p /srv/omaha_s3
@tuladhar
tuladhar / DIRECTORY NAVIGATION
Last active August 25, 2020 05:25
Linux Commands for Developers: DIRECTORY NAVIGATION
# Change to /home directory
$ cd /home
# Change to previous directory
$ cd -
# Go up one level of the directory tree
$ cd ..
# Print's current directory you are in
@tuladhar
tuladhar / SYSTEM-INFORMATION.sh
Created August 25, 2020 05:27
Linux Commands for Developers: SYSTEM INFORMATION
# Display Linux system information
:> uname -a
# Display kernel release information
:> uname -r
# Show which version of Ubuntu installed (Similar command is available to other distros)
:> cat /etc/lsb_release
:> lsb_release -a
@tuladhar
tuladhar / main.ts
Last active October 12, 2020 18:46
const fetchServerInformation = async (url: URL): Promise<[finalURL: URL, version: string]> => {
// ...
const endpoint = new URL('api/info', url);
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Lambda to send notification for ElastiCache Events
Parameters:
EnvironmentName:
Type: String
EnvironmentType:
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: main
Runtime: go1.x
Environment:
Variables:
WEBHOOK_URL: !Ref WebhookUrl
Topic:
Type: AWS::SNS::Topic
Properties:
TopicName: !Sub ${AWS::StackName}
DisplayName: A topic that receives ElastiCache Events and triggers lambda to send notification.
Subscription:
- Endpoint: !GetAtt LambdaFunction.Arn
Protocol: lambda
Tags:
- Key: EnvironmentName
LambdaPermission:
Type: AWS::Lambda::Permission
Properties:
Action: 'lambda:InvokeFunction'
FunctionName: !Ref LambdaFunction
Principal: sns.amazonaws.com
SourceArn: !Ref Topic
Outputs:
TopicArn:
Value: !Ref Topic
Export:
Name: !Sub "${EnvironmentName}:ElastiCache:Events:TopicArn"
package main
import (
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-lambda-go/events"
)
func handler(snsEvent events.SNSEvent) (error) {
return nil
}