kandi background
Explore Kits

SSM | build SSM | Messaging library

ย by ย  crossoverJie Java Version: 2.5.0 License: GPL-2.0

ย by ย  crossoverJie Java Version: 2.5.0 License: GPL-2.0

Download this library from

kandi X-RAY | SSM Summary

SSM is a Java library typically used in Messaging, Spring applications. SSM has no bugs, it has no vulnerabilities, it has build file available, it has a Strong Copyleft License and it has medium support. You can download it from GitHub.
I'll update some skills in actual development aperiodically.There are no complicated operation flows or xxx system,just some practical shares about skills.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • SSM has a medium active ecosystem.
  • It has 3372 star(s) with 1362 fork(s). There are 272 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 5 open issues and 28 have been closed. On average issues are closed in 4 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of SSM is 2.5.0
SSM Support
Best in #Messaging
Average in #Messaging
SSM Support
Best in #Messaging
Average in #Messaging

quality kandi Quality

  • SSM has 0 bugs and 0 code smells.
SSM Quality
Best in #Messaging
Average in #Messaging
SSM Quality
Best in #Messaging
Average in #Messaging

securitySecurity

  • SSM has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • SSM code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
SSM Security
Best in #Messaging
Average in #Messaging
SSM Security
Best in #Messaging
Average in #Messaging

license License

  • SSM is licensed under the GPL-2.0 License. This license is Strong Copyleft.
  • Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
SSM License
Best in #Messaging
Average in #Messaging
SSM License
Best in #Messaging
Average in #Messaging

buildReuse

  • SSM releases are available to install and integrate.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • SSM saves you 9018 person hours of effort in developing the same functionality from scratch.
  • It has 18454 lines of code, 1319 functions and 274 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
SSM Reuse
Best in #Messaging
Average in #Messaging
SSM Reuse
Best in #Messaging
Average in #Messaging
Top functions reviewed by kandi - BETA

kandi has reviewed SSM and discovered the below as its top functions. This is intended to give you an instant insight into SSM implemented functionality, and help decide if they suit your requirements.

  • Search for blog
  • Invoke Redis cache .
  • The consumer method .
  • generate pagination url .
  • Sets log value model to model .
  • performs a search query
  • Gets the value of an extension property .
  • Gets url .
  • generate up and down page code
  • Add page interceptor .

SSM Key Features

:two_hearts: build SSM from 0 ๐Ÿ‘‰๐Ÿฝ๐Ÿ‘‰๐Ÿฝ distributed micro service.

Directory Structure

