'Cloud&Container/AWS'에 해당되는 글 12건

  1. 2021.01.28 [AWS] RBAC for Application 을 위한 참고 문서
  2. 2020.07.20 [AWS] Java SDK 2.x 사용 - build.gradle
  3. 2020.07.13 [AWS] DescribeInstanceTypes from Java
  4. 2020.03.26 [AWS] Spring Cloud Config S3 Backend 사용하기
  5. 2020.03.23 [AWS] IGW vs NAT GW
  6. 2020.03.16 [AWS] EC2 인스턴스 백업 하기
  7. 2020.03.13 [AWS] aws cli 사용 시 --query 알아보기
  8. 2020.03.13 [AWS] aws iot/iot-data 등등
  9. 2020.03.12 [AWS] 아마존 리눅스 & 우분투 타임존 변경
  10. 2020.03.04 [AWS] ..user is not authorized to perform: iam:PassRole on resource.. 에러 시

[AWS] RBAC for Application 을 위한 참고 문서

Cloud&Container/AWS 2021. 1. 28. 11:29

https://musma.github.io/2019/11/05/about-aws-iam-policy.html
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/ec2-iam-roles.html
https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html

 

위 문서를 보고 IAM 을 이해 하고 AWS Resources 에 RBAC 적용 하는 방법에 대해서 익히면 됩니다.

 

:

[AWS] Java SDK 2.x 사용 - build.gradle

Cloud&Container/AWS 2020. 7. 20. 08:58

1.x 와는 많이 바뀌었습니다.

확인 하고 변경 하세요.

 

implementation platform('software.amazon.awssdk:bom:2.13.55')
// aws sdk
compile 'software.amazon.awssdk:sdk-core'
compile 'software.amazon.awssdk:ec2'
compile 'software.amazon.awssdk:s3'
compile 'software.amazon.awssdk:sqs'

:

[AWS] DescribeInstanceTypes from Java

Cloud&Container/AWS 2020. 7. 13. 18:06

본 API 가 삭제 되었기 때문에 그냥 아래와 같이 단순하게 구성해 보았습니다.

 

@Service
@Log4j2
@RequiredArgsConstructor
public class Ec2Service {

  public ResponseEntity<String> describeInstanceTypes() {
    ProcessBuilder builder = new ProcessBuilder();
    String instances = "{}";

    try {
      builder.command("bash", "-c", "aws ec2 describe-instance-types");
      Process process = builder.start();

      instances = new BufferedReader(
        new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8)).lines()
        .collect(Collectors.joining("\n"));

      int exitCode = process.waitFor();

      JSONObject jsonObject = new JSONObject(instances);
      JSONArray jsonArray = jsonObject.getJSONArray("InstanceTypes");
      JSONArray sortedJsonArray = new JSONArray();
      List list = new ArrayList();

      for(int i = 0; i < jsonArray.length(); i++) {
        list.add(jsonArray.getJSONObject(i));
      }

      Collections.sort(list, new Comparator<JSONObject>() {

        @Override
        public int compare(JSONObject a, JSONObject b) {
          String source = new String();
          String target = new String();

          try {
            source = (String)a.get("InstanceType");
            target = (String)b.get("InstanceType");
          } catch(Exception e) {
          }

          return source.compareTo(target);
        }
      });

      for(int i = 0; i < jsonArray.length(); i++) {
        sortedJsonArray.put(list.get(i));
      }

      instances = "{\"InstanceTypes\": " +sortedJsonArray.toString()+ "}";
    } catch(Exception e) {
      e.printStackTrace();
    }

    return ResponseEntity.ok(instances);
  }
}

 

코드 자체는 AWS CLI 를 ProcessBuilder 를 이용해서 외부 파일을 실행 시켜 데이터를 받아와서 처리 하는 내용입니다.

AWS CLI 로 데이터를 가져 오게 되면 정렬이 안된 상태로 데이터가 넘어 와서 별도 sort 기능 구현이 필요 합니다.

그냥 CLI 에서도 JSON Sort 옵션 하나 넣어 주면 좋았을 걸 아쉽더라고요.

 

근데 왜 이 API 를 없앴는지 차암....

 

