0.1.34 • Published 4 years ago
@ucop-acme/aws-infra v0.1.34
Why?
These are helper libraries to unify some of the basic stack operations in AWS. Intended for use with codepipeline/codebuild
install
npm i @ucop-acme/aws-infra
Example usage of stack tagging, cf sample app directory
import cdk = require('@aws-cdk/core');
import s3 = require('../lib/s3');
import util = require('@ucop-acme/aws-infra');
import params from '../test/config.json';
import { Buckets } from './lib/buckets';
const branchEnv = util.mapBranchToEnvironment().trim();
const baseprops = {
application: 'sptn',
buildId: 'nope',
createdBy: 'alfred smithee',
description: 'Stop Plate Tectonics Now',
environment: branchEnv,
group: 'montyPython',
label: 'GetMeABucket',
owner: 'King Khalid',
source: 'codecommit:us-west-2:012345678910:sptn',
};
const bucketprops = {
content: 'magma',
description: 'Super Hot Data From the Earth',
encryption: 'KMS',
label: 'sample',
log_bucket_name: '/dev/null',
owner: 'Ms Creosote',
security_level: '1',
zone: 'core',
};
const stackEnv = { account: '012345678910', region: 'us-east-2' };
const myStackProps: util.IBaseStackProps = {
description: 'Stop Plate Tectonics Now' + util.makeBrand(),
env: stackEnv,
baseprops: {
application: 'sptn',
buildId: 'https://google.com',
createdBy: 'alfred smithee',
description: 'Stop Plate Tectonics Now',
environment: branchEnv,
group: 'Mr Creosote',
label: 'Buckets',
owner: 'King Khalid',
source: 'codecommit:us-west-2:012345678910:sptn',
},
};
const app = new cdk.App();
// add standard tags to all constructs in app
util.tagApp(app, myStackProps);
const stack = new util.BaseStack(app, { description: baseprops.description + util.makeBrand(), baseprops });
const myBucket = new s3.Bucket(stack, { baseprops, bucketprops });
bucketprops.label = 'other';
const myOtherBucket = new s3.Bucket(stack, { baseprops, bucketprops });
const buckets = new Buckets(app, myStackProps);
This will create two stacks:
cdk ls
sptnProdBuckets
sptnProdGetMeABucket
Notice that the generated templates contain standard tag meta:
cat cdk.out/manifest.json | jq '.artifacts.sptnProdGetMeABucket.metadata["/sptnProdGetMeABucket"][].data'
[
{
"Key": "ucop:application",
"Value": "sptn"
},
{
"Key": "ucop:buildId",
"Value": "https://google.com"
},
{
"Key": "ucop:createdBy",
"Value": "alfred smithee"
},
{
"Key": "ucop:environment",
"Value": "prod"
},
{
"Key": "ucop:group",
"Value": "Mr Creosote"
},
{
"Key": "ucop:owner",
"Value": "King Khalid"
},
{
"Key": "ucop:source",
"Value": "codecommit:us-west-2:012345678910:sptn"
},
{
"Key": "ucop:tagVersion",
"Value": "0.1"
}
]
Tags from json file:
{
"tags": {
"Description": "Stop Plate Tectonics Now",
"Owner": "alfred.smithee@google.com",
"Product": "sptn"
}
}
example of bucket creation
import infra = require("@ucop-acme/aws-infra");
// product Logging bucket
const LoggingBucket = new infra.Bucket(this, "log", {
content: "log",
description: "logging",
env: envBranch,
label: "log",
log_bucket_name: "",
owner: "log",
product: params[`tags`][`Product`],
security_level: "1",
zone: "log"
});
0.1.34
4 years ago
0.1.33
4 years ago
0.1.32
4 years ago
0.1.31
4 years ago
0.1.30
4 years ago
0.1.28
4 years ago
0.1.29
4 years ago
0.1.27
4 years ago
0.1.26
4 years ago
0.1.25
4 years ago
0.1.24
4 years ago
0.1.23
4 years ago
0.1.22
4 years ago
0.1.21
4 years ago
0.1.20
4 years ago
0.1.19
4 years ago
0.1.18
4 years ago
0.1.17
4 years ago
0.1.16
4 years ago
0.1.15
4 years ago
0.1.14
4 years ago
0.1.13
4 years ago
0.1.12
5 years ago
0.1.11
5 years ago
0.1.10
5 years ago
0.1.9
5 years ago
0.1.8
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago