Skip to content

Instantly share code, notes, and snippets.

View nidhi-canopas's full-sized avatar

nidhi-canopas

View GitHub Profile
{
"type": "service_account",
"project_id": "fir-realtime-db-demo-xxxxx",
"private_key_id": "9b40ce1e420b06c04b4c8e543bebbd43cd731a22",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIxxxxxxxxxxxxxxw0BAQEFAASCBKgwggSkAgEAAoIBAQDllkqdmGaEonsN\nSsACNopfNG92Ak548KEqDPzw+xxxxxxxxyRMj97Zzz50dY2cUXHmvCwFQhq3KRh7\n9VAFeNflKSmlhw5+ch8eiI1hfqiIpS6Vl+TwVcOSY7SJZaWP9WjCo1inKL6Ur829\nTrKw/54i7TAocaund54ZEFnlhbk0UTSdRwtfzUny5A35EvPXlJazjvkhB5VuB/+F\nxxxxx/ffFcbeqMBwi1Vb9hi1zT2BXV22NUmBxZyp6VQwVfl34XTEZBAutqnVinqz\nuCtkxo+RiZY5yG4csOIkVqsFJ7NYnZE6iwYc1cFtp5IKmP7TZEchyje4crtJUZTf\nC3jyAbrnAgMBAAECggEAXxDBaspNQQSKkXFvWjs9RrjOon3IApoZEfF410rPozAp\nXcbAZBd6vpPrF4wJjD3JPTKTw8WgjFEu+z0T2oA0XYaS4SCwZrlYm2sNp94raRGE\n3ZqcyMuqhLZWbkIxsQ98RoQe1HCxoZ2+QnIQ2euujmXKeCTBYEHOrDAyGTErBDcH\nC98ikFKq/pd6B8ZJ9PbCYIth8KgxQBk+TsY2zEMZN0zM+7fDuTEr914OstT6t6Bb\nAle5aXTYxZNHsTY2mR/4Zo88k4JazEZzQ26BHmi5vdcez6uJuqwoRru0jWAoneTi\nrsUKhajwuKK2nwn+t5m4PABy4hU2VlrJhwPr0o0diQKBgQD42EIP9f9d1JC4OJ3b\nJsQdytTEzcKziF12VAj4rPjGbnWMoIc/6UHO3DNSJyrd
ctx := context.Background()
// configure database URL
conf := &firebase.Config{
DatabaseURL: "https://fir-realtime-db-demo-xxxxx-default-rtdb.asia-southeast1.firebasedatabase.app",
}
// fetch service account key
opt := option.WithCredentialsFile("fir-realtime-db-demo-xxxxx-firebase-adminsdk-2zjoi-9b40ce1e42.json")
- aws cloudformation deploy --stack-name test-lambda-stack --template-file serverless_deployment.yml --parameter-overrides AwsRegion=aws_region AwsAccessKeyId=your_aws_access_key_id
AwsSecretAccessKey=your_aws_secret_access_key
LambdaBucket=lambda-test-bucket-006 LambdaUrl=test_lambda.zip
ApiGatewayStageName=prod --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM
- aws cloudformation validate-template --template-body file://serverless_deployment.yml
- aws configure set aws_access_key_id your_aws_acces_key_id
- aws configure set aws_secret_access_key your_aws_secret_access_key
- aws configure set region your_aws_region
- aws s3 cp test_lambda.zip s3://your_aws_bucket
Resources:
ApiGatewayCustomDomainMapping:
Type: AWS::ApiGateway::BasePathMapping
DependsOn:
- ApiGatewayDeployment
Properties:
DomainName: !Ref CustomDomainName
RestApiId: !Ref ApiGateway
Stage: !Ref ApiGatewayStageName
Resources:
LambdaApiGatewayInvoke:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName: !GetAtt LambdaFunction.Arn
Principal: apigateway.amazonaws.com
SourceArn: !Sub arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ApiGateway}/*/*/*
ApiGatewayDeployment:
Resources:
ApiGatewayResourceProxyMethod:
Type: AWS::ApiGateway::Method
DependsOn:
- ApiGatewayRootResource
Properties:
AuthorizationType: NONE
HttpMethod: ANY
Integration:
IntegrationHttpMethod: POST
Resources:
ApiGatewayRootResource:
Type: AWS::ApiGateway::Resource
DependsOn:
- ApiGatewayRootMethod
Properties:
RestApiId: !Ref ApiGateway
ParentId: !GetAtt ApiGateway.RootResourceId
PathPart: '{proxy+}'
Resources:
ApiGatewayRootMethod:
Type: AWS::ApiGateway::Method
Properties:
AuthorizationType: NONE
HttpMethod: ANY
Integration:
IntegrationHttpMethod: POST
Type: AWS_PROXY
Uri: !Sub