1.x 에서 삭제 되어서 2.x 로 변경해서 사용 하시면 됩니다.

    Ec2Client ec2Client = Ec2Client.builder().build();
    DescribeInstanceTypesRequest request = DescribeInstanceTypesRequest.builder()
      .maxResults(100)
      .build();

    DescribeInstanceTypesResponse response = ec2Client.describeInstanceTypes(request);
    log.debug("{}", response.instanceTypes());

한번에 100개 씩 밖에 못 가져 오기 때문에 nextToken 으로 끝까지 요청 하셔야 합니다.

:

[AWS] Spring Cloud Config S3 Backend 사용하기

Cloud&Container/AWS 2020. 3. 26. 10:57

Spring Cloud Config Server 설정)

 

[S3 설정]
- S3 버킷 생성
- 접근권한 부여

[ConfigApplication.java]

@SpringBootApplication
@EnableConfigServer
public class ConfigApplication {
  public static void main(String[] args) {
	SpringApplication.run(ConfigApplication.class, args);
  }
}


[build.gradle]

compile 'com.amazonaws:aws-java-sdk-s3'


[application.yml]

server:
port: 8888

spring:
  profiles:
    active: awss3
  cloud:
    config:
      server:
        awss3:
          region: ap-northeast-2
          bucket: s3config


[Config Server 접근 URL]

http://localhost:8888/${S3-FILE-NAME}/${PROFILE-NAME}

- 생성한 버킷 하위로 설정 파일 목록이 존재 해야 합니다.
- ${S3-FILE-NAME} 는 생성한 Bucket 아래 만든 설정 파일명 입니다.
- backoffice
- ${PROFILE-NAME} 은 설정 파일에 대한 프로필명 입니다.
- app1, app2

예제)
Config Server URL : 
http://localhost:8888/backoffice/app1

S3 :
megatoidiscons3config/backoffice-app1.yml
or
megatoidiscons3config/backoffice-app1.properties


[backoffice-app1.yml]

project.app1="backoffice-app1"


[backoffice-app2.yml]

project.app2="backoffice-app2"

 

Spring Cloud Config Client 설정)

[application.yml]

spring:
  cloud:
    config:
      name: backoffice
      uri: http://localhost:8888
      profile: app1,app2


[HelloController.java]

@RestController
public class HelloController {

  @Value ("${project.app1}")
  String projectApp1;

  @Value ("${project.app2}")
  String projectApp2;

  @RequestMapping("/app1")
  public String helloApp1() {
    return projectApp1;
  }

  @RequestMapping("/app2")
  public String helloApp2() {
    return projectApp2;
  }
}

 

git 사용 하는 건 문서들이 많이 나와 있어서 s3 로 정리해 봤습니다.

:

[AWS] IGW vs NAT GW

Cloud&Container/AWS 2020. 3. 23. 10:43

VPC 를 구성 하면서 외부 통신을 위해서는 IGW 가 꼭 필요 합니다.

만약 외부 통신이 필요 하지 않은 VPC 라면 IGW 를 구성 하지 않아도 되겠죠.

 

NAT GW 는 VPC 구성 후 Private Subnet 에 있는 리소스가 외부와 Internet 통신을 하기 위해 필요한 서비스 입니다.

이 과정에서 Elastic IP 가 필요 합니다.

 

이 두 GW 의 차이점이 더 궁금하신 분은 아래 문서 참고 하세요.

 

https://medium.com/awesome-cloud/aws-vpc-difference-between-internet-gateway-and-nat-gateway-c9177e710af6

Internet Gateway

An Internet Gateway (IGW) is a logical connection between an Amazon VPC and the Internet. It is not a physical device. Only one can be associated with each VPC. It does not limit the bandwidth of Internet connectivity. (The only limitation on bandwidth is the size of the Amazon EC2 instance, and it applies to all traffic — internal to the VPC and out to the Internet.)

If a VPC does not have an Internet Gateway, then the resources in the VPC cannot be accessed from the Internet (unless the traffic flows via a corporate network and VPN/Direct Connect).

An Internet Gateway allows resources within your VPC to access the internet, and vice versa. In order for this to happen, there needs to be a routing table entry allowing a subnet to access the IGW.

That is to say — an IGW allows resources within your public subnet to access the internet, and the internet to access said resources.

