Skip to content

Instantly share code, notes, and snippets.

View github-runner.ps1
mkdir actions-runner; cd actions-runner
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.306.0/actions-runner-win-x64-2.306.0.zip -OutFile actions-runner-win-x64-2.306.0.zip
if((Get-FileHash -Path actions-runner-win-x64-2.306.0.zip -Algorithm SHA256).Hash.ToUpper() -ne '998fd610e6024cb7015240a82a635a877aab4d6dfb0de89bdd167b0128452721'.ToUpper()){ throw 'Computed checksum did not match' }
Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.306.0.zip", "$PWD")
C:\actions-runner\config.cmd --url https://github.com/Github-AWS-Learning `
--token $(Invoke-RestMethod -Method Post -Uri https://api.github.com/orgs/<REPLACE YOUR ORG NAME>/actions/runners/registration-token `
View connect-to-aws-service-usingpython-stsrole.py
import boto3
import json
ACCOUNT_ID = "7088"
sts_client = boto3.client('sts',region_name="ap-southeast-2")
assumed_role_object =sts_client.assume_role(RoleArn="arn:aws:iam::7068:role/role_to_Access_s3",RoleSessionName="S3access")
print("assumed role: ", json.dumps(assumed_role_object,indent=4,default=str))
@subudear
subudear / s3-service.js
Created February 12, 2023 23:02
s3fileread
View s3-service.js
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
exports.handler = async function(params){
console.info('fetching file from s3 bucket');
try {
const fileData = await s3.getObject(params).promise();
console.log(JSON.parse(fileData.Body))
return fileData;
@subudear
subudear / index.js
Created February 12, 2023 23:02
lambdaauthorizer
View index.js
exports.handler = (event, context, callback) => {
console.log('Received event:', JSON.stringify(event, null, 2));
var headers = event.headers;
console.log('headers: ', JSON.stringify(headers));
// Parse the input for the parameter values
var tmp = event.routeArn.split(':');
@subudear
subudear / azure-pipeline-to-aws-fargate-deploy.yml
Created May 8, 2022 10:02
build pipeline to upload image to aws ecr
View azure-pipeline-to-aws-fargate-deploy.yml
trigger:
- main
pool:
name: Self-Hosted-Agent
variables:
- group: AWS
stages:
- stage: Build
@subudear
subudear / azure-pipeline-artifactory-upload-download.yml
Created April 29, 2022 22:27
upload or download files to/from artifactory using azure devops
View azure-pipeline-artifactory-upload-download.yml
trigger:
- master
jobs:
- job: BuildAndTest
workspace:
clean: all
pool:
name: Self-Hosted-Agent
@subudear
subudear / gist:b70e1c60ca2b5d6698b3d454d3893812
Created April 2, 2022 07:53
jfrog to aws ecr image transfer
View gist:b70e1c60ca2b5d6698b3d454d3893812
trigger:
- main
variables:
- group: artifactory
- group: AWS
jobs:
- job: OnBuildHost
pool:
@subudear
subudear / JFrog-to-Azure-Container-Registry.yml
Created April 2, 2022 02:26
Transfer Docker image from JFrog to Azure Container Registry
View JFrog-to-Azure-Container-Registry.yml
trigger:
- main
variables:
- group: artifactory
jobs:
- job: OnBuildHost
pool:
name: Self-Hosted-Agent
@subudear
subudear / Push-Artifacts-to-AWS-S3-Bucket.yml
Created February 3, 2022 08:43
Yaml pipeline file to push artifacts to aws s3 bucket from azure devops
View Push-Artifacts-to-AWS-S3-Bucket.yml
trigger:
- master
pool:
name: Self-Hosted-Agent
variables:
- group: dev
steps:
@subudear
subudear / Azure_eventhubs_send_event_env.postman_environment.json
Created October 1, 2021 11:06
Environment for send event data to azure event hub
View Azure_eventhubs_send_event_env.postman_environment.json
{
"id": "c6969d10-9341-469e-b32d-e0eee838c786",
"name": "Azure_eventhubs_env",
"values": [
{
"key": "tenantid",
"value": "",
"enabled": true
},
{