ised-isde-canada / cbmdsp-cp-sp-overall-architecture

1 stars 1 forks source link

Epic: Devops #5

Open obriensystems opened 3 years ago

obriensystems commented 3 years ago

Tickets for account/services creation tasks

Our repo modifications

obriensystems commented 3 years ago

biometric:cbmdsp-cp-sp-overall-architecture michaelobrien$ mkdir aws-sam biometric:cbmdsp-cp-sp-overall-architecture michaelobrien$ cd aws-sam/ biometric:aws-sam michaelobrien$ sam init Which template source would you like to use? 1 - AWS Quick Start Templates 2 - Custom Template Location Choice: 1 What package type would you like to use? 1 - Zip (artifact is a zip uploaded to S3)
2 - Image (artifact is an image uploaded to an ECR image repository) Package type: 1

Which runtime would you like to use? 1 - nodejs14.x 2 - python3.8 3 - ruby2.7 4 - go1.x 5 - java11 6 - dotnetcore3.1 7 - nodejs12.x 8 - nodejs10.x 9 - python3.7 10 - python3.6 11 - python2.7 12 - ruby2.5 13 - java8.al2 14 - java8 15 - dotnetcore2.1 Runtime: 5

Which dependency manager would you like to use? 1 - maven 2 - gradle Dependency manager: 1

Project name [sam-app]: sam-app

Cloning app templates from https://github.com/aws/aws-sam-cli-app-templates

AWS quick start application templates: 1 - Hello World Example: Maven 2 - EventBridge Hello World: Maven 3 - EventBridge App from scratch (100+ Event Schemas): Maven 4 - Step Functions Sample App (Stock Trader): Maven Template selection: 1

-----------------------
Generating application:
-----------------------
Name: sam-app
Runtime: java11
Dependency Manager: maven
Application Template: hello-world
Output Directory: .

Next steps can be found in the README file at ./sam-app/README.md

SAM CLI update available (1.26.0); (1.23.0 installed) To download: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html biometric:aws-sam michaelobrien$ ls sam-app biometric:aws-sam michaelobrien$ ls HelloWorldFunction README.md events sam-app template.yaml biometric:aws-sam michaelobrien$ sam build Building codeuri: /Users/michaelobrien/wse_github/ised-isde-canada/cbmdsp-cp-sp-overall-architecture/aws-sam/HelloWorldFunction runtime: java11 metadata: {} functions: ['HelloWorldFunction'] Running JavaMavenWorkflow:CopySource Running JavaMavenWorkflow:MavenBuild Running JavaMavenWorkflow:MavenCopyDependency Running JavaMavenWorkflow:MavenCopyArtifacts

Build Succeeded

Built Artifacts : .aws-sam/build Built Template : .aws-sam/build/template.yaml

Commands you can use next

[] Invoke Function: sam local invoke [] Deploy: sam deploy --guided

biometric:aws-sam michaelobrien$ sam deploy --guided

Configuring SAM deploy

Looking for config file [samconfig.toml] :  Not found

Setting default arguments for 'sam deploy'
=========================================
Stack Name [sam-app]: sam-app-sp
AWS Region [us-east-1]: ca-central-1
#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
Confirm changes before deploy [y/N]: y
#SAM needs permission to be able to create roles to connect to the resources in your template
Allow SAM CLI IAM role creation [Y/n]: y
HelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y
Save arguments to configuration file [Y/n]: y
SAM configuration file [samconfig.toml]: 
SAM configuration environment [default]: 

Looking for resources needed for deployment: Not found.
Creating the required resources...
Successfully created!

    Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-vbqhref6p1rt
    A different default S3 bucket can be set in samconfig.toml

Saved arguments to config file
Running 'sam deploy' for future deployments will use the parameters saved above.
The above parameters can be changed by modifying samconfig.toml
Learn more about samconfig.toml syntax at 
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html

Uploading to sam-app-sp/885aa19594c60b530eb8faed9cf04479 732744 / 732744 (100.00%)

Deploying with following values
===============================
Stack name                   : sam-app-sp
Region                       : ca-central-1
Confirm changeset            : True
Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-vbqhref6p1rt
Capabilities                 : ["CAPABILITY_IAM"]
Parameter overrides          : {}
Signing Profiles             : {}

Initiating deployment

Uploading to sam-app-sp/d439400f2620545bb5004d69085181e6.template 1185 / 1185 (100.00%)

Waiting for changeset to be created..

CloudFormation stack changeset

Operation LogicalResourceId ResourceType Replacement

Changeset created successfully. arn:aws:cloudformation:ca-central-1:45....00:changeSet/samcli-deploy1626364514/2860aa23-ce99-431b-acd8-b5d1c0dd479d

Previewing CloudFormation changeset before deployment

Deploy this changeset? [y/N]: y

2021-07-15 12:06:49 - Waiting for stack create/update to complete

CloudFormation events from changeset

ResourceStatus ResourceType LogicalResourceId ResourceStatusReason