A subnet is deemed to be a Public Subnet if it has a Route Table that directs traffic to the Internet Gateway.


NAT Gateway

A NAT Gateway does something similar, but with two main differences:

  1. It allows resources in a private subnet to access the internet (think yum updates, external database connections, wget calls, OS patch, etc)
  2. It only works one way. The internet at large cannot get through your NAT to your private resources unless you explicitly allow it.

AWS introduced a NAT Gateway Service that can take the place of a NAT Instance. The benefits of using a NAT Gateway service are:

  • It is a fully-managed service — just create it and it works automatically, including fail-over
  • It can burst up to 10 Gbps (a NAT Instance is limited to the bandwidth associated with the EC2 instance type)

However:

  • Security Groups cannot be associated with a NAT Gateway
  • You’ll need one in each AZ since they only operate in a single AZ
:

[AWS] EC2 인스턴스 백업 하기

Cloud&Container/AWS 2020. 3. 16. 17:03

내부에서 사용하는 EC2 인스턴스의 경우 HA 구성까지는 너무 오버라고 생각될 때 최소한의 Backup 정책 정도는 만들어 놓는게 좋습니다.

 

Case 1) 임의 수동 Snapshot 생성

Backup 하고자 하는 Instance 에서 우클릭 후 Snapshot 생성 을 선택 하시면 됩니다.

Selected Instance -> Right Click -> Image -> Create Image

이와 같이 하면 IMAGES 매뉴에서 AMIs  에 생성된 이미지를 보실 수 있습니다.

 

Case 2) 주기적인 자동 Snapshot 생성 (EBS)

EC2 화면에서 수명 주기 관리자(Lifecycle Manager)

Create Snapshot Lifecycle Policy 를 선택해서 필요한 Scheduler 를 만듭니다.

자세한 내용이 궁금한 분들은 공홈 문서를 보시면 좋을 것 같습니다.

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html

:

[AWS] aws cli 사용 시 --query 알아보기

Cloud&Container/AWS 2020. 3. 13. 21:46

알아 보기라고 하기에는 그냥 약간의 예제와 학습 해야 하는 문서 링크 입니다.

 

https://jmespath.org/specification.html#filter-expressions

$ aws iot list-thing-types --query 'thingTypes[].[thingTypeName, thingTypeName==`1584075120782`]'
$ aws iot list-thing-types --query "thingTypes[].[thingTypeName, starts_with(thingTypeName, '15840')]"

 

JMES 가 이거 만든 사람 이름의 약어 인것 같은데, 맞는지 모르겠네요.

© Copyright 2014-2015, James Saryerwinnie.

 

그리고 이 분 AWS 직원인 것 같습니다. :)

:

[AWS] aws iot/iot-data 등등

Cloud&Container/AWS 2020. 3. 13. 16:58

개발 진행을 하다 보면 대 부분 레퍼런스 문서와 API 문서를 안 볼 수가 없습니다.

더군다나 제공 하는 모든 API 를 다 기억 할 수도 없구요.

그래서 그냥 한 눈에 보기 편하게 모아 두었습니다.

 

[aws iot cli command]

https://docs.aws.amazon.com/cli/latest/reference/iot/index.html