copy iconCopydownload iconDownload
โ”œโ”€โ”€ SSM-API                                    // common API  
โ”‚   โ”œโ”€โ”€ src/main
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€java/com/crossoverJie               // specific codeใ€‚  
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€resources
โ”œโ”€โ”€ SSM-BOOT                                   // Available for internal use of dubbo dependencies 
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€resources/spring                    // dubbo consumer configuration
โ”œโ”€โ”€ SSM-SECONDS-KILL                           // seckill module
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€SSM-SECONDS-KILL-API                // seckill open api
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€SSM-SECONDS-KILL-ORDER-CONSUMER     // Kafka consumer module
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€SSM-SECONDS-KILL-SERVICE            // service module
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€SSM-SECONDS-KILL-WEB                // web module
โ”œโ”€โ”€ SSM-SERVICE                                // The service implementation of the dubbo application 
โ”‚   โ”œโ”€โ”€ src/main
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€java/com/crossoverJie/api           // specific code
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€controller                       // Heartbeat detection interface
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€dubbo                            // Dubbo related code
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€โ”œโ”€โ”€dao                           // dao package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€โ”œโ”€โ”€pojo                          // pojo package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€โ”œโ”€โ”€service                       // service package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€โ”œโ”€โ”€util                          // Toolkit
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€impl                             // implement dubbo API
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€resources                           // configuration file
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€mapping                          // *.mapper configuration file
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€spring                           // Spring related configuration file
โ”œโ”€โ”€ SSM-WEB                                    // web application
โ”‚   โ”œโ”€โ”€ src/main
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€java/com/crossoverJie               // specific code
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€controller                       // controller package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€cxf                              // CXF related code
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€dao                              // dao package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€enums                            // enum package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€intercept                        // Interceptor
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€kafka                            // Kafka
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€โ”œโ”€โ”€official                      // Official consumption
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€โ”œโ”€โ”€optimization                  // Multi-threaded consumption
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€lucene                           // Lucene related code
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€pojo                             // pojo package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€req                              // request package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€res                              // response package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€service                          // service pachage
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€shiro                            // shiro related code
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€util                             // Toolkit
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€vo                               // vo package
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€resources
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€โ”œโ”€โ”€mapping                          // *.mapper configuration file
โ”‚   โ”œโ”€โ”€ โ”œโ”€โ”€webapp                              // front code
โ”œโ”€โ”€ doc
โ”‚   โ”œโ”€โ”€lucene                                  // lucene related code
โ”‚   โ”œโ”€โ”€sql                                     // sql scripts
โ”œโ”€โ”€ .gitignore                                 // gitignore 
โ”œโ”€โ”€ pom.xml                                    // parent pom
โ”œโ”€โ”€ LICENSE               
โ”œโ”€โ”€ README.md               

Partial Screenshots

copy iconCopydownload iconDownload
2017-04-25 15:15:38,968 DEBUG [com.alibaba.dubbo.remoting.transport.DecodeHandler] -  [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation, dubbo version: 2.5.3, current host: 127.0.0.1
2017-04-25 15:15:39,484 DEBUG [com.crossoverJie.dubbo.filter.DubboTraceFilter] - dubbo่ฏทๆฑ‚ๆ•ฐๆฎ:{"args":[1],"interfaceName":"com.crossoverJie.api.UserInfoApi","methodName":"getUserInfo"}
2017-04-25 15:15:39,484 INFO [com.crossoverJie.api.impl.UserInfoApiImpl] - ็”จๆˆทๆŸฅ่ฏขId=1
2017-04-25 15:15:39,505 DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
2017-04-25 15:15:39,525 DEBUG [org.mybatis.spring.SqlSessionUtils] - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6f56b29] was not registered for synchronization because synchronization is not active
2017-04-25 15:15:39,549 DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@778b3121] will not be managed by Spring
2017-04-25 15:15:39,555 DEBUG [com.crossoverJie.api.dubbo.dao.T_userDao.selectByPrimaryKey] - ==>  Preparing: select id, username, password,roleId from t_user where id = ? 
2017-04-25 15:15:39,591 DEBUG [com.crossoverJie.api.dubbo.dao.T_userDao.selectByPrimaryKey] - ==> Parameters: 1(Integer)
2017-04-25 15:15:39,616 DEBUG [com.crossoverJie.api.dubbo.dao.T_userDao.selectByPrimaryKey] - <==      Total: 1
2017-04-25 15:15:39,616 DEBUG [com.alibaba.druid.pool.PreparedStatementPool] - {conn-10003, pstmt-20000} enter cache
2017-04-25 15:15:39,617 DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6f56b29]
2017-04-25 15:15:45,473 INFO [com.crossoverJie.dubbo.filter.DubboTraceFilter] - dubboๆ‰ง่กŒๆˆๅŠŸ
2017-04-25 15:15:45,476 DEBUG [com.crossoverJie.dubbo.filter.DubboTraceFilter] - dubbo่ฟ”ๅ›žๆ•ฐๆฎ{"args":[{"id":1,"password":"123456","roleId":1,"userName":"crossoverJie"}],"interfaceName":"com.crossoverJie.api.UserInfoApi","methodName":"getUserInfo"}

Function throwing an error "Syntax error: "}" unexpected" in shell script