CREATE_IN_PROGRESS AWS::IAM::Role HelloWorldFunctionRole Resource creation Initiated
CREATE_IN_PROGRESS AWS::IAM::Role HelloWorldFunctionRole -
CREATE_COMPLETE AWS::IAM::Role HelloWorldFunctionRole -
CREATE_IN_PROGRESS AWS::Lambda::Function HelloWorldFunction -
CREATE_IN_PROGRESS AWS::Lambda::Function HelloWorldFunction Resource creation Initiated
CREATE_COMPLETE AWS::Lambda::Function HelloWorldFunction -
CREATE_IN_PROGRESS AWS::ApiGateway::RestApi ServerlessRestApi -
CREATE_IN_PROGRESS AWS::ApiGateway::RestApi ServerlessRestApi Resource creation Initiated
CREATE_COMPLETE AWS::ApiGateway::RestApi ServerlessRestApi -
CREATE_IN_PROGRESS AWS::Lambda::Permission HelloWorldFunctionHelloWorldPermissionProd -
CREATE_IN_PROGRESS AWS::ApiGateway::Deployment ServerlessRestApiDeployment47fc2d5f9d -
CREATE_IN_PROGRESS AWS::ApiGateway::Deployment ServerlessRestApiDeployment47fc2d5f9d Resource creation Initiated
CREATE_IN_PROGRESS AWS::Lambda::Permission HelloWorldFunctionHelloWorldPermissionProd Resource creation Initiated
CREATE_COMPLETE AWS::ApiGateway::Deployment ServerlessRestApiDeployment47fc2d5f9d -
CREATE_IN_PROGRESS AWS::ApiGateway::Stage ServerlessRestApiProdStage -
CREATE_IN_PROGRESS AWS::ApiGateway::Stage ServerlessRestApiProdStage Resource creation Initiated
CREATE_COMPLETE AWS::ApiGateway::Stage ServerlessRestApiProdStage -
CREATE_COMPLETE AWS::Lambda::Permission HelloWorldFunctionHelloWorldPermissionProd -
CREATE_COMPLETE AWS::CloudFormation::Stack sam-app-sp -

CloudFormation outputs from deployed stack

Outputs

Key HelloWorldFunctionIamRole
Description Implicit IAM Role created for Hello World function
Value arn:aws:iam::453...0:role/sam-app-sp-HelloWorldFunctionRole-3T890NH0IXNI

Key HelloWorldApi
Description API Gateway endpoint URL for Prod stage for Hello World function
Value https://bwpacrgto3.execute-api.ca-central-1.amazonaws.com/Prod/hello/

Key HelloWorldFunction
Description Hello World Lambda Function ARN
Value arn:aws:lambda:ca-central-1:45...00:function:sam-app-sp-HelloWorldFunction-jCMIpwPwu5T5

Successfully created/updated stack - sam-app-sp in ca-central-1

biometric:aws-sam michaelobrien$ git status On branch master Your branch is up to date with 'origin/master'.

Untracked files: (use "git add ..." to include in what will be committed) samconfig.toml

nothing added to commit but untracked files present (use "git add" to track) biometric:aws-sam michaelobrien$ cat samconfig.toml version = 0.1 [default] [default.deploy] [default.deploy.parameters] stack_name = "sam-app-sp" s3_bucket = "aws-sam-cli-managed-default-samclisourcebucket-vbqhref6p1rt" s3_prefix = "sam-app-sp" region = "ca-central-1" confirm_changeset = true capabilities = "CAPABILITY_IAM" biometric:aws-sam michaelobrien$ aws lambda list-functions --region ca-central-1 { "Functions": [ { "FunctionName": "sam-app-sp-HelloWorldFunction-jCMIpwPwu5T5", "FunctionArn": "arn:aws:lambda:ca-central-1:45....0:function:sam-app-sp-HelloWorldFunction-jCMIpwPwu5T5", "Runtime": "java11", "Role": "arn:aws:iam::453....0:role/sam-app-sp-HelloWorldFunctionRole-3T890NH0IXNI", "Handler": "helloworld.App::handleRequest", "CodeSize": 732744, "Description": "", "Timeout": 20, "MemorySize": 512, "LastModified": "2021-07-15T16:07:31.030+0000", "CodeSha256": "m2p9elG27y473HcMfvsj2K4WmY1DCtGm/pnLI1ODRt0=", "Version": "$LATEST", "Environment": { "Variables": { "PARAM1": "VALUE" } }, "TracingConfig": { "Mode": "PassThrough" }, "RevisionId": "a9c396a7-0c5c-450b-a40e-12f071fdb60d", "PackageType": "Zip" } ] } biometric:aws-sam michaelobrien$ aws apigatewayv2 get-apis { "Items": [ { "ApiEndpoint": "https://fxfqqwqngj.execute-api.us-east-1.amazonaws.com", "ApiId": "fxfqqwqngj", "ApiKeySelectionExpression": "$request.header.x-api-key", "CorsConfiguration": { "AllowCredentials": false, "AllowMethods": [ "GET" ], "MaxAge": 0 }, "CreatedDate": "2020-02-20T02:57:37+00:00", "DisableExecuteApiEndpoint": false, "Name": "obriencloud-com", "ProtocolType": "HTTP", "RouteSelectionExpression": "$request.method $request.path", "Tags": {} }, { "ApiEndpoint": "https://juursjt8i2.execute-api.us-east-1.amazonaws.com", "ApiId": "juursjt8i2", "ApiKeySelectionExpression": "$request.header.x-api-key", "CreatedDate": "2020-02-20T02:47:11+00:00", "DisableExecuteApiEndpoint": false, "Name": "obrien-labs.com", "ProtocolType": "HTTP", "RouteSelectionExpression": "$request.method $request.path", "Tags": {} } ] }