Skip to content

Instantly share code, notes, and snippets.

View PaulDuvall's full-sized avatar

Paul Duvall PaulDuvall

  • Amazon Web Services
  • us-east-1
View GitHub Profile
# https://diagrams.mingrammer.com/docs/nodes/aws
from diagrams import Cluster, Diagram
from diagrams.aws.compute import Lambda
from diagrams.aws.storage import S3
from diagrams.aws.network import APIGateway
from diagrams.aws.database import DynamodbTable
from diagrams.aws.security import IdentityAndAccessManagementIam
from diagrams.aws.devtools import Codebuild
from diagrams.aws.devtools import Codecommit
from diagrams.aws.devtools import Codedeploy
MyDBInstance:
Type: AWS::RDS::DBInstance
Properties:
AllocatedStorage: 20
DBInstanceClass: db.t2.micro
Engine: mysql
MasterUsername: !Join ['', ['{{resolve:secretsmanager:', !Ref MyRDSInstanceRotationSecret, ':SecretString:username}}' ]]
MasterUserPassword: !Join ['', ['{{resolve:secretsmanager:', !Ref MyRDSInstanceRotationSecret, ':SecretString:password}}' ]]
BackupRetentionPeriod: 0
DBInstanceIdentifier: 'rotation-instance'
@PaulDuvall
PaulDuvall / stelligent-blog-pipeline-serverless-app.yml
Last active June 26, 2020 16:38
CodePipeline definition for Serverless application
Pipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
RoleArn: !GetAtt CodePipelineRole.Arn
Stages:
- Name: Source
...
ActionTypeId:
Category: Source
Owner: ThirdParty
GetDataFunction:
Type: 'AWS::Serverless::Function'
Properties:
Handler: index-get.handler
CodeUri: src/
Runtime: nodejs12.x
AutoPublishAlias: live
DeploymentPreference:
Type: CodeDeployDefault.LambdaCanary10Percent5Minutes
Hooks:
git clone https://github.com/PaulDuvall/cloudproviders.git
cd cloudproviders
sudo chmod +x launch-stack.sh
./launch-stack.sh
aws secretsmanager create-secret --name github/personal-access-token --description "GitHub Token" --secret-string "GITHUBTOKEN"
@PaulDuvall
PaulDuvall / diagrams-as-code.sh
Last active June 15, 2020 16:18
stelligent-blog-diagrams-as-code
git clone https://github.com/PaulDuvall/diagrams-as-code.git
cd diagrams-as-code
sudo chmod +x *.sh
./launch-stack.sh
Pipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
RoleArn: !GetAtt CodePipelineRole.Arn
Stages:
- Name: Source
Actions:
- InputArtifacts: []
Name: Source
ActionTypeId:
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
commands:
- python --version
- 'curl -O https://bootstrap.pypa.io/get-pip.py'
- python3 get-pip.py --user
- pip install --upgrade pip
CodeBuildCommands:
Type: AWS::CodeBuild::Project
DependsOn: CodeBuildRole
Properties:
Name:
Ref: AWS::StackName
Description: Build application
ServiceRole:
Fn::GetAtt:
- CodeBuildRole