copy iconCopydownload iconDownload
IDLE = /etc/npsrv.conf
IDLE=/etc/npsrv.conf
#! bin/env sh
-----------------------
IDLE = /etc/npsrv.conf
IDLE=/etc/npsrv.conf
#! bin/env sh
-----------------------
IDLE = /etc/npsrv.conf
IDLE=/etc/npsrv.conf
#! bin/env sh

Terraform AWS Provider Error: Value for unconfigurable attribute. Can't configure a value for "acl": its value will be decided automatically

copy iconCopydownload iconDownload
resource "aws_s3_bucket" "this" {
  bucket = "${var.project}-${var.environment}-ssm-parameter-store-backups-bucket"

  tags = {
    Name        = "${var.project}-${var.environment}-ssm-parameter-store-backups-bucket"
    Environment = var.environment
  }
}

resource "aws_s3_bucket_acl" "this" {
  bucket = aws_s3_bucket.this.id
  acl    = "private"
}

resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
  bucket = aws_s3_bucket.this.id

  rule {
    apply_server_side_encryption_by_default {
      kms_master_key_id = data.aws_kms_key.s3.arn
      sse_algorithm     = "aws:kms"
    }
  }
}

resource "aws_s3_bucket_lifecycle_configuration" "this" {
  bucket = aws_s3_bucket.this.id

  rule {
    id     = "backups"
    status = "Enabled"

    filter {
      prefix = "backups/"
    }

    transition {
      days          = 90
      storage_class = "GLACIER_IR"
    }

    transition {
      days          = 180
      storage_class = "DEEP_ARCHIVE"
    }

    expiration {
      days = 365
    }
  }
}
terraform {
  required_version = "~> 1.0.11"
  required_providers {
    aws  = "~> 3.73.0"
  }
}
-----------------------
resource "aws_s3_bucket" "this" {
  bucket = "${var.project}-${var.environment}-ssm-parameter-store-backups-bucket"

  tags = {
    Name        = "${var.project}-${var.environment}-ssm-parameter-store-backups-bucket"
    Environment = var.environment
  }
}

resource "aws_s3_bucket_acl" "this" {
  bucket = aws_s3_bucket.this.id
  acl    = "private"
}

resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
  bucket = aws_s3_bucket.this.id

  rule {
    apply_server_side_encryption_by_default {
      kms_master_key_id = data.aws_kms_key.s3.arn
      sse_algorithm     = "aws:kms"
    }
  }
}

resource "aws_s3_bucket_lifecycle_configuration" "this" {
  bucket = aws_s3_bucket.this.id

  rule {
    id     = "backups"
    status = "Enabled"

    filter {
      prefix = "backups/"
    }

    transition {
      days          = 90
      storage_class = "GLACIER_IR"
    }

    transition {
      days          = 180
      storage_class = "DEEP_ARCHIVE"
    }

    expiration {
      days = 365
    }
  }
}
terraform {
  required_version = "~> 1.0.11"
  required_providers {
    aws  = "~> 3.73.0"
  }
}
-----------------------
terraform {

  required_version = "~> 0.12.31"

  required_providers {
    aws  = "~> 3.74.1"
  }
}
-----------------------
generate "versions" {
    path      = "versions_override.tf"
    if_exists = "overwrite_terragrunt"
    contents  = <<EOF
    terraform {
        required_providers {
        aws = {
            version = "= 3.74.1"
            source = "hashicorp/aws"
        }
        }
    }
EOF
}
-----------------------
terraform {
   required_providers {    
    aws = {
         source = "hashicorp/aws"
         version =  "~> 3.74.2"
    }
    consul = {
      source = "hashicorp/consul"
    }
  }
  required_version = ">= 0.13"
}

Augmenting moto with mock patch where method is not yet implemented