accept-certificate-transfer              | add-thing-to-billing-group
add-thing-to-thing-group                 | associate-targets-with-job
attach-policy                            | attach-principal-policy
attach-security-profile                  | attach-thing-principal
cancel-audit-mitigation-actions-task     | cancel-audit-task
cancel-certificate-transfer              | cancel-job
cancel-job-execution                     | clear-default-authorizer
confirm-topic-rule-destination           | create-authorizer
create-billing-group                     | create-certificate-from-csr
create-domain-configuration              | create-dynamic-thing-group
create-job                               | create-keys-and-certificate
create-mitigation-action                 | create-ota-update
create-policy                            | create-policy-version
create-provisioning-claim                | create-provisioning-template
create-provisioning-template-version     | create-role-alias
create-scheduled-audit                   | create-security-profile
create-stream                            | create-thing
create-thing-group                       | create-thing-type
create-topic-rule                        | create-topic-rule-destination
delete-account-audit-configuration       | delete-authorizer
delete-billing-group                     | delete-ca-certificate
delete-certificate                       | delete-domain-configuration
delete-dynamic-thing-group               | delete-job
delete-job-execution                     | delete-mitigation-action
delete-ota-update                        | delete-policy
delete-policy-version                    | delete-provisioning-template
delete-provisioning-template-version     | delete-registration-code
delete-role-alias                        | delete-scheduled-audit
delete-security-profile                  | delete-stream
delete-thing                             | delete-thing-group
delete-thing-type                        | delete-topic-rule
delete-topic-rule-destination            | delete-v2-logging-level
deprecate-thing-type                     | describe-account-audit-configuration
describe-audit-finding                   | describe-audit-mitigation-actions-task
describe-audit-task                      | describe-authorizer
describe-billing-group                   | describe-ca-certificate
describe-certificate                     | describe-default-authorizer
describe-domain-configuration            | describe-endpoint
describe-event-configurations            | describe-index
describe-job                             | describe-job-execution
describe-mitigation-action               | describe-provisioning-template
describe-provisioning-template-version   | describe-role-alias
describe-scheduled-audit                 | describe-security-profile
describe-stream                          | describe-thing
describe-thing-group                     | describe-thing-registration-task
describe-thing-type                      | detach-policy
detach-principal-policy                  | detach-security-profile
detach-thing-principal                   | disable-topic-rule
enable-topic-rule                        | get-cardinality
get-effective-policies                   | get-indexing-configuration
get-job-document                         | get-logging-options
get-ota-update                           | get-percentiles
get-policy                               | get-policy-version
get-registration-code                    | get-statistics
get-topic-rule                           | get-topic-rule-destination
get-v2-logging-options                   | list-active-violations
list-attached-policies                   | list-audit-findings
list-audit-mitigation-actions-executions | list-audit-mitigation-actions-tasks
list-audit-tasks                         | list-authorizers
list-billing-groups                      | list-ca-certificates
list-certificates                        | list-certificates-by-ca
list-domain-configurations               | list-indices
list-job-executions-for-job              | list-job-executions-for-thing
list-jobs                                | list-mitigation-actions
list-ota-updates                         | list-outgoing-certificates
list-policies                            | list-policy-principals
list-policy-versions                     | list-principal-policies
list-principal-things                    | list-provisioning-template-versions
list-provisioning-templates              | list-role-aliases
list-scheduled-audits                    | list-security-profiles
list-security-profiles-for-target        | list-streams
list-tags-for-resource                   | list-targets-for-policy
list-targets-for-security-profile        | list-thing-groups
list-thing-groups-for-thing              | list-thing-principals
list-thing-registration-task-reports     | list-thing-registration-tasks
list-thing-types                         | list-things
list-things-in-billing-group             | list-things-in-thing-group
list-topic-rule-destinations             | list-topic-rules
list-v2-logging-levels                   | list-violation-events
register-ca-certificate                  | register-certificate
register-thing                           | reject-certificate-transfer
remove-thing-from-billing-group          | remove-thing-from-thing-group
replace-topic-rule                       | search-index
set-default-authorizer                   | set-default-policy-version
set-logging-options                      | set-v2-logging-level
set-v2-logging-options                   | start-audit-mitigation-actions-task
start-on-demand-audit-task               | start-thing-registration-task
stop-thing-registration-task             | tag-resource
test-authorization                       | test-invoke-authorizer
transfer-certificate                     | untag-resource
update-account-audit-configuration       | update-authorizer
update-billing-group                     | update-ca-certificate
update-certificate                       | update-domain-configuration
update-dynamic-thing-group               | update-event-configurations
update-indexing-configuration            | update-job
update-mitigation-action                 | update-provisioning-template
update-role-alias                        | update-scheduled-audit
update-security-profile                  | update-stream
update-thing                             | update-thing-group
update-thing-groups-for-thing            | update-topic-rule-destination
validate-security-profile-behaviors      | help

 

[aws iot-data cli command]

https://docs.aws.amazon.com/cli/latest/reference/iot-data/index.html

delete-thing-shadow                      | get-thing-shadow
publish                                  | update-thing-shadow
help

 

[aws iot-jobs-data cli command]

