Skip to content

Instantly share code, notes, and snippets.

Avatar
🐶

Jackie Chen jc1518

🐶
View GitHub Profile
View codeBuildCloneOutput.ts
const pipeline = new cdk.aws_codepipeline.Pipeline(this, "Pipeline", {
role: pipelineRole,
restartExecutionOnUpdate: true,
enableKeyRotation: true,
});
pipeline.addStage({
stageName: "Get_Source",
actions: [
new cdk.aws_codepipeline_actions.CodeStarConnectionsSourceAction({
View nlb-ip-check.sh
#!/bin/bash
warning_list=""
RED="\033[0;31m"
NC="\033[0m"
for target_group in $(aws elbv2 describe-target-groups --query "TargetGroups[?starts_with(TargetGroupName, 'serverless-')].TargetGroupArn" --output text)
do
echo "---------------------------------------"
View aws_config_query_sample.sh
export aggregator="REPLACE_WITH_YOUR_AGGREGATOR_NAME"
export query="SELECT accountId, configuration.instancdId, configuration.publicIp, configuration.ipv6Addresses WHERE resourceType = 'AWS::EC2::Instance' AND (configuration.publicIp BETWEEN '0.0.0.0' AND '255.255.255.255' OR configuration.ipv6Addresses BETWEEN '0:0:0:0:0:0:0:0' AND 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')"
aws configservice select-aggregate-resource-config --expression $query --configuration-aggregator-name $aggregator
@jc1518
jc1518 / aws_config_query_sample.sql
Last active Sep 1, 2022
AWS config query sample - get ec2 instances with public IP address
View aws_config_query_sample.sql
SELECT
accountId,
configuration.instancdId,
configuration.publicIp,
configuration.ipv6Addresses
WHERE
resourceType = 'AWS::EC2::Instance'
AND (
configuration.publicIp BETWEEN '0.0.0.0'
AND '255.255.255.255'
@jc1518
jc1518 / on_prem_instance_profile.py
Last active Dec 10, 2020
Rotate AWS credential for on-prem servers which has tag on-prem:bamboo-agent
View on_prem_instance_profile.py
import os
import json
import logging
import time
import boto3
logger = logging.getLogger()
logger.setLevel(logging.INFO)
sts_client = boto3.client("sts")
@jc1518
jc1518 / jira_remove_old_operations.yaml
Created Oct 29, 2020
jira_remove_old_operations.yaml
View jira_remove_old_operations.yaml
---
- name: Delete old jira node operation records from replicatedindexoperation table
postgresql_query:
login_host: "{{ atl_db_host }}"
port: "{{ atl_db_port }}"
login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: DELETE FROM replicatedindexoperation AS Rep WHERE Rep.node_id NOT IN (SELECT node_id from clusternode)
@jc1518
jc1518 / jira_restore_index_from_snapshot.yaml
Last active Oct 29, 2020
Code snippet for restoring Jira index files from snapshot
View jira_restore_index_from_snapshot.yaml
---
- name: Wait for index files folder ready
wait_for:
path: "{{ atl_product_home }}/caches/indexesV1"
delay: 60
sleep: 10
timeout: 120
ignore_errors: yes
@jc1518
jc1518 / jira_ami_snappy.yaml
Created Sep 24, 2020
Code snippet for adding snappy support in Jira AMI
View jira_ami_snappy.yaml
- name: Install dependencies for snappy
yum:
name:
- gcc
- gcc-c++
- automake
- snappy
- snappy-devel
- git
when: atl_product_family == "jira"
View s3_endpoint_policy_sample.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MyTestDataBucketReadAccess",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
@jc1518
jc1518 / a3.py
Created Jul 30, 2020
Automate Atlassian Addons POC
View a3.py
# a3 = Automate Atlassian Addons
def get_server_info(server, auth):
''' Check application version on the server '''
print("\n>>> Checking server information")
server_application = server.split('.')[0].split('-')[0]
url = "https://{}/rest/applinks/1.0/manifest".format(server)
headers = {'content-type': 'application/xml'}
response = requests.get(url, auth=auth, headers=headers)
response.raise_for_status()