copy iconCopydownload iconDownload
with mock.patch.object(
    c.logs,
    'create_export_task',
    return_value={"taskId": "I am mocked via mock.Mock"}
):
    c.create_export_tasks(
        "/log-exporter-last-export/first", fromTime, toTime, "s3_bucket", 123412341234
    )
    assert c.logs.create_export_task.called
def test_create_export_tasks(mocker):
    ...
    mocker.patch.object(
        c.logs,
        'create_export_task',
        return_value={"taskId": "I am mocked via mock.Mock"}
    )
    c.create_export_tasks(
        "/log-exporter-last-export/first", fromTime, toTime, "s3_bucket", 123412341234
    )
    assert c.logs.create_export_task.called
-----------------------
with mock.patch.object(
    c.logs,
    'create_export_task',
    return_value={"taskId": "I am mocked via mock.Mock"}
):
    c.create_export_tasks(
        "/log-exporter-last-export/first", fromTime, toTime, "s3_bucket", 123412341234
    )
    assert c.logs.create_export_task.called
def test_create_export_tasks(mocker):
    ...
    mocker.patch.object(
        c.logs,
        'create_export_task',
        return_value={"taskId": "I am mocked via mock.Mock"}
    )
    c.create_export_tasks(
        "/log-exporter-last-export/first", fromTime, toTime, "s3_bucket", 123412341234
    )
    assert c.logs.create_export_task.called

Eventbridge bus: can't receive messages on custom event bus?

copy iconCopydownload iconDownload
    "source": [
      "myapp.test"
    ]

How can I get output from boto3 ecs execute_command?

copy iconCopydownload iconDownload
import json
import uuid

import boto3
import construct as c
import websocket

ecs = boto3.client("ecs")
ssm = boto3.client("ssm")
exec_resp = ecs.execute_command(
    cluster=self.cluster,
    task=self.task,
    container=self.container,
    interactive=True,
    command="ls -la /",
)

session = exec_resp['session']
connection = websocket.create_connection(session['streamUrl'])
try:
    init_payload = {
        "MessageSchemaVersion": "1.0",
        "RequestId": str(uuid.uuid4()),
        "TokenValue": session['tokenValue']
    }
    connection.send(json.dumps(init_payload))

    AgentMessageHeader = c.Struct(
        'HeaderLength' / c.Int32ub,
        'MessageType' / c.PaddedString(32, 'ascii'),
    )

    AgentMessagePayload = c.Struct(
        'PayloadLength' / c.Int32ub,
        'Payload' / c.PaddedString(c.this.PayloadLength, 'ascii')
    )

    while True:
        response = connection.recv()

        message = AgentMessageHeader.parse(response)

        if 'channel_closed' in message.MessageType:
            raise Exception('Channel closed before command output was received')

        if 'output_stream_data' in message.MessageType:
            break

finally:
    connection.close()

payload_message = AgentMessagePayload.parse(response[message.HeaderLength:])

print(payload_message.Payload)

Can you pass a parameter into a bash script in Cloudformation?

copy iconCopydownload iconDownload
Parameters:
  BucketName:
    Type: String

Resources:  
  rRunLambdaLayerScript:
    Type: AWS::SSM::Association
    Properties:
      Name: AWS-RunShellScript
      WaitForSuccessTimeoutSeconds: 300
      Targets:
      - Key: tag:Lambda
        Values:
        - layer
      Parameters:
        commands:
            - !Sub |
                #!/usr/bin/env bash

                mkdir lambda_layer
                cd lambda_layer/
                mkdir python
                cd python/
                pip3 install boto3 -t ./
                cd ..
                zip -r /tmp/lambda_layer.zip .
                aws s3 cp /tmp/lambda_layer.zip s3://${BucketName}

Is there a way to iterate over all CfnResources in a CfnInclude?

copy iconCopydownload iconDownload
List<IConstruct> roles = include.getNode()
        .findAll()
        .stream().filter(n -> n instanceof CfnRole)
        .collect(Collectors.toList())