https://docs.aws.amazon.com/cli/latest/reference/iot-jobs-data/index.html

describe-job-execution                   | get-pending-job-executions
start-next-pending-job-execution         | update-job-execution

 

[aws iot1click-devices cli command]

https://docs.aws.amazon.com/cli/latest/reference/iot1click-devices/index.html

claim-devices-by-claim-code              | describe-device
finalize-device-claim                    | get-device-methods
initiate-device-claim                    | invoke-device-method
list-device-events                       | list-devices
list-tags-for-resource                   | tag-resource
unclaim-device                           | untag-resource
update-device-state                      | help

 

[aws iot1click-projects cli command]

https://docs.aws.amazon.com/cli/latest/reference/iot1click-projects/index.html

associate-device-with-placement          | create-placement
create-project                           | delete-placement
delete-project                           | describe-placement
describe-project                         | disassociate-device-from-placement
get-devices-in-placement                 | list-placements
list-projects                            | list-tags-for-resource
tag-resource                             | untag-resource
update-placement                         | update-project
help

 

[aws iotanalytics cli command]

https://docs.aws.amazon.com/cli/latest/reference/iotanalytics/index.html

batch-put-message                        | cancel-pipeline-reprocessing
create-channel                           | create-dataset
create-dataset-content                   | create-datastore
create-pipeline                          | delete-channel
delete-dataset                           | delete-dataset-content
delete-datastore                         | delete-pipeline
describe-channel                         | describe-dataset
describe-datastore                       | describe-logging-options
describe-pipeline                        | get-dataset-content
list-channels                            | list-dataset-contents
list-datasets                            | list-datastores
list-pipelines                           | list-tags-for-resource
put-logging-options                      | run-pipeline-activity
sample-channel-data                      | start-pipeline-reprocessing
tag-resource                             | untag-resource
update-channel                           | update-dataset
update-datastore                         | update-pipeline
help

 

[aws iotevents cli command]

https://docs.aws.amazon.com/cli/latest/reference/iotevents/index.html

create-detector-model                    | create-input
delete-detector-model                    | delete-input
describe-detector-model                  | describe-input
describe-logging-options                 | list-detector-model-versions
list-detector-models                     | list-inputs
list-tags-for-resource                   | put-logging-options
tag-resource                             | untag-resource
update-detector-model                    | update-input
help

 

[aws iotevents-data cli command]

https://docs.aws.amazon.com/cli/latest/reference/iotevents-data/index.html

batch-put-message                        | batch-update-detector
describe-detector                        | list-detectors
help

 

[aws iotsecuretunneling cli command]

https://docs.aws.amazon.com/cli/latest/reference/iotsecuretunneling/index.html

close-tunnel                             | describe-tunnel
list-tags-for-resource                   | list-tunnels
open-tunnel                              | tag-resource
untag-resource                           | help

 

[aws iotthingsgraph cli command]

https://docs.aws.amazon.com/cli/latest/reference/iotthingsgraph/index.html

associate-entity-to-thing                | create-flow-template
create-system-instance                   | create-system-template
delete-flow-template                     | delete-namespace
delete-system-instance                   | delete-system-template
deploy-system-instance                   | deprecate-flow-template
deprecate-system-template                | describe-namespace
dissociate-entity-from-thing             | get-entities
get-flow-template                        | get-flow-template-revisions
get-namespace-deletion-status            | get-system-instance
get-system-template                      | get-system-template-revisions
get-upload-status                        | list-flow-execution-messages
list-tags-for-resource                   | search-entities
search-flow-executions                   | search-flow-templates
search-system-instances                  | search-system-templates
search-things                            | tag-resource
undeploy-system-instance                 | untag-resource
update-flow-template                     | update-system-template
upload-entity-definitions                | help

 

:

[AWS] 아마존 리눅스 & 우분투 타임존 변경

Cloud&Container/AWS 2020. 3. 12. 21:20

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/set-time.html

 

문서 보고 잘 따라 하시면 됩니다. :)

Amazon Linux AMI에서 Amazon Time Sync Service 구성

Amazon Time Sync Service를 사용하도록 인스턴스를 구성하려면

  1. 인스턴스를 연결하고 NTP 서비스를 제거합니다.

     

    [ec2-user ~]$ sudo yum erase 'ntp*'
  2. chrony 패키지를 설치합니다.

     

    [ec2-user ~]$ sudo yum install chrony
  3. vim 또는 nano과 같은 텍스트 편집기를 사용하여 /etc/chrony.conf 파일을 엽니다. 파일이 다음 라인을 포함하고 있는지 확인합니다.

     

    server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4

    이 라인이 존재할 경우, Amazon Time Sync Service가 이미 구성된 상태이기 때문에 다음 단계로 넘어갈 수 있습니다. 라인이 없는 경우에는 파일에 이미 존재하는 다른 server 또는 pool 문 뒤에 라인을 추가하고 변경 사항을 저장합니다.

  4. chrony 데몬(chronyd)을 다시 시작합니다.

     

    [ec2-user ~]$ sudo service chronyd restartStarting chronyd: [ OK ]

    참고

    RHEL 및 CentOS(최대 버전 6까지)에서 서비스 이름은 chrony이 아니라 chronyd입니다.

  5. chkconfig 명령을 사용해서 매번 시스템이 부팅할 때마다 시작되도록 chronyd를 구성합니다.

     

    [ec2-user ~]$ sudo chkconfig chronyd on
  6. chrony가 169.254.169.123 IP 주소를 사용하여 시간을 동기화하고 있는지 확인합니다.

     

    [ec2-user ~]$ chronyc sources -v210 Number of sources = 7 .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 169.254.169.123 3 6 17 43 -30us[ -226us] +/- 287us ^- ec2-12-34-231-12.eu-west> 2 6 17 43 -388us[ -388us] +/- 11ms ^- tshirt.heanet.ie 1 6 17 44 +178us[ +25us] +/- 1959us ^? tbag.heanet.ie 0 6 0 - +0ns[ +0ns] +/- 0ns ^? bray.walcz.net 0 6 0 - +0ns[ +0ns] +/- 0ns ^? 2a05:d018:c43:e312:ce77:> 0 6 0 - +0ns[ +0ns] +/- 0ns ^? 2a05:d018:dab:2701:b70:b> 0 6 0 - +0ns[ +0ns] +/- 0ns

    반환된 출력에서 ^*는 기본 설정된 타임 소스를 나타냅니다.

  7. chrony에서 보고된 시간 동기화 지표를 확인합니다.

     

    [ec2-user ~]$ chronyc trackingReference ID : A9FEA97B (169.254.169.123) Stratum : 4 Ref time (UTC) : Wed Nov 22 13:18:34 2017 System time : 0.000000626 seconds slow of NTP time Last offset : +0.002852759 seconds RMS offset : 0.002852759 seconds Frequency : 1.187 ppm fast Residual freq : +0.020 ppm Skew : 24.388 ppm Root delay : 0.000504752 seconds Root dispersion : 0.001112565 seconds Update interval : 64.4 seconds Leap status : Normal

Ubuntu에서 Amazon Time Sync Service 구성