Package built by Poetry is missing runtime dependencies

copy iconCopydownload iconDownload
[tool.poetry.dependencies]
โ€ฆ
awscli = {version = "*", optional = true}
boto3 = "*"
โ€ฆ
typer = "*"
โ€ฆ
[tool.poetry.extras]
โ€ฆ
cli = [
    "boto3",
    "typer",
]
โ€ฆ
Requires-Dist: typer; extra == "cli"
-----------------------
[tool.poetry.dependencies]
โ€ฆ
awscli = {version = "*", optional = true}
boto3 = "*"
โ€ฆ
typer = "*"
โ€ฆ
[tool.poetry.extras]
โ€ฆ
cli = [
    "boto3",
    "typer",
]
โ€ฆ
Requires-Dist: typer; extra == "cli"
-----------------------
[tool.poetry.dependencies]
โ€ฆ
awscli = {version = "*", optional = true}
boto3 = "*"
โ€ฆ
typer = "*"
โ€ฆ
[tool.poetry.extras]
โ€ฆ
cli = [
    "boto3",
    "typer",
]
โ€ฆ
Requires-Dist: typer; extra == "cli"

How to pass AssumeRole and associate SSM Document with EC2 using Terraform

copy iconCopydownload iconDownload
{
    "description": "Launch Automation for RedHat Linux instance",
    "schemaVersion": "0.3",
    "assumeRole": "{{AutomationAssumeRole}}",    
    "parameters": {
        "instanceIds": {
            "type": "StringList",
            "description": "InstanceIds to run launch setup"
        },
        "AutomationAssumeRole": {
          "default": "",
          "type": "String",
          "description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf."
        }        
    },
resource "aws_iam_role" "ssm" {
  path               = "/"
  assume_role_policy = <<EOL
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": ["ec2.amazonaws.com", "ssm.amazonaws.com"]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
EOL

  managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AmazonSSMAutomationRole"]

  inline_policy {
    name = "my_inline_policy"

    policy = jsonencode({
      Version = "2012-10-17"
      Statement = [
        {
          Action   = ["iam:PassRole"]
          Effect   = "Allow"
          Resource = "*"
        },
      ]
    })
  }

}
resource "aws_ssm_association" "rhel" {

  name = aws_ssm_document.rhel_domain_join_document.name
  
  parameters = {
      AutomationAssumeRole = aws_iam_role.ssm.arn
      instanceIds = aws_instance.rhel.id
  }  
}
-----------------------
{
    "description": "Launch Automation for RedHat Linux instance",
    "schemaVersion": "0.3",
    "assumeRole": "{{AutomationAssumeRole}}",    
    "parameters": {
        "instanceIds": {
            "type": "StringList",
            "description": "InstanceIds to run launch setup"
        },
        "AutomationAssumeRole": {
          "default": "",
          "type": "String",
          "description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf."
        }        
    },
resource "aws_iam_role" "ssm" {
  path               = "/"
  assume_role_policy = <<EOL
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": ["ec2.amazonaws.com", "ssm.amazonaws.com"]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
EOL

  managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AmazonSSMAutomationRole"]

  inline_policy {
    name = "my_inline_policy"

    policy = jsonencode({
      Version = "2012-10-17"
      Statement = [
        {
          Action   = ["iam:PassRole"]
          Effect   = "Allow"
          Resource = "*"
        },
      ]
    })
  }

}
resource "aws_ssm_association" "rhel" {

  name = aws_ssm_document.rhel_domain_join_document.name
  
  parameters = {
      AutomationAssumeRole = aws_iam_role.ssm.arn
      instanceIds = aws_instance.rhel.id
  }  
}
-----------------------
{
    "description": "Launch Automation for RedHat Linux instance",
    "schemaVersion": "0.3",
    "assumeRole": "{{AutomationAssumeRole}}",    
    "parameters": {
        "instanceIds": {
            "type": "StringList",
            "description": "InstanceIds to run launch setup"
        },
        "AutomationAssumeRole": {
          "default": "",
          "type": "String",
          "description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf."
        }        
    },
resource "aws_iam_role" "ssm" {
  path               = "/"
  assume_role_policy = <<EOL
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": ["ec2.amazonaws.com", "ssm.amazonaws.com"]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
EOL

  managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AmazonSSMAutomationRole"]

  inline_policy {
    name = "my_inline_policy"

    policy = jsonencode({
      Version = "2012-10-17"
      Statement = [
        {
          Action   = ["iam:PassRole"]
          Effect   = "Allow"
          Resource = "*"
        },
      ]
    })
  }

}
resource "aws_ssm_association" "rhel" {

  name = aws_ssm_document.rhel_domain_join_document.name
  
  parameters = {
      AutomationAssumeRole = aws_iam_role.ssm.arn
      instanceIds = aws_instance.rhel.id
  }  
}

AWS AppSync Lambda Authorizer

copy iconCopydownload iconDownload
LambdaPermission:
    Type: AWS::Lambda::Permission
    Properties:
      FunctionName: !GetAtt PPSAuthorizationFunction.Arn 
      Action: lambda: InvokeFunction # <--
      Principal: appsync.amazonaws.com

Community Discussions

Trending Discussions on SSM
  • Function throwing an error &quot;Syntax error: &quot;}&quot; unexpected&quot; in shell script
  • Can't write to bind mount on ECS Fragate when using non-root user
  • Terraform AWS Provider Error: Value for unconfigurable attribute. Can't configure a value for &quot;acl&quot;: its value will be decided automatically
  • Augmenting moto with mock patch where method is not yet implemented
  • Eventbridge bus: can't receive messages on custom event bus?
  • How can I get output from boto3 ecs execute_command?
  • Log4j2 deadlock
  • Can you pass a parameter into a bash script in Cloudformation?
  • Store tenant preferences in a multi-tenant app in DynmoDB or SSM
  • Is there a way to iterate over all CfnResources in a CfnInclude?
Trending Discussions on SSM

QUESTION

Function throwing an error &quot;Syntax error: &quot;}&quot; unexpected&quot; in shell script

Asked 2022-Mar-10 at 04:14
#! bin/env sh
function idle_tm_ubu {
    sudo apt remove npsrv
    sudo rm -rf /etc/npsrv.conf
    sudo rm -rf /var/log/npsrv.log
    IDLE = /etc/npsrv.conf
    if [ ! -f "$IDLE" ]; then
        echo "Idle time out has been removed."
    else
        echo "Idle time out has not been removed"
    fi
 }

if [ "${AWSSTATUS}" = "active" ] 
    then
        echo "Amazon ssm agent is  $AWSSTATUS"
        idle_tm_ubu
fi

When I execute this I get the error

Syntax error: "}" unexpected

How do I solve this?

ANSWER

Answered 2022-Mar-10 at 04:14

You have a few simple errors you need to correct. To begin

IDLE = /etc/npsrv.conf

should be

IDLE=/etc/npsrv.conf

No spaces are allowed around = when used for assignment.

Always paste your script into ShellCheck to find errors and warnings. Then fix them.

Note the 'function' keyword is non-standard. Use 'foo()' instead of 'function foo'.

Also ensure the path to your interpreter

#! bin/env sh

is an ABSOLUTE path. bin/env is a RELATIVE path, did you mean /bin/env?

Source https://stackoverflow.com/questions/71418594

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install SSM

Import SQL Script

Support

crossoverJie@gmail.com

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Compare Messaging Libraries with Highest Support
Compare Messaging Libraries with Highest Security
Compare Messaging Libraries with Permissive License
Compare Messaging Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • ยฉ 2022 Open Weaver Inc.
  • ยฉ 2022 Open Weaver Inc.