Amazon Time Sync Service를 사용하도록 인스턴스를 구성하려면

  1. 인스턴스를 연결해 apt를 사용하여 chrony 패키지를 설치합니다.

     

    ubuntu:~$ sudo apt install chrony

    참고

    필요할 경우 sudo apt update를 실행하여 먼저 인스턴스를 업데이트합니다.

  2. vim 또는 nano과 같은 텍스트 편집기를 사용하여 /etc/chrony/chrony.conf 파일을 엽니다. 파일에 이미 존재하는 server 또는 pool 문 앞에 다음 라인을 추가하고 변경 사항을 저장합니다.

     

    server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4
  3. chrony 서비스를 다시 시작합니다.

     

    ubuntu:~$ sudo /etc/init.d/chrony restart[ ok ] Restarting chrony (via systemctl): chrony.service.
  4. chrony가 169.254.169.123 IP 주소를 사용하여 시간을 동기화하고 있는지 확인합니다.

     

    ubuntu:~$ chronyc sources -v210 Number of sources = 7 .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 169.254.169.123 3 6 17 12 +15us[ +57us] +/- 320us ^- tbag.heanet.ie 1 6 17 13 -3488us[-3446us] +/- 1779us ^- ec2-12-34-231-12.eu-west- 2 6 17 13 +893us[ +935us] +/- 7710us ^? 2a05:d018:c43:e312:ce77:6 0 6 0 10y +0ns[ +0ns] +/- 0ns ^? 2a05:d018:d34:9000:d8c6:5 0 6 0 10y +0ns[ +0ns] +/- 0ns ^? tshirt.heanet.ie 0 6 0 10y +0ns[ +0ns] +/- 0ns ^? bray.walcz.net 0 6 0 10y +0ns[ +0ns] +/- 0ns

    반환된 출력에서 ^*는 기본 설정된 타임 소스를 나타냅니다.

  5. chrony에서 보고된 시간 동기화 지표를 확인합니다.

     

    ubuntu:~$ chronyc trackingReference ID : 169.254.169.123 (169.254.169.123) Stratum : 4 Ref time (UTC) : Wed Nov 29 07:41:57 2017 System time : 0.000000011 seconds slow of NTP time Last offset : +0.000041659 seconds RMS offset : 0.000041659 seconds Frequency : 10.141 ppm slow Residual freq : +7.557 ppm Skew : 2.329 ppm Root delay : 0.000544 seconds Root dispersion : 0.000631 seconds Update interval : 2.0 seconds Leap status : Normal

 

:

[AWS] ..user is not authorized to perform: iam:PassRole on resource.. 에러 시

Cloud&Container/AWS 2020. 3. 4. 18:35

항상 그렇지만 에러 메시지를 보면 답이 다 나와 있습니다.

"iam:PassRole" 에 대한 권한이 없다는 것입니다.

 

근데 충분한 권한을 줬다고 생각 했어도 왜 저런 에러가 나는 거지 하고 의심이 될 때가 있습니다.

원인도 찾았고 해결책도 찾았지만 AWS 뿐만 아니라 Cloud 서비스를 잘 사용하기 위해서는 보안과 권한에 대해서 정말 자세히 알고 고민을 하지 않으면 안될 것 같다는 확신이 또 들었습니다.

 

근데 생각 보다 IAM 관련해서 서비스 유형에 따른 템플릿 같은게 많이 없는 것 같아 좀 아쉽 더군요.

시간 날 때 한번 만들어 봐야 겠습니다.

 

iam:PassRole을 수행하도록 인증되지 않음

서비스 연결 역할을 생성하는 경우 해당 역할을 서비스에 전달할 권한이 있어야 합니다. 일부 서
비스는 서비스에서 작업을 수행할 때 계정에 서비스 연결 역할을 자동으로 생성합니다. 예를 들어
Amazon EC2 Auto Scaling에서는 사용자가 Auto Scaling 그룹을 처음으로 생성할 때 사용자를 대신해
AWSServiceRoleForAutoScaling 서비스 연결 역할을 생성합니다. PassRole 권한 없이 Auto Scaling
그룹을 생성하려고 하면 다음 오류가 발생합니다.

 

ClientError: An error occurred (AccessDenied) when calling the
PutLifecycleHook operation: User: arn:aws:sts::111122223333:assumed-role/
Testrole/Diego is not authorized to perform: iam:PassRole on resource:
arn:aws:iam::111122223333:role/aws-service-role/autoscaling.amazonaws.com/
AWSServiceRoleForAutoScaling

 

이 오류를 해결하려면 관리자에게 iam:PassRole 권한을 추가해 달라고 요청합니다.
서비스 연결 역할을 지원하는 서비스를 알아보려면 IAM로 작업하는 AWS 서비스 (p. 571) 단원을 참조하
십시오. 서비스가 자동으로 서비스 연결 역할을 생성하는지 여부를 알아보려면 예 링크를 선택하여 해당 서
비스의 서비스 연결 역할 설명서 단원을 참조하십시오.

 

저 역시 role 에서 정책을 하나 새로 만들어서 해결 했습니다.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iam:GetRole",
                "iam:PassRole"
            ],
            "Resource": "arn:aws:s3:::test-iot-s3-action"
        }
    ]
}

Action 목록이 궁금 하신 분들은 아래 문서 참고 하세요.

https://docs.aws.amazon.com/IAM/latest/UserGuide/list_identityandaccessmanagement.html

: